Particularly, I'm working with python and vmware vsphere to make virtual machine creation/power on and stuff like that automated. I know how to print attributes of virtual machines, however, I still can't call any methods because I don't know how.
this is code snippet I'm having trouble with:
for vm in virtual_machines:
print "VM: "+vm['name']+" ("+vm['runtime.powerState']+") ",
if hasattr(vm['guest'],'ipAddress'):
print vm['guest'].ipAddress,
if vm['runtime.powerState'] == 'poweredOn':
print 'RAM: '+str(vm['summary.quickStats'].distributedMemoryEntitlement)+'MB, CPU: '+str(vm['summary.quickStats'].distributedCpuEntitlement)+'MHz',
if vm['name'] == 'VIRT_VZ_114':
# This is the trouble maker, it says types mismatch "suds.TypeNotFound: Type not found: 'guest'"
client.service.PowerOnVM_Task(mo_VirtualMachine,vm)
print
How do I call methods correctly?
Have you looked at psphere at all?
It's a python project to provide native bindings for the vSphere Web Services SDK.
You may be able to get your problems solved quicker with a dedicated library, rather than struggle with suds, SOAP and WDSL issues. It actually uses suds under the hood, but provides you with a pythonic API instead.