Find vCloud Director Orphaned VM’s

We all are familiar with concept of orphaned VM’s in vSphere. However orphaned VM’s in vCloud Director have slightly different meaning. 

From vCD perspective, virtual machines that are referenced in the vCenter database but not in the vCloud Director database are considered orphan VMs because vCD cannot access them even though they may be consuming compute and storage resources. This kind of reference mismatch can arise for a number of reasons, including high-volume workloads, database errors, and administrative actions.

Starting with vCD 8.2, VMware added one more option to cell management utility to locate such orphaned VM’s so that they can be removed or re-imported into vCloud Director. This utility is not available with any vCD version prior to 8.20.

The command to find orphaned VM’s is find-orphan-vms command which is used in conjunction with cell-management-tool and enables an administrator to list these VMs .

To list the options available with this command, run command: 

# /opt/vmware/vcloud-director/bin/cell-management-tool find-orphan-vms –help

vcd-orphaned-vms.PNG

If you are using self-signed certificates in vCD, then you have to specify truststore file and truststore password along with supplying vcd username/password and vcenter credentials etc. This is the full command that one can use: 

[root@vcd-a bin]# ./cell-management-tool find-orphan-vms –host vcd-a.alex.local -u admin –password vCD-Pwd –trustStore /opt/vmware/vcloud-director/vcd.ks –trustStorePassword vCloud@2017 –vc-name resourcevc01.alex.local –vc-user vcadmin@alex –vc-password passwd –output-file vmlist.txt

The above command will query all all Org VDC’s that are present in vCD and present the list of VM’s in the output file specified in above command.

You can use cat or less utility to see the contents of the output file. The file will list all orphaned VM’s/Org VDC. In my lab I did not had any orphaned VM’s so the list is empty

Below is an example taken from vCD documentation which shows the output when orphaned VM’s are found

I hope you find this post informational. Feel free to share this on social media if it is worth sharing 🙂

Leave a Reply