vmware / vsphere-automation-sdk-python

Python samples, language bindings, and API reference documentation for vSphere, VMC, and NSX-T using the VMware REST API
MIT License
746 stars 313 forks source link

Cannot find service 'com.vmware.vcenter.vm.guest.power' #343

Closed Jean-PhilippeD closed 1 year ago

Jean-PhilippeD commented 1 year ago

Describe the bug

Hello, I'm trying to use the SDK so I started with sample, and tried to shutdown a VM with guest method and here is what I get:

{'_output': None, '_error': StructValue(name='com.vmware.vapi.std.errors.operation_not_found', values={'data': OptionalValue(None), 'messages': ListValue(values=[StructValue(name='com.vmware.vapi.std.localizable_message', values={'args': ListValue(values=[StringValue(value='com.vmware.vcenter.vm.guest.power')], is_map=False), 'default_message': StringValue(value="Cannot find service 'com.vmware.vcenter.vm.guest.power'."), 'id': StringValue(value='vapi.method.input.invalid.interface')})], is_map=False)})} I can stop the VM with the Hard way, but no matter what I do with guest, it doesn't work (I tried guest.identity and I got same issue)

Reproduction steps

  1. Create a _vsphereclient() - works
  2. Get the vm list with _self.vsphereclient.vcenter.VM.list(VM.FilterSpec(names=names)) - works
  3. On each VM, I try to stop it with _self.vsphereclient.vcenter.vm.guest.Power.shutdown(vm) and here it fails

Expected behavior

I'd like the VM to be stopped smooth with Vmware tools. It works if I stopped if from Vsphere client with tools.

Additional context

No response

mtsvetanov commented 1 year ago

Hi @Jean-PhilippeD, what URL you are connecting the client to? What is the version of the vCenter?

Jean-PhilippeD commented 1 year ago

Hi, I connect to the vcenter with ths FQDN, the vcenter's version is 6.5.0.37

mtsvetanov commented 1 year ago

Thanks, @Jean-PhilippeD!

This API is only added in vSphere 6.7 as documented in this SDK's reference doc.

That is why your 6.5 server doesn't have it, and responds with _com.vmware.vapi.std.errors.operation_notfound error.

Jean-PhilippeD commented 1 year ago

Thank you for the link, I did not found this information. The tests we made manuaylly was wrong so we thought we could use the API :'(