Hi Team,
I'm using pyvmomi, facing one issue intermittently. I'm using following function to get the VM object by passing VM Name, this method sometime throws "The object 'vim.VirtualMachine:vm-4078' has already been deleted or has not been completely created" error (This error occurs at line if c.name == vm_name: line). Any suggestion on handling this issue is much appreciated. Thanks.
def get_vm_by_name(self, content, vm_name=None😞
try:
vm_obj = None
container = content.viewManager.CreateContainerView(content.rootFolder, [vim.VirtualMachine], True)
for c in container.view:
if vm_name:
if c.name == vm_name:
vm_obj = c
break
return vm_obj
except Exception as ex:
raise Exception("failed to get vm details")
Please note that, same API had returned result for the same VM few seconds before.
VSphere version 6.7.0.20000
Hi,
I am facing a similar issue. any suggestion on handling the above issue?
Thanks
MeToo replies to an unanswered old post dont make sense - create a new post and provide more details.
Ulli