snobear/ezmomi

ezmomi for vSphere 6

bof35 opened this issue · 16 comments

bof35 commented

Hi Snobear,
first of all, very good job for this tool .
I' have a problem only when i clone template with vcenter6.0 ( clone with vcenter5.1 is OK)
This problem appear only with the "clone" args ( list , status ...is OK)

Message return when i clone my template:
...
Traceback (most recent call last):
File "/usr/local/bin/ezmomi", line 4, in
cli.cli()
File "/usr/local/lib/python2.7/site-packages/ezmomi/cli.py", line 30, in cli
ez.clone()
File "/usr/local/lib/python2.7/site-packages/ezmomi/ezmomi.py", line 220, in clone
for device in template_vm.config.hardware.device:
File "/usr/local/lib/python2.7/site-packages/pyVmomi/VmomiSupport.py", line 547, in call
return self.f(_args, *_kwargs)
File "/usr/local/lib/python2.7/site-packages/pyVmomi/VmomiSupport.py", line 370, in _InvokeAccessor
return self._stub.InvokeAccessor(self, info)
File "/usr/local/lib/python2.7/site-packages/pyVmomi/StubAdapterAccessorImpl.py", line 41, in InvokeAccessor
return self.pc.RetrieveContents([filterSpec])[0].propSet[0].val
File "/usr/local/lib/python2.7/site-packages/pyVmomi/VmomiSupport.py", line 553, in
self.f(
(self.args + (obj,) + args), *_kwargs)
File "/usr/local/lib/python2.7/site-packages/pyVmomi/VmomiSupport.py", line 362, in _InvokeMethod
return self._stub.InvokeMethod(self, info, args)
File "/usr/local/lib/python2.7/site-packages/pyVmomi/SoapAdapter.py", line 1226, in InvokeMethod
obj = SoapResponseDeserializer(outerStub).Deserialize(fd, info.result)
File "/usr/local/lib/python2.7/site-packages/pyVmomi/SoapAdapter.py", line 747, in Deserialize
self.parser.ParseFile(response)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1, column 0

my setup:
python 2.7.8/centos6.6
ezmomi 0.4.2 with requirements
Any ideas ...
Thank's

Hello,
Same issue here :/
@snobear , have you got an answer for this issue ?
Thanks

@plat00n @bof35 sorry been super swamped. I have not investigated this. Sounds like a pyvmomi issue. Can you see if there is a newer version of pyvmomi that may have address that?

pip install -U pyvmomi

If not, maybe see if there are any issues on their github repo about this. Thanks!

bof35 commented

Hi Snobear,
I test with the latest pyvmomi 6.0.0 / ezmomi 0.4.2 , but I have similar errors +
...
pyVmomi.SoapAdapter.ParserError: 'xml document: \x1f\x8b\x08\x00\x00\x....
.....\x91\xf2>\x00\x00 parse error at: line:1, col:0'

all ezmomi list --type xxxx command is OK

Is somebody have test clonig a template on vcenter6.0.0 with success ?

Thank's

Hi, yes ezmomi needs to update pyvmomi to 6.0.0 to work with vsphere 6. I plan on working on that soon. Pyvmomi 6 will require Python 2.7+ FYI.

On Dec 10, 2015, at 11:46 AM, bof35 notifications@github.com wrote:

Hi Snobear,
I test with the latest pyvmomi 6.0.0 / ezmomi 0.4.2 , but I have similar errors +
...
pyVmomi.SoapAdapter.ParserError: 'xml document: \x1f\x8b\x08\x00\x00\x....
.....\x91\xf2>\x00\x00 parse error at: line:1, col:0'

all ezmomi list --type xxxx command is OK

Is somebody have test clonig a template on vcenter6.0.0 with success ?

Thank's


Reply to this email directly or view it on GitHub.

@bof35 can you pull down the ezmomi-vsphere6 branch and try it out for me please?

Note that it uses pyvmomi 6 which requires python 2.7, so you'll need to create a virtualenv using 2.7.

git clone git@github.com:snobear/ezmomi.git
virtualenv --no-site-packages ezmomi
cd ezmomi && source bin/activate && export PYTHONPATH=$PWD:$PYTHONPATH
git checkout ezmomi-vsphere6
pip install -r requirements.txt
ezmomi --help

Note you may get a warning about unverified SSL. SSL cert verification was turned on by default in python 2.7.9.

Another side note in case someone runs into it. I tried open-vm-tools from EPEL 6, which works fine on our EL6 VMs, however, it does not support guest customization. So I recommend sticking with the usual VMwaretools for EL6. VMware is recommended open-vm-tools for EL7 moving forward, so its not totally supported for 6 yet.

@plat00n if you could test out that branch as well that would be super helpful :)

bof35 commented

Hi Snobear,
Thank's for your help.
I test with the latest pyvmomi 6.0.0 + ezmomi-vsphere6 branch but the result is the same .
i test with python 2.7.8 , python2.7.11 and python 3.5 ...
All ezmomi command is OK , except clone template...

