1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2024-10-26 16:25:10 +03:00

Implement API bindings for virDomainBlockCopy

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina 2014-09-01 21:58:48 +02:00
parent 5ead8c1b0c
commit 0379d2a31a
3 changed files with 45 additions and 0 deletions

View File

@ -464,6 +464,7 @@ skip_impl = (
'virConnectGetCPUModelNames', 'virConnectGetCPUModelNames',
'virNodeGetFreePages', 'virNodeGetFreePages',
'virNetworkGetDHCPLeases', 'virNetworkGetDHCPLeases',
'virDomainBlockCopy',
) )
lxc_skip_impl = ( lxc_skip_impl = (

View File

@ -640,5 +640,14 @@
<arg name='flags' type='unsigned int' info='unused, pass 0'/> <arg name='flags' type='unsigned int' info='unused, pass 0'/>
<return type='char *' info="list of leases"/> <return type='char *' info="list of leases"/>
</function> </function>
<function name="virDomainBlockCopy" file="python">
<info>Copy the guest-visible contents of a disk image to a new file described by destxml</info>
<arg name='dom' type='virDomainPtr' info='pointer to domain object'/>
<arg name='disk' type='const char *' info='path to the block device, or device shorthand'/>
<arg name='destxml' type='const char *' info='XML description of the copy destination'/>
<arg name='params' type='virTypedParameterPtr' info='optional pointer to block copy parameter object, or NULL'/>
<arg name='flags' type='unsigned int' info='bitwise-OR of virDomainBlockCopyFlags'/>
<return type='int' info='0 if the operation has started, -1 on failure'/>
</function>
</symbols> </symbols>
</api> </api>

View File

@ -8096,6 +8096,40 @@ libvirt_virDomainListGetStats(PyObject *self ATTRIBUTE_UNUSED,
return py_retval; return py_retval;
} }
static PyObject *
libvirt_virDomainBlockCopy(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
{
PyObject *pyobj_dom = NULL;
PyObject *pyobj_dict = NULL;
virDomainPtr dom;
char *disk = NULL;
char *destxml = NULL;
virTypedParameterPtr params = NULL;
int nparams = 0;
unsigned int flags;
int c_retval;
if (!PyArg_ParseTuple(args, (char *) "Ozz|Oi:virDomainBlockCopy",
&pyobj_dom, &disk, &destxml, &pyobj_dict, &params,
&flags))
return VIR_PY_INT_FAIL;
if (PyDict_Check(pyobj_dict)) {
if (virPyDictToTypedParams(pyobj_dict, &params, &nparams, NULL, 0) < 0)
return VIR_PY_INT_FAIL;
}
dom = (virDomainPtr) PyvirDomain_Get(pyobj_dom);
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virDomainBlockCopy(dom, disk, destxml, params, nparams, flags);
LIBVIRT_END_ALLOW_THREADS;
return libvirt_intWrap(c_retval);
}
#endif /* LIBVIR_CHECK_VERSION(1, 2, 8) */ #endif /* LIBVIR_CHECK_VERSION(1, 2, 8) */
/************************************************************************ /************************************************************************
@ -8286,6 +8320,7 @@ static PyMethodDef libvirtMethods[] = {
#if LIBVIR_CHECK_VERSION(1, 2, 8) #if LIBVIR_CHECK_VERSION(1, 2, 8)
{(char *) "virConnectGetAllDomainStats", libvirt_virConnectGetAllDomainStats, METH_VARARGS, NULL}, {(char *) "virConnectGetAllDomainStats", libvirt_virConnectGetAllDomainStats, METH_VARARGS, NULL},
{(char *) "virDomainListGetStats", libvirt_virDomainListGetStats, METH_VARARGS, NULL}, {(char *) "virDomainListGetStats", libvirt_virDomainListGetStats, METH_VARARGS, NULL},
{(char *) "virDomainBlockCopy", libvirt_virDomainBlockCopy, METH_VARARGS, NULL},
#endif /* LIBVIR_CHECK_VERSION(1, 2, 8) */ #endif /* LIBVIR_CHECK_VERSION(1, 2, 8) */
{NULL, NULL, 0, NULL} {NULL, NULL, 0, NULL}
}; };