VMware {code} Community
vijayagce
Enthusiast
Enthusiast

Is there any python vSphere API?

Hi All,

I would like to know whether any updated python vSphere API is available in vmware.

Thanks,

Vijaya

Reply
0 Kudos
6 Replies
lamw
Community Manager
Community Manager

Nope, not officially.

The only Python SDK for VI/vSphere has been this one - http://jkinred.bitbucket.org/psphere/ Though it was initially created on VI 3.5, so you may have issues accessing a newer API such as vSphere 4.0/4.1

The only other official Python SDK is actually one that intergrates with vCO (Orchestrator) - http://labs.vmware.com/flings/pyvco

If you look under the hood of ESX and ESXi, there is actually local python stubs that you might be able to use/reverse engineer. There's no documentation around it and I'm sure it's not officially supported. Lots of the internals are done using python, but I don't think there's any plans to open up a vSphere SDK for Python, though there have been some interest in the community

vijayagce
Enthusiast
Enthusiast

Thanks for your response.

Reply
0 Kudos
stello
Contributor
Contributor

Hi,

  I've recently released a vSphere python library.

  Here's the project site: http://pysphere.googlecode.com

You can install the last stable version with easy_install or pip:

easy_install pysphere

or

pip install pysphere

  I'll be releasing a new version soon with more functionallity.

Regards,

Sebastian.

Reply
0 Kudos
jordiespasa
Contributor
Contributor

Hi Sebastian,

Since only VMware CLI (Perl) and PoweCLI (PowerShell) are officially supported by VMware, let me ask:

- How powerful is pyshpere compared with the both of them (more or less features, strong points, weak ones...)?

- How stable is? It is in production ready stage?

- Who are the mantainers/coders involved in the project?

I really would like to use pysphere, but I need to know I'm chossing the right SDK for production. I cannot play in production environment.

Thanks in advance.

Reply
0 Kudos
chriskatsuo0905
Contributor
Contributor

Hello,

It looks like there is python code for accessing the vSphere API web service in OpenStack.

http://nova.openstack.org/vmwareapi_readme.html

https://code.launchpad.net/~citrix-openstack/nova/vmware-vsphere-support/

http://bazaar.launchpad.net/~citrix-openstack/nova/vmware-vsphere-support/files

I don't know how much mature it is, but if you try it, please let us know Smiley Wink

Best regards,

Christophe

Reply
0 Kudos
stello
Contributor
Contributor

Hi,

Here are my answers to your questions:

- How powerful is pyshpere compared with the both of them (more or less features, strong points, weak ones...)?

  To be honest, I haven't used CLI nor PowerCLI. But I've tried other python vSphere implementations and found pysphere to be much faster.

  In terms of usability, pysphere is tailored to ease specially Virtual Machine operations. In the company I work for, we use it mainly for test cases automation. Basically we revert VMs to snapshots with vulnerable software, pen test them, and see if the exploits work. So we use a lot the recently added guest operations (to trigger client-side exploits or automatically installing new vulnerable software in a snapshot). That's why pysphere presents simplified interfaces for VM operations for which you don't need to know anything about vSphere.

  However you can use it to implement any method or retrieve any property from vSphere, which requires of course a more advance knowledge of both, pysphere and the vSphere SDK (you can check the source code to see how the simplified VM operations are implemented).

  CLI and PowerCLI rely on the vSphere SDK, then I think that pysphere should support the same or more features than them.

I'm still writting the documentation but you can find more info in the project's site.

- How stable is? It is in production ready stage?

We've been using it for more than a year against a Virtual Center with ~12 ESXs connected to it (about 1500 VMs). But, as you mention, is not supported by VMWare so you should use it at your own risk.

- Who are the mantainers/coders involved in the project?

Just me for the moment, I had a couple of simple code contributions from the people that started using it. The project is pretty new on google so I hope to get more contributors.

Hope this helps.

Regards.

Reply
0 Kudos