summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xgenerator.py1
-rw-r--r--libvirt-override-api.xml5
-rw-r--r--libvirt-override.c26
3 files changed, 32 insertions, 0 deletions
diff --git a/generator.py b/generator.py
index 21b4137..0b32116 100755
--- a/generator.py
+++ b/generator.py
@@ -255,6 +255,7 @@ foreign_encoding_args = (
# Class methods which are written by hand in libvir.c but the Python-level
# code is still automatically generated (so they are not in skip_function()).
skip_impl = (
+ 'virConnectGetLibVersion',
'virConnectListDomainsID',
'virConnectListDefinedDomains',
'virConnectListNetworks',
diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml
index 148b89b..4e55182 100644
--- a/libvirt-override-api.xml
+++ b/libvirt-override-api.xml
@@ -1,6 +1,11 @@
<?xml version="1.0"?>
<api name='libvir-python'>
<symbols>
+ <function name="virConnectGetLibVersion" file='python'>
+ <info>Returns the libvirt version of the connection host</info>
+ <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/>
+ <return type='int' info="0 on success, -1 on error"/>
+ </function>
<function name="virConnectListDomainsID" file='python'>
<info>Returns the list of the ID of the domains on the hypervisor</info>
<arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/>
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},