From 48224969564cd8e45ebaaa8feb63988a1067956f Mon Sep 17 00:00:00 2001 From: govint Date: Tue, 21 Feb 2017 10:59:00 -0800 Subject: [PATCH] Skip VMs whose names can't be resolved for a tenant. --- esx_service/cli/vmdkops_admin.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/esx_service/cli/vmdkops_admin.py b/esx_service/cli/vmdkops_admin.py index 5f3e511ad..3f26d4764 100644 --- a/esx_service/cli/vmdkops_admin.py +++ b/esx_service/cli/vmdkops_admin.py @@ -790,8 +790,12 @@ def generate_vm_list(vms_uuid): res = "" for vm_uuid in vms_uuid: vm_name = vmdk_utils.get_vm_name_by_uuid(vm_uuid) - res = res + vm_name - res = res + "," + # If the VM name cannot be resolved then its possible + # the VM has been deleted or migrated off the host, + # skip the VM in that case. + if vm_name: + res = res + vm_name + res = res + "," if res: res = res[:-1]