1

I am trying to deploy ovf using pyVmomi. I am trying to follow this example: https://github.com/vmware/pyvmomi-community-samples/blob/master/samples/deploy_ovf.py.

There are two VCenter setups and there are differences. On one VCenter, I can deploy the VM. On the other, I have a failure as below:

>>> spec_result = manager.CreateImportSpec(ovfd, rp_obj, datastore_obj,spec_params)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/aitang/virenvs/py343/lib/python3.4/site-packages/pyVmomi/VmomiSupport.py", line 570, in <lambda>
    self.f(*(self.args + (obj,) + args), **kwargs)
  File "/Users/aitang/virenvs/py343/lib/python3.4/site-packages/pyVmomi/VmomiSupport.py", line 376, in _InvokeMethod
    return self._stub.InvokeMethod(self, info, args)
  File "/Users/aitang/virenvs/py343/lib/python3.4/site-packages/pyVmomi/SoapAdapter.py", line 1350, in InvokeMethod
    raise obj # pylint: disable-msg=E0702
pyVmomi.VmomiSupport.InvalidType: (vmodl.fault.InvalidType) {
   dynamicType = <unset>,
   dynamicProperty = (vmodl.DynamicProperty) [],
   msg = '',
   faultCause = <unset>,
   faultMessage = (vmodl.LocalizableMessage) [],
   argument = 'ManagedObjectReference'
}

Can someone point to the way on how I can troubleshoot this error? I tried to look at what this function does but couldn't find it.

I tried to set pdb trace, and it turns out that the reason it fails is that this comes back with a 500 response. On the VCenter that worked, it returns a 200 response. So why would the same call return differently?

aitang
  • 11
  • 3

1 Answers1

0

I used the wrong datastore. The one I used was not of type "Datastore":

>>> type(datastore_obj)
<class 'pyVmomi.VmomiSupport.vim.StoragePod'>

When I used one of its childEntity, it worked:

>>> type(datastore_obj.childEntity[0])
<class 'pyVmomi.VmomiSupport.vim.Datastore'>

Here is what helped with debugging: I put a breakpoint in SoapAdapter.py. When 500 is returned to me, it entered pdb, and I obtained my own request, which contained this line at the bottom:

<datastore type="StoragePod">datastore-1</datastore>

When I compared this with the other VCenter that worked, I saw this difference:

<datastore type="Datastore">datastore-10</datastore>
aitang
  • 11
  • 3