Share article

facebook Share likedin Share googleplus Share pinterest Share

Python OCA bindings

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.

Share article

facebook Share likedin Share googleplus Share pinterest Share
Łukasz Oleś

Leave a Reply

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

1 + 5 =