VMware Cloud Community
Raghavendra2019
Contributor
Contributor

The object has already been deleted or has not been completely created - pyvmomi

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

Tags (1)
0 Kudos
2 Replies
nirajrminz
Contributor
Contributor

Hi,

I am facing a similar issue. any suggestion on handling the above issue?

Thanks

Tags (1)
0 Kudos
continuum
Immortal
Immortal

MeToo replies to an unanswered old post dont make sense - create a new post and provide more details.

Ulli

 

 


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

0 Kudos