提交 d74b86f5 编写于 作者: A Adam Litke 提交者: Eric Blake

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: NAdam Litke <agl@us.ibm.com>
Acked-by: NDaniel P. Berrange <berrange@redhat.com>
上级 3e2493ce
...@@ -184,8 +184,6 @@ def enum(type, name, value): ...@@ -184,8 +184,6 @@ def enum(type, name, value):
functions_failed = [] functions_failed = []
functions_skipped = [ functions_skipped = [
"virConnectListDomains", "virConnectListDomains",
'virDomainBlockPull',
'virDomainGetBlockPullInfo',
] ]
skipped_modules = { skipped_modules = {
...@@ -200,7 +198,6 @@ skipped_types = { ...@@ -200,7 +198,6 @@ skipped_types = {
'virConnectDomainEventIOErrorCallback': "No function types in python", 'virConnectDomainEventIOErrorCallback': "No function types in python",
'virConnectDomainEventGraphicsCallback': "No function types in python", 'virConnectDomainEventGraphicsCallback': "No function types in python",
'virEventAddHandleFunc': "No function types in python", 'virEventAddHandleFunc': "No function types in python",
'virDomainBlockPullInfoPtr': "Not implemented yet",
} }
####################################################################### #######################################################################
...@@ -368,6 +365,8 @@ skip_impl = ( ...@@ -368,6 +365,8 @@ skip_impl = (
'virDomainSendKey', 'virDomainSendKey',
'virNodeGetCPUStats', 'virNodeGetCPUStats',
'virNodeGetMemoryStats', 'virNodeGetMemoryStats',
'virDomainBlockPull',
'virDomainGetBlockPullInfo',
) )
......
...@@ -314,5 +314,19 @@ ...@@ -314,5 +314,19 @@
<arg name='flags' type='unsigned int' info='flags, curently unused'/> <arg name='flags' type='unsigned int' info='flags, curently unused'/>
<return type='int' info="0 on success, -1 on error"/> <return type='int' info="0 on success, -1 on error"/>
</function> </function>
<function name='virDomainBlockPull' file='python'>
<info>Initiate an incremental BlockPull for the given disk</info>
<arg name='dom' type='virDomainPtr' info='pointer to the domain'/>
<arg name='path' type='const char *' info='Fully-qualified filename of disk'/>
<arg name='flags' type='unsigned int' info='fine-tuning flags, currently unused, pass 0.'/>
<return type='virDomainBlockPullInfo' info='A dictionary containing progress information.' />
</function>
<function name='virDomainGetBlockPullInfo' file='python'>
<info>Get progress information for a background BlockPull operation</info>
<arg name='dom' type='virDomainPtr' info='pointer to the domain'/>
<arg name='path' type='const char *' info='Fully-qualified filename of disk'/>
<arg name='flags' type='unsigned int' info='fine-tuning flags, currently unused, pass 0.'/>
<return type='virDomainBlockPullInfo' info='A dictionary containing progress information.' />
</function>
</symbols> </symbols>
</api> </api>
...@@ -2382,6 +2382,57 @@ libvirt_virDomainGetJobInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { ...@@ -2382,6 +2382,57 @@ libvirt_virDomainGetJobInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
return(py_retval); 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 * Helper functions to avoid importing modules
...@@ -3613,6 +3664,8 @@ static PyMethodDef libvirtMethods[] = { ...@@ -3613,6 +3664,8 @@ static PyMethodDef libvirtMethods[] = {
{(char *) "virDomainGetJobInfo", libvirt_virDomainGetJobInfo, METH_VARARGS, NULL}, {(char *) "virDomainGetJobInfo", libvirt_virDomainGetJobInfo, METH_VARARGS, NULL},
{(char *) "virDomainSnapshotListNames", libvirt_virDomainSnapshotListNames, METH_VARARGS, NULL}, {(char *) "virDomainSnapshotListNames", libvirt_virDomainSnapshotListNames, METH_VARARGS, NULL},
{(char *) "virDomainRevertToSnapshot", libvirt_virDomainRevertToSnapshot, 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} {NULL, NULL, 0, NULL}
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册