summaryrefslogtreecommitdiffstats
path: root/libvir.py
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2007-05-29 14:58:27 +0000
committerRichard W.M. Jones <rjones@redhat.com>2007-05-29 14:58:27 +0000
commitb599903eb294f14bc2ff3492102d860479ead872 (patch)
tree2c0adcdff7b393979fa5eda06ecc5de5079582f6 /libvir.py
parent33af9b643ad0c342bb058453ae50035e8abdbb0e (diff)
downloadlibvirt-python-split-b599903eb294f14bc2ff3492102d860479ead872.tar.gz
libvirt-python-split-b599903eb294f14bc2ff3492102d860479ead872.tar.xz
libvirt-python-split-b599903eb294f14bc2ff3492102d860479ead872.zip
+Tue May 29 15:56:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>v0.2.3
+ + * python/generator.py, python/libvir.c, python/libvir.py: + Wrap the virGetVersion call as Python libvirt.getVersion. + + * src/libvirt.c: Change virGetVersion so that the driver name + is case insensitive. +
Diffstat (limited to 'libvir.py')
-rw-r--r--libvir.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/libvir.py b/libvir.py
index e1c4ff3..e108b3a 100644
--- a/libvir.py
+++ b/libvir.py
@@ -83,6 +83,29 @@ def registerErrorHandler(f, ctx):
Returns 1 in case of success."""
return libvirtmod.virRegisterErrorHandler(f,ctx)
+#
+# Return library version.
+#
+def getVersion (name = None):
+ """If no name parameter is passed (or name is None) then the
+ version of the libvirt library is returned as an integer.
+
+ If a name is passed and it refers to a driver linked to the
+ libvirt library, then this returns a tuple of (library version,
+ driver version).
+
+ If the name passed refers to a non-existent driver, then you
+ will get the exception 'no support for hypervisor'.
+
+ Versions numbers are integers: 1000000*major + 1000*minor + release."""
+ if name is None:
+ ret = libvirtmod.virGetVersion ();
+ else:
+ ret = libvirtmod.virGetVersion (name);
+ if ret is None: raise libvirtError ("virGetVersion() failed")
+ return ret
+
+
# WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
#
# Everything before this line comes from libvir.py