[Libvir] [PATCH] Add Python binding for virGetVersion
Richard W.M. Jones
rjones at redhat.com
Wed May 23 14:58:02 UTC 2007
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libvirt-python-version-20070523.patch
Type: text/x-patch
Size: 3316 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070523/f421768e/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070523/f421768e/attachment-0003.bin>
More information about the libvir-list
mailing list