This patch adds a Python binding for the virGetVersion call (called
libvirt.getVersion).
$ python
Python 2.4.4 (#1, Oct 23 2006, 13:58:18)
[GCC 4.1.1 20061011 (Red Hat 4.1.1-30)] on linux2
Type "help", "copyright", "credits" or "license"
for more information.
>> import libvirt;
>> libvirt.getVersion (None);
(2002, 3000001)
>> libvirt.getVersion ("QEMU");
(2002, 2002)
It also gives you a way to detect if a particular driver is compiled in,
which I guess could be quite useful:
>> libvirt.getVersion ("not_here");
libvir:
error : no support for hypervisor
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/home/rjones/local/lib/python2.4/site-packages/libvirt.py",
line 95, in getVersion
if ret is None: raise libvirtError ("virGetVersion() failed")
libvirt.libvirtError: virGetVersion() failed no support for hypervisor
Rich.
--
Emerging Technologies, Red Hat -
http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in
England and Wales under Company Registration No. 03798903