vmware / pyvmomi-community-samples

A place for community contributed samples for the pyVmomi library.
Apache License 2.0
1.02k stars 925 forks source link

Cloning operation fails, error message states that host is in invalid state. #500

Open rmdcoding opened 6 years ago

rmdcoding commented 6 years ago

Running: VMware ESXi 6.0

When I try to clone a VM, I get the following:

Traceback (most recent call last):
  File "./clone_vm.py", line 397, in <module>
    main()
  File "./clone_vm.py", line 372, in main
    args.resource_pool, False)
  File "./clone_vm.py", line 252, in clone_vm
    WaitForTask(task)
  File "/usr/lib/python2.6/site-packages/pyvmomi-6.5.0.2017.5_1-py2.6.egg/pyVim/task.py", line 139, in WaitForTask
    raise task.info.error
pyVmomi.VmomiSupport.InvalidHostState: (vim.fault.InvalidHostState) {
   dynamicType = <unset>,
   dynamicProperty = (vmodl.DynamicProperty) [],
   msg = 'The operation is not allowed in the current state of the host.',
   faultCause = <unset>,
   faultMessage = (vmodl.LocalizableMessage) [],
   host = 'vim.HostSystem:host-38'
}

I have checked the host system to ensure that it is not in standby mode or in maintenance mode. Everything looks good on the web client.

Any ideas of what could be causing this?

prziborowski commented 6 years ago

The host not being in maintenance mode and being connected should be the only things that throw InvalidHostState (source and destination). If you have access to the vpxd.log file, it might give further insight into why the exception was thrown.

rmdcoding commented 6 years ago

@prziborowski I will check that file and will respond with my findings. Thanks!

rmdcoding commented 6 years ago

@prziborowski Nothing seems out of place in the vpxd.log file.

I find it a little odd that cloning from the GUI produces no errors. It's only when I make an API calls (cloning or migration) that I get the mentioned errors above. I can still query VCenter and get information with no issues.

EDIT: Cloning works using PowerCLI with no issues. I also tried uninstalling and reinstalling Pyvmomi but I am still gettting the same issue. Also tried different versions of Pymomi (6.0, 6.5, 6.7). Even disabled and renabled the vAPI service on my VCenter.

rmdcoding commented 6 years ago

@hartsock Any input/advice?