I am happy to announce first release of the Python OCA bindings. These bindings wrap OpenNebula’s XML-RPC methods in the Python objects, which allows developers to interact with OpenNebula in a more pythonic way.
The package is available on pypi so if you want to try it just run:
$ easy_install oca
Or download the code from github and install it by running:
$ python setup.py install
Here is an example that shows how you can add new host using Python bindings:
client = oca.Client(‘user:password’, ‘http:184.108.40.206:2633/RPC2′)
new_host_id = oca.Host.allocate(client, ‘host_name’, ‘im_xen’, ‘vmm_xen’, ‘tm_nfs’)
hostpool = oca.HostPool(client)
for i in hostpool:
if i.id == new_host_id:
host = i
print host.name, host.str_state
For more details how to use Python OCA read the documentation
Try it and share your thoughts, any feedback is welcome.