When attempting to list orphaned VMs using the "./cell-management-tool find-orphan-vms --host VCD_IP -u <admin_user> -vc-name <vcenter_name> -vc-password <vcenter_password> --vc-user <vcenter_administrator_user> --output-file -" command in VMware Cloud Director, the operation fails with an unexpected execution exception.
The error message indicates:
Unexpected error during command execution: Exception(s) during execution (See log file.), Root Cause: Exception(s) during execution (See log file.)Refer to cell-management-tool.log for more details
DEBUG | pool-1-thread-9 | FindOrphanVmsCommand | Exception while processing vdc |com.vmware.vim.vmomi.client.exception.SslException: com.vmware.vim.vmomi.core.exception.CertificateValidationException: SSL handshake from 0.0.0.0/0.0.0.0:37780 to <VCENTER_FQDN>/##.##.##.##:443 failed in 76 ms at com...Caused by: com.vmware.vim.vmomi.core.exception.CertificateValidationException: SSL handshake from 0.0.0.0/0.0.0.0:37780 to <VCENTER_FQDN>/##.##.##.##:443 failed in 76 msVMware Cloud Director 10.6.x
This is a known issue in VMware Cloud Director where the cell-management-tool (CMT) intermittently encounters closed database sessions causing the command execution to fail.
Broadcom is aware of this issue and a fix is planned for an upcoming release of VMware Cloud Director. Please subscribe to this KB by following the steps in the article:Subscribe an article for future updates on the resolution.
Workaround:
As a temporary workaround, use the following query to identify VMs that exist in an Org VDC resource pool but are not managed by VMware Cloud Director (equivalent to the find-orphan-vms CMT command):
a. Log in directly or by using an SSH client to the primary appliance console as root.
b. Connect to the Cloud Director database using the below command:
sudo -i -u postgres psql vcloud
c. Run the following query to list the orphaned VMs:
WITH vmi AS ( SELECT vm_inv.moref, vm_inv.vc_id, org_prov_vdc_rp_view.rp_name AS res_group_name, org_prov_vdc_rp_view.rp_moref AS res_group_moref FROM vm_inv JOIN org_prov_vdc_rp_view ON vm_inv.resource_pool_moref = org_prov_vdc_rp_view.rp_moref AND vm_inv.vc_id = org_prov_vdc_rp_view.vc_id WHERE vm_inv.is_deleted = false AND vm_inv.is_vrouter = false AND NOT EXISTS (SELECT 1 FROM shadow_vm sv WHERE sv.vc_id = vm_inv.vc_id AND sv.moref = vm_inv.moref) AND NOT EXISTS (SELECT 1 FROM multi_vc_vm mvv WHERE mvv.vc_id = vm_inv.vc_id AND mvv.moref = vm_inv.moref) AND NOT EXISTS (SELECT 1 FROM disk d WHERE d.vc_id = vm_inv.vc_id AND d.shell_vm_moref = vm_inv.moref))SELECT vm_inv.name, vmi.res_group_name, vm_inv.moref, vm_inv.vc_idFROM vm_invJOIN vmi ON vmi.moref = vm_inv.moref AND vmi.vc_id = vm_inv.vc_idWHERE NOT EXISTS ( SELECT 1 FROM vm WHERE vm.moref = vm_inv.moref AND vm.vc_id = vm_inv.vc_id);