I need to write python scripts to automate time configuration of Virtual Machines running on a ESX/ESXi host.
I don't know which API to use.
I am able to find to python bindings for VMWare APIs viz. PySphere and PyVmomi.
Could anyone please explain what is the difference between them, which one should be used?
What is the Difference between PySphere and PyVmomi?
25.8k views Asked by anukalp At
4
There are 4 answers
0
On
pyvmomi is the official python library from VMWare for the vSphere API.
Related links:
- pyvmomi community samples - example code
- ezmomi - pyvmomi-based cli for common tasks like deploying VMs. (Shameless plug)
0
On
Also pyVmomi directly corresponds to the vsphere Managed Object browser. So get to the MOB on the vcenter, figure out what properties you need, the methods as well and the 1 to 1 name convention from pyvmomi helps you achieve what you want. (in short, you learn about vsphere api and are good to go with pyvmomi, no mapping in the head needed)
I'm the (now former) VMware employee who helped get this out the door.
pyVmomi represents the official bindings of the vSphere API released by VMware. The functions and object names map directly to what's documented in the vSphere Web Services SDK. It takes a while to get used to it and we should add some docs helping people map what's in the official documentation to what you can actually use in pyVmomi, but it's really all there and you'll probably get more functionality than you would out of pysphere which wraps official API calls in API-specific function names.
One of the most complete projects that uses the vSphere API via pyVmomi is another project I helped open source, ThinApp Factory. I recommend looking at its source (specifically linked.py) to see what is possible.
If things are hard to use or unclear about pyVmomi, please feel free to file a bug on our Github. Have fun!