Thursday, January 16, 2014

A first look at vSphere SDK for Python

VMware've just recently released the vSphere SDK for Python, the pyVMomi, at last year Christmas. And that is a great news to me. The source code can be found at:

pyVmomi Github Repository:
https://github.com/vmware/pyvmomi

pyVmomi Pypi package:
https://pypi.python.org/pypi/pyvmomi


I've just dig around the sample scripts and found it pretty cool. For example, I ran the geallvms.py to get all virtual machine info :

python sample/getallvms.py --host vmware.host.domain --user vmadmin --password VMAdminPass

It showed me something like:

Name       :  server1
Path       :  [iSCSI LUN 536Gb-A] server1/server1.vmx
Guest      :  Ubuntu Linux (64-bit)
State      :  poweredOn
IP         :  172.55.1.67

Name       :  server2
Path       :  [iSCSI LUN 536Gb-B] server2/server2.vmx
Guest      :  Ubuntu Linux (64-bit)
State      :  poweredOn
IP         :  172.56.1.56

Name       :  server3
Path       :  [iSCSI LUN 536Gb-B] server3/server3.vmx
Guest      :  Ubuntu Linux (64-bit)
State      :  poweredOn
IP         :  172.57.1.20

...

Cool!!!!