summaryrefslogtreecommitdiffstats
path: root/libvirt-override.c
diff options
context:
space:
mode:
authorAdam Litke <agl@us.ibm.com>2011-06-14 09:36:52 -0500
committerEric Blake <eblake@redhat.com>2011-06-14 22:37:39 -0600
commit4e6c71983c7c2c1c5be242d8d6f713521dfd9152 (patch)
tree13fa241db50e79f108cec77e29e58c6f7df8f8d0 /libvirt-override.c
parent100fe0b46babe8ba48193cf1fd6e520278e9afbd (diff)
downloadlibvirt-python-split-4e6c71983c7c2c1c5be242d8d6f713521dfd9152.tar.gz
libvirt-python-split-4e6c71983c7c2c1c5be242d8d6f713521dfd9152.tar.xz
libvirt-python-split-4e6c71983c7c2c1c5be242d8d6f713521dfd9152.zip
Enable virDomainBlockPull in the python API.
virDomainBlockPullAll and virDomainBlockPullAbort are handled automatically. virDomainBlockPull and virDomainBlockPullInfo require manual overrides since they return a custom type. * python/generator.py: reenable bindings for this entry point * python/libvirt-override-api.xml python/libvirt-override.c: manual overrides Signed-off-by: Adam Litke <agl@us.ibm.com> Acked-by: Daniel P. Berrange <berrange@redhat.com>
Diffstat (limited to 'libvirt-override.c')
-rw-r--r--libvirt-override.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/libvirt-override.c b/libvirt-override.c
index 974decb..cbdbc54 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -2382,6 +2382,57 @@ libvirt_virDomainGetJobInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
return(py_retval);
}
+static PyObject *
+libvirt_virDomainBlockPullImpl(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args, int infoOnly) {
+ virDomainPtr domain;
+ PyObject *pyobj_domain;
+ const char *path;
+ unsigned int flags;
+ virDomainBlockPullInfo info;
+ int c_ret;
+ PyObject *ret;
+
+ if (!PyArg_ParseTuple(args, (char *)"Ozi:virDomainStreamDiskInfo",
+ &pyobj_domain, &path, &flags))
+ return(NULL);
+ domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
+
+LIBVIRT_BEGIN_ALLOW_THREADS;
+ if (infoOnly)
+ c_ret = virDomainGetBlockPullInfo(domain, path, &info, flags);
+ else
+ c_ret = virDomainBlockPull(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("cur"),
+ libvirt_ulonglongWrap(info.cur));
+ PyDict_SetItem(ret, libvirt_constcharPtrWrap("end"),
+ libvirt_ulonglongWrap(info.end));
+
+ return ret;
+}
+
+static PyObject *
+libvirt_virDomainBlockPull(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ return libvirt_virDomainBlockPullImpl(self, args, 0);
+}
+
+static PyObject *
+libvirt_virDomainGetBlockPullInfo(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ return libvirt_virDomainBlockPullImpl(self, args, 1);
+}
+
/*******************************************
* Helper functions to avoid importing modules
@@ -3613,6 +3664,8 @@ 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 *) "virDomainBlockPull", libvirt_virDomainBlockPull, METH_VARARGS, NULL},
+ {(char *) "virDomainGetBlockPullInfo", libvirt_virDomainGetBlockPullInfo, METH_VARARGS, NULL},
{NULL, NULL, 0, NULL}
};