Blog Article:

Python OCA bindings

Łukasz Oleś

Dec 22, 2010

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:

[python]
#!/usr/bin/env python

client = oca.Client(‘user:password’, ‘http:12.12.12.12:2633/RPC2’)
new_host_id = oca.Host.allocate(client, ‘host_name’, ‘im_xen’, ‘vmm_xen’, ‘tm_nfs’)
hostpool = oca.HostPool(client)
hostpool.info()
for i in hostpool:
if i.id == new_host_id:
host = i
break
print host.name, host.str_state
[/python]

For more details how to use Python OCA read the documentation

Try it and share your thoughts, any feedback is welcome.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *