Re-adding a virtual machine to the vCenter Server Inventory cannot be managed by vCloud Director
search cancel

Re-adding a virtual machine to the vCenter Server Inventory cannot be managed by vCloud Director

book

Article ID: 337644

calendar_today

Updated On:

Products

VMware Cloud Director

Issue/Introduction


Symptoms:
  • A virtual machine re-added to the vCenter Server Inventory cannot be managed by vCloud Director.
  • vCloud Director cannot find the virtual machine with moref 'vm-xx'.


Cause

This issue occurs because the virtual machine Managed Object Reference (Moref) changes when added back to the Inventory. This happens when:
  • A virtual machine is removed from the vCenter Server Inventory when the virtual machine is in an orphaned state.
  • A virtual machine is removed incorrectly, and needs to be added back to the Inventory.

Resolution

The vCloud Director database gets populated with information about its virtual machine and also has information that it receives from vCenter Server.

vCloud Director stores information that it populates about its virtual machine in these tables:
  1. computevm
  2. networked_vm
  3. license_vm_data
  4. vm
Note: Table 4 should be updated automatically.

vCloud Director has information that it receives from vCenter Server which is stored in the vm_inv table.
When the Moref value for one of vCloud Director tables is different than that of the vCenter Server table, vCloud Director is unable to manage the virtual machine.

To resolve this issue, re-associate the vCloud Director entries with the new vCenter Server entries.

Sample scenario


  1. Verify where the virtual machine was placed in vCenter Server:

    As the virtual machine is removed, use vCloud Director to ascertain the information.
    You can use a combination of the virtual machine Properties (right click the virtual machine and select Properties) and the virtual machine Panel within the vApp

    VM = VM_Name
    vApp = vApp_Name (also shares name with a folder created in virtual center)
    Datastore = Datastore_Name
    vDC = Org_vDC_Name - Shows as a Resource Pool in vCenter
    Host = Host_Name

    Given the Host Information you can deduce Cluster and Datacenter information by correlating with vCenter Server.

  2. Add the virtual machine back to the Inventory of vCenter Server:

    To add a virtual machine back to the Inventory of vCenter Server, Browse the Datastore on which the virtual machine resides.
    Find the VMX file, right-click and click Add to Inventory.

  3. Verify the old Moref of the virtual machine and the new Moref of the virtual machine:

    Select * from vm where id in (select svm_id from vapp_vm where name = '<vCloud UI Name>')

    Note: This gives the old Moref value, as this changes when we re-introduce the virtual machine in vSphere back into the Inventory.

    Select * from vm_inv where name = '<Name of the VM in vSphere>'

    Note: This gives us the new Moref value.

  4. Update the vCloud Director tables:

    update computevm set vmmoref = '<New Moref>' where vmmoref = '<Old Moref>'
    update networked_vm set moref = '<New Moref>' where moref = '<Old Moref>'
    update licensing_vm_data set moref = '<New Moref>' where moref = '<Old Moref>'
    update vm set moref = '<New Moref>' where moref = '<Old Moref>'

    Note: There may not be a requirement to update all of the above tables, but they are included for completeness.

    If you are unsure as to the location of the database, this file on the vCloud Director Cell shows the database connection information:

    /opt/vmware/vcloud-director/etc/global.properties