[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 11/14] python: Implement virDomainMigrateGetCompressionCache wrapper



---
 python/libvirt-override-api.xml |  7 +++++++
 python/libvirt-override.c       | 28 ++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/python/libvirt-override-api.xml b/python/libvirt-override-api.xml
index 446cdbd..5976fb2 100644
--- a/python/libvirt-override-api.xml
+++ b/python/libvirt-override-api.xml
@@ -491,6 +491,13 @@
       <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='virDomainMigrateGetCompressionCache' file='python'>
+      <info>Get current size of the cache (in bytes) used for compressing
+            repeatedly transferred memory pages during live migration.</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 long' info='current cache size, or None in case of error'/>
+    </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'/>
diff --git a/python/libvirt-override.c b/python/libvirt-override.c
index ebd6878..9637598 100644
--- a/python/libvirt-override.c
+++ b/python/libvirt-override.c
@@ -6322,6 +6322,33 @@ libvirt_virDomainSendKey(PyObject *self ATTRIBUTE_UNUSED,
 }
 
 static PyObject *
+libvirt_virDomainMigrateGetCompressionCache(PyObject *self ATTRIBUTE_UNUSED,
+                                            PyObject *args)
+{
+    PyObject *pyobj_domain;
+    virDomainPtr domain;
+    unsigned int flags;
+    unsigned long long cacheSize;
+    int rc;
+
+    if (!PyArg_ParseTuple(args,
+                          (char *) "Oi:virDomainMigrateGetCompressionCache",
+                          &pyobj_domain, &flags))
+        return VIR_PY_NONE;
+
+    domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
+
+    LIBVIRT_BEGIN_ALLOW_THREADS;
+    rc = virDomainMigrateGetCompressionCache(domain, &cacheSize, flags);
+    LIBVIRT_END_ALLOW_THREADS;
+
+    if (rc < 0)
+        return VIR_PY_NONE;
+
+    return libvirt_ulonglongWrap(cacheSize);
+}
+
+static PyObject *
 libvirt_virDomainMigrateGetMaxSpeed(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
     PyObject *py_retval;
     int c_retval;
@@ -6724,6 +6751,7 @@ static PyMethodDef libvirtMethods[] = {
     {(char *) "virDomainSetBlockIoTune", libvirt_virDomainSetBlockIoTune, METH_VARARGS, NULL},
     {(char *) "virDomainGetBlockIoTune", libvirt_virDomainGetBlockIoTune, METH_VARARGS, NULL},
     {(char *) "virDomainSendKey", libvirt_virDomainSendKey, METH_VARARGS, NULL},
+    {(char *) "virDomainMigrateGetCompressionCache", libvirt_virDomainMigrateGetCompressionCache, METH_VARARGS, NULL},
     {(char *) "virDomainMigrateGetMaxSpeed", libvirt_virDomainMigrateGetMaxSpeed, METH_VARARGS, NULL},
     {(char *) "virDomainBlockPeek", libvirt_virDomainBlockPeek, METH_VARARGS, NULL},
     {(char *) "virDomainMemoryPeek", libvirt_virDomainMemoryPeek, METH_VARARGS, NULL},
-- 
1.8.1.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]