summaryrefslogtreecommitdiffstats
path: root/libvirt-override.c
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2009-11-12 10:53:26 -0500
committerCole Robinson <crobinso@redhat.com>2009-11-12 10:53:26 -0500
commitd0e7cc1264533d6a6e4ad2a5b9252f97dc96cba3 (patch)
tree3e21b67a1e3932267af472667b0b47ffef90af7d /libvirt-override.c
parentbdb9c70e015181fba5f974cf233ceccbe29f1307 (diff)
downloadlibvirt-python-split-d0e7cc1264533d6a6e4ad2a5b9252f97dc96cba3.tar.gz
libvirt-python-split-d0e7cc1264533d6a6e4ad2a5b9252f97dc96cba3.tar.xz
libvirt-python-split-d0e7cc1264533d6a6e4ad2a5b9252f97dc96cba3.zip
Add virConnectGetLibvirtVersion API
There is currently no way to determine the libvirt version of a remote libvirtd we are connected to. This is a useful piece of data to enable feature detection.
Diffstat (limited to 'libvirt-override.c')
-rw-r--r--libvirt-override.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/libvirt-override.c b/libvirt-override.c
index 6c6155b..20037ef 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -728,6 +728,31 @@ libvirt_virGetVersion (PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
return Py_BuildValue ((char *) "kk", libVer, typeVer);
}
+static PyObject *
+libvirt_virConnectGetLibVersion (PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ unsigned long libVer;
+ int c_retval;
+ virConnectPtr conn;
+ PyObject *pyobj_conn;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:virConnectGetLibVersion",
+ &pyobj_conn))
+ return(NULL);
+ conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+
+ c_retval = virConnectGetLibVersion(conn, &libVer);
+
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (c_retval == -1)
+ return VIR_PY_INT_FAIL;
+
+ return PyInt_FromLong (libVer);
+}
static PyObject *
libvirt_virConnectListDomainsID(PyObject *self ATTRIBUTE_UNUSED,
@@ -2398,6 +2423,7 @@ libvirt_virEventInvokeTimeoutCallback(PyObject *self ATTRIBUTE_UNUSED,
static PyMethodDef libvirtMethods[] = {
#include "libvirt-export.c"
{(char *) "virGetVersion", libvirt_virGetVersion, METH_VARARGS, NULL},
+ {(char *) "virConnectGetLibVersion", libvirt_virConnectGetLibVersion, METH_VARARGS, NULL},
{(char *) "virConnectOpenAuth", libvirt_virConnectOpenAuth, METH_VARARGS, NULL},
{(char *) "virConnectListDomainsID", libvirt_virConnectListDomainsID, METH_VARARGS, NULL},
{(char *) "virConnectListDefinedDomains", libvirt_virConnectListDefinedDomains, METH_VARARGS, NULL},