1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-08-02 04:21:59 +03:00

Add public API for getting migration speed

Includes impl of python binding since the generator was not
able to cope.

Note: Requires gendispatch.pl patch from Matthias Bolte

https://www.redhat.com/archives/libvir-list/2011-August/msg01367.html
This commit is contained in:
Jim Fehlig
2011-08-26 12:10:21 -06:00
committed by Jim Fehlig
parent 3faa16ef8e
commit ffcb4a3f7c
3 changed files with 31 additions and 0 deletions

View File

@ -372,6 +372,7 @@ skip_impl = (
'virNodeGetCPUStats',
'virNodeGetMemoryStats',
'virDomainGetBlockJobInfo',
'virDomainMigrateGetMaxSpeed',
)

View File

@ -356,5 +356,11 @@
<arg name='flags' type='unsigned int' info='fine-tuning flags, currently unused, pass 0.'/>
<return type='virDomainBlockJobInfo' info='A dictionary containing job information.' />
</function>
<function name='virDomainMigrateGetMaxSpeed' file='python'>
<info>Get currently configured maximum migration speed for a domain</info>
<arg name='domain' type='virDomainPtr' info='a domain object'/>
<arg name='flags' type='unsigned int' info='flags, currently unused, pass 0.'/>
<return type='unsigned long' info='current max migration speed, or None in case of error'/>
</function>
</symbols>
</api>

View File

@ -4543,6 +4543,29 @@ libvirt_virDomainSendKey(PyObject *self ATTRIBUTE_UNUSED,
return py_retval;
}
static PyObject *
libvirt_virDomainMigrateGetMaxSpeed(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyObject *py_retval;
int c_retval;
unsigned long bandwidth;
virDomainPtr domain;
PyObject *pyobj_domain;
if (!PyArg_ParseTuple(args, (char *)"O:virDomainMigrateGetMaxSpeed", &pyobj_domain))
return(NULL);
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virDomainMigrateGetMaxSpeed(domain, &bandwidth, 0);
LIBVIRT_END_ALLOW_THREADS;
if (c_retval < 0)
return VIR_PY_INT_FAIL;
py_retval = libvirt_ulongWrap(bandwidth);
return(py_retval);
}
/************************************************************************
* *
* The registration stuff *
@ -4632,6 +4655,7 @@ static PyMethodDef libvirtMethods[] = {
{(char *) "virDomainRevertToSnapshot", libvirt_virDomainRevertToSnapshot, METH_VARARGS, NULL},
{(char *) "virDomainGetBlockJobInfo", libvirt_virDomainGetBlockJobInfo, METH_VARARGS, NULL},
{(char *) "virDomainSendKey", libvirt_virDomainSendKey, METH_VARARGS, NULL},
{(char *) "virDomainMigrateGetMaxSpeed", libvirt_virDomainMigrateGetMaxSpeed, METH_VARARGS, NULL},
{NULL, NULL, 0, NULL}
};