Why Pyone?
After years running my own private cloud home and at my startup company, I decided to start privazio. Privazio is a data-center class private cloud targeting residential users and small companies with a special focus on privacy. Privazio is currently under development.
OpenNebula is a fantastic cloud management platform that incorporates the one key feature that Privazio requires most: simplicity. OpenNebula has also a pretty reasonable entry-level hardware requirements. OpenNebula is then the ideal foundation for Privazio.
It would be great to take simplicity further by providing an Ansible module to manage OpenNebula. Any other functionality provided by Privazio will also be managed through Ansible making everything fit together nicely.
In order to develop an Ansible module we need a robust Python API for OpenNebula. This is not an easy task considering that OpenNebula is constantly being improved and its interfaces are likely to evolve.
Introducing Pyone
Pyone is a Python API for OpenNebula developed with two key goals in mind: Maintainability and Completeness.
OpenNebula provides a robust XML-RPC API for which XML Schema Definition (XSD) files are distributed.
Pyone uses the Schema Definition files to auto-generate the Python Bydings with PyXB.
On the other hand, OpenNebula’s XML-RPC API is consistent in the way in which calls are made, data is returned and errors are triggered. This allows for Pyone to subclass Python’s xmlrpc.ServerProxy class implementing all OpenNebula peculiarities in one go: authentication, error conditions, special data types, etc.
By auto-generating the bindings and subclassing the proxy object maintainability and completeness should be achieved. In theory future OpenNebula releases would only require updating the XSD files and regenerating the bindings.
Furthermore, making client calls and navigating the results match 100% the provided Open Nebula XML-RPC documentation.
Client code created with Pyone looks like this:
import pyone one = pyone.OneServer("http://one/RPC2", session="oneadmin:onepass" ) hostpool = one.hostpool.info() host = hostpool.HOST[0] id = host.ID one.vm.update(1,{ 'TEMPLATE': { 'NAME': 'abc', 'MEMORY': '1024', 'ATT1': 'value1' } }, 1)
What is next?
PyOne will completed and matured while developing an OpenNebula module for Ansible.
If you feel like contributing, please checkout Pyone in Github!
0 Comments