diff options
author | Jim Fehlig <jfehlig@novell.com> | 2011-08-26 12:10:21 -0600 |
---|---|---|
committer | Jim Fehlig <jfehlig@suse.com> | 2011-09-01 11:26:21 -0600 |
commit | ffcb4a3f7c89f15031e6077ad350bf4fc66d571c (patch) | |
tree | 76dea002ab00bcfb5ce4f8804f5ddd4109bbdb4e | |
parent | 3faa16ef8eadc6c9988bf113e0b22581ea21c3c9 (diff) | |
download | libvirt-python-v6-ffcb4a3f7c89f15031e6077ad350bf4fc66d571c.tar.gz libvirt-python-v6-ffcb4a3f7c89f15031e6077ad350bf4fc66d571c.tar.xz libvirt-python-v6-ffcb4a3f7c89f15031e6077ad350bf4fc66d571c.zip |
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
-rwxr-xr-x | generator.py | 1 | ||||
-rw-r--r-- | libvirt-override-api.xml | 6 | ||||
-rw-r--r-- | libvirt-override.c | 24 |
3 files changed, 31 insertions, 0 deletions
diff --git a/generator.py b/generator.py index 97434ed..cc253cf 100755 --- a/generator.py +++ b/generator.py @@ -372,6 +372,7 @@ skip_impl = ( 'virNodeGetCPUStats', 'virNodeGetMemoryStats', 'virDomainGetBlockJobInfo', + 'virDomainMigrateGetMaxSpeed', ) diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml index 2fa5eed..1cf115c 100644 --- a/libvirt-override-api.xml +++ b/libvirt-override-api.xml @@ -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> diff --git a/libvirt-override.c b/libvirt-override.c index b5650e2..b020342 100644 --- a/libvirt-override.c +++ b/libvirt-override.c @@ -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} }; |