diff options
author | Taizo ITO <taizo.ito@hde.co.jp> | 2010-01-22 11:01:09 +0100 |
---|---|---|
committer | Daniel Veillard <veillard@redhat.com> | 2010-01-22 11:01:09 +0100 |
commit | 2d35af171a2e7c5eb6ce7e7c2bd90cacb4ab0ce6 (patch) | |
tree | e45a853a79b930bdc2d8f39fb7541761e5172d0f /libvirt-override.c | |
parent | ce52d4541a4467d200c5c317d2be5d31aa6a0537 (diff) | |
download | libvirt-python-2d35af171a2e7c5eb6ce7e7c2bd90cacb4ab0ce6.tar.gz |
Add virConnectGetVersion Python APIv0.7.6
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
Diffstat (limited to 'libvirt-override.c')
-rw-r--r-- | libvirt-override.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libvirt-override.c b/libvirt-override.c index db4c0e1..d90a763 100644 --- a/libvirt-override.c +++ b/libvirt-override.c @@ -821,6 +821,32 @@ libvirt_virGetVersion (PyObject *self ATTRIBUTE_UNUSED, PyObject *args) } 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 * libvirt_virConnectGetLibVersion (PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { @@ -2655,6 +2681,7 @@ libvirt_virEventInvokeTimeoutCallback(PyObject *self ATTRIBUTE_UNUSED, static PyMethodDef libvirtMethods[] = { #include "libvirt-export.c" {(char *) "virGetVersion", libvirt_virGetVersion, METH_VARARGS, NULL}, + {(char *) "virConnectGetVersion", libvirt_virConnectGetVersion, METH_VARARGS, NULL}, {(char *) "virConnectGetLibVersion", libvirt_virConnectGetLibVersion, METH_VARARGS, NULL}, {(char *) "virConnectOpenAuth", libvirt_virConnectOpenAuth, METH_VARARGS, NULL}, {(char *) "virConnectListDomainsID", libvirt_virConnectListDomainsID, METH_VARARGS, NULL}, |