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:
- computevm
- networked_vm
- license_vm_data
- 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
- 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.
- 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.
- 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.
- 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