Showing posts with label qemu. Show all posts
Showing posts with label qemu. Show all posts

Friday, November 28, 2008

Libvirt 0.5.0

This may be old news for some but libvirt 0.5.0 is now available. As usual, the bug fixes and improvements are spread throughout the library. There looks to be some interesting new features in the Qemu/KVM driver. Namely, "domain lifecycle event support" and "migration support".

The domain life cycle support includes Python bindings according to the change log whereas nothing is mentioned about Python support regarding the migration support for Qemu/KVM. Also, the domain life cycle support mentions only Qemu and Xen. I haven't actually tried using 0.5.0 yet but if I find anything else interesting to write about I will.

Tuesday, November 25, 2008

Python libvirt example

Xen sucks for my purposes. Xen is an extremely powerful virtualization platform and is why I don't need it. Few people do for development or experimental purposes. This is where KVM, QEMU, and Libvirt come in handy. I can use Python to easily write a simple application to create virtual machines and manipulate them as needed using the Libvirt Python binding. So, here is a simple example of how to get started using Libvirt in Python.
#Simple Python libvirt example.

import libvirt

if __name__=='__main__':
conn=libvirt.open('qemu:///system')
print 'Listing running domains'
for id in conn.listDomainsID():
dom=conn.lookupByID(id)
print dir(dom)

print 'Listing defined domains'
for id in conn.listDefinedDomains():
dom=conn.lookupByName(id)
print dir(dom)
The great thing about Libvirt is that, in theory, should decide I want to use Xen, this same code should work. Libvirt is still in its' infancy with a long way to go but the ideas are right.