Quantcast
Channel: VMware Communities : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 178776

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

$
0
0

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


Viewing all articles
Browse latest Browse all 178776

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>