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
This commit is contained in:
Adam Litke 2011-07-22 13:43:53 +08:00 committed by Daniel Veillard
parent b31abc6f03
commit f50750b2d0
3 changed files with 47 additions and 1 deletions

View File

@ -186,7 +186,6 @@ def enum(type, name, value):
functions_failed = [] functions_failed = []
functions_skipped = [ functions_skipped = [
"virConnectListDomains", "virConnectListDomains",
'virDomainGetBlockJobInfo',
] ]
skipped_modules = { skipped_modules = {
@ -370,6 +369,7 @@ skip_impl = (
'virDomainSendKey', 'virDomainSendKey',
'virNodeGetCPUStats', 'virNodeGetCPUStats',
'virNodeGetMemoryStats', 'virNodeGetMemoryStats',
'virDomainGetBlockJobInfo',
) )

View File

@ -320,5 +320,12 @@
<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='virDomainGetBlockJobInfo' file='python'>
<info>Get progress information for a block job</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='virDomainBlockJobInfo' info='A dictionary containing job information.' />
</function>
</symbols> </symbols>
</api> </api>

View File

@ -2413,6 +2413,44 @@ libvirt_virDomainGetJobInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
return(py_retval); 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 * Helper functions to avoid importing modules
@ -3872,6 +3910,7 @@ 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 *) "virDomainGetBlockJobInfo", libvirt_virDomainGetBlockJobInfo, METH_VARARGS, NULL},
{NULL, NULL, 0, NULL} {NULL, NULL, 0, NULL}
}; };