If the virtual machine being searched for does not exist, the delay in returning output is about one minute. If the virtual machine being searched for does exist, the delay is about two seconds. I know I'm hitting a timeout value, but is there a quicker way to get to a search failure perhaps? We have very large vSphere environments, so things run fine in the lab, but prod ;)
def getobject(vimtype, name):
obj = None
container = content.viewManager.CreateContainerView(content.rootFolder, vimtype, True)
for c in container.view:
if c.name == name:
obj = c
break
return obj
vm = getobject([vim.VirtualMachine], "vm name")
print(vm)