Red Hat Enterprise Virtualization 3 (RHEV) comes with a great API that makes it easy to write Python scripts or Java programs for administrative tasks. The full documentation is available here :

A classical need is to automate the creation of virtual machine cold backups on an export domain. This can be easily done by using the Python API.

First you need to install the RHEV Software Development Kit :

$ yum install rhevm-sdk

You can now write a Python script using the ovirtsdk (RHEV SDK) :


from ovirtsdk.api import API

Let’s declare a few constants :

RHEV_USERNAME = "admin@internal"
RHEV_PASSWORD = "ThePassword"

Then try to connect to RHEV :

api = API ( url=RHEV_URL,

print "Connected to %s successfully!" % api.get_product_info().name

We can display inform[…]

>> You can find the full post (free) on my company blog here: