summaryrefslogtreecommitdiffstats
path: root/libvirt-override.c
diff options
context:
space:
mode:
authorAdam Litke <agl@us.ibm.com>2011-07-22 13:43:53 +0800
committerDaniel Veillard <veillard@redhat.com>2011-07-22 13:43:53 +0800
commit3d3872d29da204cdf8e9503f090029e8b5aa88ba (patch)
tree31e3d2d72e2a25bb027a796857ce2bd2ff855d8c /libvirt-override.c
parent384d3ae35bb6c4ee90730bd273922447700bea82 (diff)
downloadlibvirt-python-split-3d3872d29da204cdf8e9503f090029e8b5aa88ba.tar.gz
libvirt-python-split-3d3872d29da204cdf8e9503f090029e8b5aa88ba.tar.xz
libvirt-python-split-3d3872d29da204cdf8e9503f090029e8b5aa88ba.zip
Enable virDomainBlockPull in the python API
virDomainGetBlockJobInfo requires manual override since it returns a custom type. * python/generator.py: reenable bindings for this entry point * python/libvirt-override-api.xml python/libvirt-override.c: manual overrides
Diffstat (limited to 'libvirt-override.c')
-rw-r--r--libvirt-override.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/libvirt-override.c b/libvirt-override.c
index b713b6a..e89bc97 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -2413,6 +2413,44 @@ libvirt_virDomainGetJobInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
return(py_retval);
}
+static PyObject *
+libvirt_virDomainGetBlockJobInfo(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ virDomainPtr domain;
+ PyObject *pyobj_domain;
+ const char *path;
+ unsigned int flags;
+ virDomainBlockJobInfo info;
+ int c_ret;
+ PyObject *ret;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozi:virDomainGetBlockJobInfo",
+ &pyobj_domain, &path, &flags))
+ return(NULL);
+ domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
+
+LIBVIRT_BEGIN_ALLOW_THREADS;
+ c_ret = virDomainGetBlockJobInfo(domain, path, &info, flags);
+LIBVIRT_END_ALLOW_THREADS;
+
+ if (c_ret != 1)
+ return VIR_PY_NONE;
+
+ if ((ret = PyDict_New()) == NULL)
+ return VIR_PY_NONE;
+
+ PyDict_SetItem(ret, libvirt_constcharPtrWrap("type"),
+ libvirt_intWrap(info.type));
+ PyDict_SetItem(ret, libvirt_constcharPtrWrap("bandwidth"),
+ libvirt_ulongWrap(info.bandwidth));
+ PyDict_SetItem(ret, libvirt_constcharPtrWrap("cur"),
+ libvirt_ulonglongWrap(info.cur));
+ PyDict_SetItem(ret, libvirt_constcharPtrWrap("end"),
+ libvirt_ulonglongWrap(info.end));
+
+ return ret;
+}
/*******************************************
* Helper functions to avoid importing modules
@@ -3872,6 +3910,7 @@ static PyMethodDef libvirtMethods[] = {
{(char *) "virDomainGetJobInfo", libvirt_virDomainGetJobInfo, METH_VARARGS, NULL},
{(char *) "virDomainSnapshotListNames", libvirt_virDomainSnapshotListNames, METH_VARARGS, NULL},
{(char *) "virDomainRevertToSnapshot", libvirt_virDomainRevertToSnapshot, METH_VARARGS, NULL},
+ {(char *) "virDomainGetBlockJobInfo", libvirt_virDomainGetBlockJobInfo, METH_VARARGS, NULL},
{NULL, NULL, 0, NULL}
};