Closed jhamukesh998 closed 4 years ago
I don't get the error with your code snippet.
Have you followed the installation steps correctly? https://github.com/vmware/vsphere-automation-sdk-python#installing-required-python-packages
Yep, I have configured things correctly. The issue seems to be in last line VM.list(). Because if I comment it, then no error comes prior to that line. I tried https://github.com/vmware/pyvmomi/blob/master/sample/getallvms.py this url and things worked. But not via current repo. Are both using same code base ?
pyvmomi uses SOAP APIs whereas Automation SDK uses REST endpoints
Ya I had used this as well https://github.com/vmware/vsphere-automation-sdk-python/blob/master/samples/vsphere/vcenter/vm/list_vms.py list_of_vms = self.client.vcenter.VM.list() code was breaking on this function.
Can you try it in a new virtual environment? Not that what you have done is incorrect, just to make sure there are no conflicting versions.
Yes, I will do and update it. Most probably I can do this tomorrow.
Same error even when tried again in new venv
File "file.py", line 18, in <module>
print(vsphere_client.vcenter.VM.list())
File "/Users/mukesh/Desktop/vcenter/sdk/sdk/lib/python3.7/site-packages/com/vmware/vcenter_client.py", line 5153, in list
'filter': filter,
File "/Users/mukesh/Desktop/vcenter/sdk/sdk/lib/python3.7/site-packages/vmware/vapi/bindings/stub.py", line 345, in _invoke
return self._api_interface.native_invoke(ctx, _method_name, kwargs)
File "/Users/mukesh/Desktop/vcenter/sdk/sdk/lib/python3.7/site-packages/vmware/vapi/bindings/stub.py", line 298, in native_invoke
self._rest_converter_mode)
com.vmware.vapi.std.errors_client.InternalServerError: {messages : [LocalizableMessage(id='vapi.bindings.method.impl.unexpected', default_message='Provider method implementation threw unexpected exception: null', args=['null'], params=None, localized=None)], data : None, error_type : None}
what is your vsphere version?
Note that list_vms works only for 6.5+ https://github.com/vmware/vsphere-automation-sdk-python/blob/861b66e7d79b815aea02227e4ea0f250e49f1032/samples/vsphere/vcenter/vm/list_vms.py#L18
6.7
@ngp-star can you check if you can reproduce this issue?
@iamjhamukesh Do you have any other VC setup that you can try on? Have you by any chance modified any permissions?
No, I don't have access to other VC setups and I haven't modified any permissions. But pyVim and pyVmomi is working perfectly for me. Only vmware.vapi.vsphere.client isn't working for me . I am even able to write an output to the server inside the cluster using pyVmomi and pyVim
Hi @iamjhamukesh
we tried with vc setup 67u1 version sample , its working, able to list all vms.
I am facing the same issue yet: vSphere Client version 6.7.0.40000
Traceback (most recent call last):
File "sample.py", line 12, in <module>
print(vsphere_client.vcenter.VM.list())
File "/usr/local/lib/python3.7/site-packages/com/vmware/vcenter_client.py", line 5153, in list
'filter': filter,
File "/usr/local/lib/python3.7/site-packages/vmware/vapi/bindings/stub.py", line 345, in _invoke
return self._api_interface.native_invoke(ctx, _method_name, kwargs)
File "/usr/local/lib/python3.7/site-packages/vmware/vapi/bindings/stub.py", line 298, in native_invoke
self._rest_converter_mode)
com.vmware.vapi.std.errors_client.InternalServerError: {messages : [LocalizableMessage(id='vapi.bindings.method.impl.unexpected', default_message='Provider method implementation threw unexpected exception: null', args=['null'], params=None, localized=None)], data : None, error_type : None}
I get the same error when trying to list VMs that are not assigned to a network and are therefore inaccessible. If I exclude the problematic VMs, then the API call works.
@iamjhamukesh,
Is @imokyoureok 's scenario possible cause of error in your case?
@iamjhamukesh Any update?
closing this issue as there are no updates.
wait!! we get the same issue, it errors when there are orphaned vms in the result set
we are using the rest interface directly via c# though so maybe not the python sdk at fault
I test with vcenter 6.7.0.42000 with API
https://
I have the same problem: Provider method implementation threw unexpected exception: null
But it work well (list ok vm) when push some string in filter:
https://
(With API document: https://vdc-repo.vmware.com/vmwb-repository/dcr-public/1cd28284-3b72-4885-9e31-d1c6d9e26686/71ef7304-a6c9-43b3-a3cd-868b2c236c81/doc/operations/com/vmware/vcenter/vm.list-operation.html )
More information: In my case, there is one esxi included an Inaccessable VM, it will cause return Empty list of vm. I remove Inaccessable VM, it return well full list VMs
Hi,
So when i apply the powered on filter, it lists all vms. When I remove that filter, it produces the following exception:
Hi,
So when i apply the powered on filter, it lists all vms. When I remove that filter, it produces the following exception:
If it has any unaccessable, obsolete vm on vcenter?
Hi, So when i apply the powered on filter, it lists all vms. When I remove that filter, it produces the following exception:
If it has any unaccessable, obsolete vm on vcenter?
Yes, it did have an obsolete vm.
Almost a year, issue still there....Quite easy to reproduce, what are you doing VMware, my lover?
@jhamukesh998
Could you please share the vc bundle, i'm not able to reproduce the issue
Environment
python version: Python 3.7.6
vSphere version: vSphere-Automation-SDK 1.21.0
Operating System/Shell (used to run SDK-based apps): Mac OS(10.14.6)
Steps or code snippet to reproduce
Actual behavior:
Expected behavior:
All the Vm's should be listed up
However when I do this I get the bunch of VM's which are up. I don't know are they both doing same thing ?
Moreover in Vsphere - api explorer the code for fetching requests are also not given as well as no way to generate token.