diff options
-rwxr-xr-x | generator.py | 1 | ||||
-rw-r--r-- | libvirt-override-api.xml | 5 | ||||
-rw-r--r-- | libvirt-override.c | 36 | ||||
-rw-r--r-- | typewrappers.c | 8 | ||||
-rw-r--r-- | typewrappers.h | 1 |
5 files changed, 51 insertions, 0 deletions
diff --git a/generator.py b/generator.py index 24eaf50..f7625fd 100755 --- a/generator.py +++ b/generator.py @@ -271,6 +271,7 @@ skip_impl = ( 'virConnGetLastError', 'virGetLastError', 'virDomainGetInfo', + 'virDomainGetJobInfo', 'virNodeGetInfo', 'virDomainGetUUID', 'virDomainGetUUIDString', diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml index 76a6fd5..1260c0c 100644 --- a/libvirt-override-api.xml +++ b/libvirt-override-api.xml @@ -48,6 +48,11 @@ <return type='int *' info='the list of information or None in case of error'/> <arg name='domain' type='virDomainPtr' info='a domain object'/> </function> + <function name='virDomainGetJobInfo' file='python'> + <info>Extract information about an active job being processed for a domain.</info> + <return type='int *' info='the list of information or None in case of error'/> + <arg name='domain' type='virDomainPtr' info='a domain object'/> + </function> <function name='virNodeGetInfo' file='python'> <info>Extract hardware information about the Node.</info> <return type='int *' info='the list of information or None in case of error'/> diff --git a/libvirt-override.c b/libvirt-override.c index 2447ad7..e27bce6 100644 --- a/libvirt-override.c +++ b/libvirt-override.c @@ -2072,6 +2072,41 @@ libvirt_virConnectBaselineCPU(PyObject *self ATTRIBUTE_UNUSED, } +static PyObject * +libvirt_virDomainGetJobInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + int c_retval; + virDomainPtr domain; + PyObject *pyobj_domain; + virDomainJobInfo info; + + if (!PyArg_ParseTuple(args, (char *)"O:virDomainGetJobInfo", &pyobj_domain)) + return(NULL); + domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain); + + LIBVIRT_BEGIN_ALLOW_THREADS; + c_retval = virDomainGetJobInfo(domain, &info); + LIBVIRT_END_ALLOW_THREADS; + if (c_retval < 0) + return VIR_PY_NONE; + py_retval = PyList_New(12); + PyList_SetItem(py_retval, 0, libvirt_intWrap((int) info.type)); + PyList_SetItem(py_retval, 1, libvirt_ulonglongWrap(info.timeElapsed)); + PyList_SetItem(py_retval, 2, libvirt_ulonglongWrap(info.timeRemaining)); + PyList_SetItem(py_retval, 3, libvirt_ulonglongWrap(info.dataTotal)); + PyList_SetItem(py_retval, 4, libvirt_ulonglongWrap(info.dataProcessed)); + PyList_SetItem(py_retval, 5, libvirt_ulonglongWrap(info.dataRemaining)); + PyList_SetItem(py_retval, 6, libvirt_ulonglongWrap(info.memTotal)); + PyList_SetItem(py_retval, 7, libvirt_ulonglongWrap(info.memProcessed)); + PyList_SetItem(py_retval, 8, libvirt_ulonglongWrap(info.memRemaining)); + PyList_SetItem(py_retval, 9, libvirt_ulonglongWrap(info.fileTotal)); + PyList_SetItem(py_retval, 10, libvirt_ulonglongWrap(info.fileProcessed)); + PyList_SetItem(py_retval, 11, libvirt_ulonglongWrap(info.fileRemaining)); + + return(py_retval); +} + + /******************************************* * Helper functions to avoid importing modules * for every callback @@ -2788,6 +2823,7 @@ static PyMethodDef libvirtMethods[] = { {(char *) "virConnectListInterfaces", libvirt_virConnectListInterfaces, METH_VARARGS, NULL}, {(char *) "virConnectListDefinedInterfaces", libvirt_virConnectListDefinedInterfaces, METH_VARARGS, NULL}, {(char *) "virConnectBaselineCPU", libvirt_virConnectBaselineCPU, METH_VARARGS, NULL}, + {(char *) "virDomainGetJobInfo", libvirt_virDomainGetJobInfo, METH_VARARGS, NULL}, {NULL, NULL, 0, NULL} }; diff --git a/typewrappers.c b/typewrappers.c index 9ba99de..b33822c 100644 --- a/typewrappers.c +++ b/typewrappers.c @@ -49,6 +49,14 @@ libvirt_longlongWrap(long long val) } PyObject * +libvirt_ulonglongWrap(unsigned long long val) +{ + PyObject *ret; + ret = PyLong_FromUnsignedLongLong(val); + return (ret); +} + +PyObject * libvirt_charPtrWrap(char *str) { PyObject *ret; diff --git a/typewrappers.h b/typewrappers.h index 61f7249..dadcdd4 100644 --- a/typewrappers.h +++ b/typewrappers.h @@ -138,6 +138,7 @@ PyObject * libvirt_intWrap(int val); PyObject * libvirt_longWrap(long val); PyObject * libvirt_ulongWrap(unsigned long val); PyObject * libvirt_longlongWrap(long long val); +PyObject * libvirt_ulonglongWrap(unsigned long long val); PyObject * libvirt_charPtrWrap(char *str); PyObject * libvirt_constcharPtrWrap(const char *str); PyObject * libvirt_charPtrConstWrap(const char *str); |