--- python/libvirt-override-api.xml | 6 ++++++ python/libvirt-override.c | 42 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/python/libvirt-override-api.xml b/python/libvirt-override-api.xml index a0e0496..446cdbd 100644 --- a/python/libvirt-override-api.xml +++ b/python/libvirt-override-api.xml @@ -84,6 +84,12 @@ <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='virDomainGetJobStats' file='python'> + <info>Extract information about an active job being processed for a domain.</info> + <return type='virDomainJobStats' info='dictionary mapping field names to values or None in case of error'/> + <arg name='domain' type='virDomainPtr' info='a domain object'/> + <arg name='flags' type='unsigned int' info='flags, currently unused, pass 0.'/> + </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/python/libvirt-override.c b/python/libvirt-override.c index 8154024..ebd6878 100644 --- a/python/libvirt-override.c +++ b/python/libvirt-override.c @@ -4183,6 +4183,47 @@ libvirt_virDomainGetJobInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { } static PyObject * +libvirt_virDomainGetJobStats(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) +{ + PyObject *pyobj_domain; + virDomainPtr domain; + unsigned int flags; + virTypedParameterPtr params = NULL; + int nparams = 0; + int type; + PyObject *dict = NULL; + int rc; + + if (!PyArg_ParseTuple(args, (char *) "Oi:virDomainGetJobStats", + &pyobj_domain, &flags)) + goto cleanup; + domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain); + + LIBVIRT_BEGIN_ALLOW_THREADS; + rc = virDomainGetJobStats(domain, &type, ¶ms, &nparams, flags); + LIBVIRT_END_ALLOW_THREADS; + if (rc < 0) + goto cleanup; + + if (!(dict = getPyVirTypedParameter(params, nparams))) + goto cleanup; + + if (PyDict_SetItem(dict, libvirt_constcharPtrWrap("type"), + libvirt_intWrap(type)) < 0) { + Py_DECREF(dict); + dict = NULL; + goto cleanup; + } + +cleanup: + virTypedParamsFree(params, nparams); + if (dict) + return dict; + else + return VIR_PY_NONE; +} + +static PyObject * libvirt_virDomainGetBlockJobInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { @@ -6673,6 +6714,7 @@ static PyMethodDef libvirtMethods[] = { {(char *) "virConnectListAllInterfaces", libvirt_virConnectListAllInterfaces, METH_VARARGS, NULL}, {(char *) "virConnectBaselineCPU", libvirt_virConnectBaselineCPU, METH_VARARGS, NULL}, {(char *) "virDomainGetJobInfo", libvirt_virDomainGetJobInfo, METH_VARARGS, NULL}, + {(char *) "virDomainGetJobStats", libvirt_virDomainGetJobStats, METH_VARARGS, NULL}, {(char *) "virDomainSnapshotListNames", libvirt_virDomainSnapshotListNames, METH_VARARGS, NULL}, {(char *) "virDomainListAllSnapshots", libvirt_virDomainListAllSnapshots, METH_VARARGS, NULL}, {(char *) "virDomainSnapshotListChildrenNames", libvirt_virDomainSnapshotListChildrenNames, METH_VARARGS, NULL}, -- 1.8.1.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list