diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2007-05-29 14:58:27 +0000 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2007-05-29 14:58:27 +0000 |
commit | b599903eb294f14bc2ff3492102d860479ead872 (patch) | |
tree | 2c0adcdff7b393979fa5eda06ecc5de5079582f6 /libvir.c | |
parent | 33af9b643ad0c342bb058453ae50035e8abdbb0e (diff) | |
download | libvirt-python-v6-0.2.3.tar.gz libvirt-python-v6-0.2.3.tar.xz libvirt-python-v6-0.2.3.zip |
+Tue May 29 15:56:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>v0.2.3LIVIRT_0_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.c')
-rw-r--r-- | libvir.c | 45 |
1 files changed, 45 insertions, 0 deletions
@@ -179,6 +179,36 @@ libvirt_virRegisterErrorHandler(ATTRIBUTE_UNUSED PyObject * self, ************************************************************************/ static PyObject * +libvirt_virGetVersion (PyObject *self ATTRIBUTE_UNUSED, PyObject *args) +{ + char *type = NULL; + unsigned long libVer, typeVer = 0; + int c_retval; + + if (!PyArg_ParseTuple (args, (char *) "|s", &type)) + return NULL; + + LIBVIRT_BEGIN_ALLOW_THREADS; + + if (type == NULL) + c_retval = virGetVersion (&libVer, NULL, NULL); + else + c_retval = virGetVersion (&libVer, type, &typeVer); + + LIBVIRT_END_ALLOW_THREADS; + + if (c_retval == -1) { + Py_INCREF(Py_None); + return (Py_None); + } + + if (type == NULL) + return PyInt_FromLong (libVer); + else + return Py_BuildValue ((char *) "kk", libVer, typeVer); +} + +static PyObject * libvirt_virDomainFree(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; int c_retval; @@ -628,6 +658,7 @@ libvirt_virNetworkGetAutostart(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) ************************************************************************/ static PyMethodDef libvirtMethods[] = { #include "libvirt-export.c" + {(char *) "virGetVersion", libvirt_virGetVersion, METH_VARARGS, NULL}, {(char *) "virDomainFree", libvirt_virDomainFree, METH_VARARGS, NULL}, {(char *) "virConnectClose", libvirt_virConnectClose, METH_VARARGS, NULL}, {(char *) "virConnectListDomainsID", libvirt_virConnectListDomainsID, METH_VARARGS, NULL}, @@ -664,3 +695,17 @@ initlibvirtmod(void) initialized = 1; } + +/* + * vim: set tabstop=4: + * vim: set shiftwidth=4: + * vim: set expandtab: + */ +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * tab-width: 4 + * End: + */ |