summaryrefslogtreecommitdiffstats
path: root/libvirt-override.c
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2010-02-03 11:31:45 +0000
committerDaniel P. Berrange <berrange@redhat.com>2010-03-02 16:22:30 +0000
commit812ed7a260b6003926c903b1938e341dedc44e35 (patch)
tree3507c0e366c469f2b311c1f21e5b53e8efd8bfd4 /libvirt-override.c
parent555abf6ad9753193a50ab0810b754db86bc82610 (diff)
downloadlibvirt-python-v6-812ed7a260b6003926c903b1938e341dedc44e35.tar.gz
libvirt-python-v6-812ed7a260b6003926c903b1938e341dedc44e35.tar.xz
libvirt-python-v6-812ed7a260b6003926c903b1938e341dedc44e35.zip
Introduce public API for domain async job handlingv0.7.7
Introduce a new public API that provides a way to get progress info on currently running jobs on a virDomainpPtr. APIs that are initially within scope of this idea are virDomainMigrate virDomainMigrateToURI virDomainSave virDomainRestore virDomainCoreDump These all take a potentially long time and benefit from monitoring. The virDomainJobInfo struct allows for various pieces of information to be reported - Percentage completion - Time - Overall data - Guest memory data - Guest disk/file data * include/libvirt/libvirt.h.in: Add virDomainGetJobInfo * python/generator.py, python/libvirt-override-api.xml, python/libvirt-override.c: Override for virDomainGetJobInfo API * python/typewrappers.c, python/typewrappers.h: Introduce wrapper for unsigned long long type
Diffstat (limited to 'libvirt-override.c')
-rw-r--r--libvirt-override.c36
1 files changed, 36 insertions, 0 deletions
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}
};