mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-07-27 11:41:52 +03:00
Add virConnectGetVersion Python API
adds a new python API call for retrieving the running hypervisor version used by a connection: virConnectGetVersion * python/generator.py: skip virConnectGetVersion from autogenerated * python/libvirt-override-api.xml python/libvirt-override.c: define direct native bindings
This commit is contained in:
committed by
Daniel Veillard
parent
ce52d4541a
commit
2d35af171a
@ -255,6 +255,7 @@ foreign_encoding_args = (
|
|||||||
# Class methods which are written by hand in libvir.c but the Python-level
|
# 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()).
|
# code is still automatically generated (so they are not in skip_function()).
|
||||||
skip_impl = (
|
skip_impl = (
|
||||||
|
'virConnectGetVersion',
|
||||||
'virConnectGetLibVersion',
|
'virConnectGetLibVersion',
|
||||||
'virConnectListDomainsID',
|
'virConnectListDomainsID',
|
||||||
'virConnectListDefinedDomains',
|
'virConnectListDefinedDomains',
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<api name='libvir-python'>
|
<api name='libvir-python'>
|
||||||
<symbols>
|
<symbols>
|
||||||
|
<function name="virConnectGetVersion" file='python'>
|
||||||
|
<info>Returns the running hypervisor 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="virConnectGetLibVersion" file='python'>
|
<function name="virConnectGetLibVersion" file='python'>
|
||||||
<info>Returns the libvirt version of the connection host</info>
|
<info>Returns the libvirt version of the connection host</info>
|
||||||
<arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/>
|
<arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/>
|
||||||
|
@ -820,6 +820,32 @@ libvirt_virGetVersion (PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
|
|||||||
return Py_BuildValue ((char *) "kk", libVer, typeVer);
|
return Py_BuildValue ((char *) "kk", libVer, typeVer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
libvirt_virConnectGetVersion (PyObject *self ATTRIBUTE_UNUSED,
|
||||||
|
PyObject *args)
|
||||||
|
{
|
||||||
|
unsigned long hvVersion;
|
||||||
|
int c_retval;
|
||||||
|
virConnectPtr conn;
|
||||||
|
PyObject *pyobj_conn;
|
||||||
|
|
||||||
|
if (!PyArg_ParseTuple(args, (char *)"O:virConnectGetVersion",
|
||||||
|
&pyobj_conn))
|
||||||
|
return(NULL);
|
||||||
|
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
|
||||||
|
|
||||||
|
LIBVIRT_BEGIN_ALLOW_THREADS;
|
||||||
|
|
||||||
|
c_retval = virConnectGetVersion(conn, &hvVersion);
|
||||||
|
|
||||||
|
LIBVIRT_END_ALLOW_THREADS;
|
||||||
|
|
||||||
|
if (c_retval == -1)
|
||||||
|
return VIR_PY_INT_FAIL;
|
||||||
|
|
||||||
|
return PyInt_FromLong (hvVersion);
|
||||||
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
libvirt_virConnectGetLibVersion (PyObject *self ATTRIBUTE_UNUSED,
|
libvirt_virConnectGetLibVersion (PyObject *self ATTRIBUTE_UNUSED,
|
||||||
PyObject *args)
|
PyObject *args)
|
||||||
@ -2655,6 +2681,7 @@ libvirt_virEventInvokeTimeoutCallback(PyObject *self ATTRIBUTE_UNUSED,
|
|||||||
static PyMethodDef libvirtMethods[] = {
|
static PyMethodDef libvirtMethods[] = {
|
||||||
#include "libvirt-export.c"
|
#include "libvirt-export.c"
|
||||||
{(char *) "virGetVersion", libvirt_virGetVersion, METH_VARARGS, NULL},
|
{(char *) "virGetVersion", libvirt_virGetVersion, METH_VARARGS, NULL},
|
||||||
|
{(char *) "virConnectGetVersion", libvirt_virConnectGetVersion, METH_VARARGS, NULL},
|
||||||
{(char *) "virConnectGetLibVersion", libvirt_virConnectGetLibVersion, METH_VARARGS, NULL},
|
{(char *) "virConnectGetLibVersion", libvirt_virConnectGetLibVersion, METH_VARARGS, NULL},
|
||||||
{(char *) "virConnectOpenAuth", libvirt_virConnectOpenAuth, METH_VARARGS, NULL},
|
{(char *) "virConnectOpenAuth", libvirt_virConnectOpenAuth, METH_VARARGS, NULL},
|
||||||
{(char *) "virConnectListDomainsID", libvirt_virConnectListDomainsID, METH_VARARGS, NULL},
|
{(char *) "virConnectListDomainsID", libvirt_virConnectListDomainsID, METH_VARARGS, NULL},
|
||||||
|
Reference in New Issue
Block a user