PyONE: Open Nebula Python Bindings

PyONE is an implementation of Open Nebula XML-RPC bindings in Python. It has been designed as a wrapper for the XML-RPC methods, with some basic helpers. This means that you should be familiar with the XML-RPC API and the XML formats returned by the OpenNebula core. As stated in the XML-RPC documentation, you can download the XML Schemas (XSD) here.

API Documentation

You can consult the doc online, but as long as the code is generated it is not much useful, the main source of the documentation is still the XML-RPC doc <api>

Download and installation

You can either use the system package python-pyone or install it using pip install pyone.


You can configure your XML-RPC Server endpoint and credentials when instantiate the OneServer class:

import pyone
one = pyone.OneServer("http://one:2633/RPC2", session="oneadmin:onepass" )

If you are connecting to a test platform with a self signed certificate you can disable certificate verification as:

import pyone
import ssl
one = pyone.OneServer("http://one:2633/RPC2", session="oneadmin:onepass", context=ssl._create_unverified_context() )

It is also possible to modify the default connection timeout, but note that the setting will modify the TCP socket default timeout of your Python VM, ensure that the chosen timeout is suitable to any other connections running in your project.

Making Calls

Calls match the API documentation provided by OpenNebula:

import pyone

one = pyone.OneServer("http://one:2633/RPC2", session="oneadmin:onepass" )
hostpool =
host = hostpool.HOST[0]
id = host.ID

Note that the session parameter is automatically included as well as the “one.” prefix to the method.

Returned Objects

The returned types have been generated with generateDS and closely match the XSD specification. You can use the XSD specification and XML-RPC as priamry documentation.

marketpool =
m0 = marketpool.MARKETPLACE[0]
print "Markeplace name is " + m0.NAME

Structured Parameters

When making calls, the library will translate flat dictionaries into attribute=value vectors. Such as:,  {"LABELS": "HD"}, 1)

When the provided dictionary has a “root” dictionary, it is considered to be root element and it will be translated to XML:

    'TEMPLATE': {
      'NAME': 'abc',
      'MEMORY': '1024',
      'ATT1': 'value1'
  }, 1)

generateDS creates members from most returned parameters, however, some elements in the XSD are marked as anyType and generateDS cannot generate members automatically, TEMPLATE and USER_TEMPLATE are the common ones. Pyone will allow accessing its contents as a plain python dictionary.

host =
arch = host.TEMPLATE['ARCH']

This makes it possible to read a TEMPLATE as dictionary, modify it and use it as parameter for an update method, as following:

host =
host.TEMPLATE['NOTES']="Just updated",host.TEMPLATE,1)


Some methods will return encoded values such as those representing the STATE of a resource. Constant are provided to better handle those.

  # action that assumes app ready


import pyone
one = pyone.OneServer("http://one:2633/RPC2", session="oneadmin:onepass" )

Allocate localhost as new host'localhost', 'kvm', 'kvm', 0)

See host template

host =[0]

See VM template

vm_template =, -1, -1).VMTEMPLATE[0]

Instantiate it

one.template.instantiate(0, "my_VM")

See it

my_vm =,-1,-1,-1).VM[0]

Terminate it

one.vm.action('terminate', 0)


Python bindings were ported to upstream from stand-alone PyONE addon made by Rafael del Valle PyONE <>