Cloning T-centos6 to new host p3seo04 with 2048MB RAM...
Traceback (most recent call last):
  File "/home/ansible/ezmomi/bin/ezmomi", line 4, in <module>
    cli.cli()
  File "/home/ansible/ezmomi/ezmomi/cli.py", line 18, in cli
    ez.clone()
  File "/home/ansible/ezmomi/ezmomi/ezmomi.py", line 251, in clone
    for device in template_vm.config.hardware.device:
  File "/home/ansible/ezmomi/lib/python2.7/site-packages/pyVmomi/VmomiSupport.py", line 564, in __call__
    return self.f(*args, **kwargs)
  File "/home/ansible/ezmomi/lib/python2.7/site-packages/pyVmomi/VmomiSupport.py", line 384, in _InvokeAccessor
    return self._stub.InvokeAccessor(self, info)
  File "/home/ansible/ezmomi/lib/python2.7/site-packages/pyVmomi/StubAdapterAccessorImpl.py", line 42, in InvokeAccessor
    options=self._pcType.RetrieveOptions(maxObjects=1))
  File "/home/ansible/ezmomi/lib/python2.7/site-packages/pyVmomi/VmomiSupport.py", line 570, in <lambda>
    self.f(*(self.args + (obj,) + args), **kwargs)
  File "/home/ansible/ezmomi/lib/python2.7/site-packages/pyVmomi/VmomiSupport.py", line 376, in _InvokeMethod
    return self._stub.InvokeMethod(self, info, args)
  File "/home/ansible/ezmomi/lib/python2.7/site-packages/pyVmomi/SoapAdapter.py", line 1326, in InvokeMethod
    raise exc
pyVmomi.SoapAdapter.ParserError: 'xml document: \x1f\x8b\x08\x00\x00\x....

.....\x91\xf2>\x00\x00 parse error at: line:1, col:0'

Looks like its referencing https://github.com/snobear/ezmomi/blob/ezmomi-vsphere6/ezmomi/ezmomi.py#L251. I'm guessing template_vm.config.hardware.device is undefined for you, and I should add a check for it before going into the loop.

Will update and let you know... Thanks for following up.

@bof35 in the meantime, can you please give me some details about the VM template you use? I'm wondering what hardware devices you have attached/associated with the template.

@bof35 also, can you add the --debug option to your clone command? I added it into this vsphere6 branch.

bof35 commented

@snobear , here is my command with --debug arg :

Cloning T-centos6 to new host p3seo08 with 2048MB RAM...
DEBUG: Destination cluster
{'_moId': u'domain-c66',
'_serverGuid': None,
'_stub': <pyVmomi.SoapAdapter.SoapStubAdapter instance at 0x7f079652ac20>}
Traceback (most recent call last):
File "/home/ansible/ezmomi/bin/ezmomi", line 4, in
cli.cli()
File "/home/ansible/ezmomi/ezmomi/cli.py", line 18, in cli
ez.clone()
File "/home/ansible/ezmomi/ezmomi/ezmomi.py", line 218, in clone
pformat(vars(resource_pool))
TypeError: vars() argument must have dict attribute

List resource Pool:
%ezmomi list --type ResourcePool
ResourcePool list
MOID Name
resgroup-67 Resources

My Template HW:
-cpu/ram/graphic card/ctrl scsi/hdd1/hdd2/cd drive/lan drive(vmxnet3)

@bof35 can you git pull the latest? I added additional debug output, and also a check to ensure that particular object is defined. So at the very least it will give me more info to work with.

bof35 commented

@snobear,
my command with your new additionnal debug ouput.

%ezmomi clone --hostname p3seo10 --ips 192.168.7.11 --debug
...InsecureRequestWarning)
Cloning T-centos6-vc6 to new host p3seo10 with 2048MB RAM...
DEBUG: Destination cluster
{'_moId': u'domain-c66',
'_serverGuid': None,
'_stub': <pyVmomi.SoapAdapter.SoapStubAdapter instance at 0x7f6f253aec68>}
Traceback (most recent call last):
File "/home/ansible/ezmomi/bin/ezmomi", line 4, in
cli.cli()
File "/home/ansible/ezmomi/ezmomi/cli.py", line 18, in cli
ez.clone()
File "/home/ansible/ezmomi/ezmomi/ezmomi.py", line 218, in clone
pformat(vars(resource_pool))
TypeError: vars() argument must have dict attribute

@bof35 OK try again :) I added a block to pass through what I think is the troublesome section of code. (Unfortunately I cannot reproduce what you all are seeing on your end so its difficult to troubleshoot the exact issue, but this should mitigate)

bof35 commented

@snobear , Ok now I can clone clone my template :-) , but my VM doesn't start because of conflict when creating Network VLAN settings. ( create a standard network no VLAN)
Is Vlan's Port ID set automatically ? , Can we set the DistributedVirtualSwitch to the config file ?

OK great thanks for working with me on this.

DistributedVirtualSwitch config has been requested in #28. I don't currently have that setup in my lab, so will have to do so in order to implement and test. Keep an eye on that issue for progress.

I'm going to merge this into master and release as ezmomi 6.x in order to follow the vsphere/pyvmomi versioning.