Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the Difference between PySphere and PyVmomi?

Tags:

python

vmware

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?

Thanks!

like image 441
anukalp Avatar asked Jan 24 '14 07:01

anukalp


2 Answers

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!

like image 59
joshk0 Avatar answered Oct 05 '22 20:10

joshk0


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)

like image 31
Jack Avatar answered Oct 05 '22 18:10

Jack