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

[libvirt] [libvirt-python PATCH 2/2] Implement virDomainMigrateGetMaxDowntime



Add override code for virDomainMigrateGetMaxDowntime

Signed-off-by: John Ferlan <jferlan redhat com>
---
 libvirt-override-api.xml |  7 +++++++
 libvirt-override.c       | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml
index c96e83e..b63a403 100644
--- a/libvirt-override-api.xml
+++ b/libvirt-override-api.xml
@@ -582,6 +582,13 @@
       <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>
+    <function name='virDomainMigrateGetMaxDowntime' file='python'>
+      <info>Get the current value of the maximum downtime (in milliseconds)
+            allowed during a migration of a guest.</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 downtime or None in case of error'/>
+    </function>
     <function name='virDomainMigrate3' file='python'>
       <info>Migrate the domain object from its current host to the destination host
             given by dconn (a connection to the destination host).</info>
diff --git a/libvirt-override.c b/libvirt-override.c
index 3bc05f1..c04ce2e 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -7663,6 +7663,35 @@ libvirt_virDomainMigrateGetMaxSpeed(PyObject *self ATTRIBUTE_UNUSED,
     return libvirt_ulongWrap(bandwidth);
 }
 
+#if LIBVIR_CHECK_VERSION(3, 7, 0)
+static PyObject *
+libvirt_virDomainMigrateGetMaxDowntime(PyObject *self ATTRIBUTE_UNUSED,
+                                       PyObject *args)
+{
+    PyObject *pyobj_domain;
+    virDomainPtr domain;
+    unsigned int flags;
+    unsigned long long downtime;
+    int rc;
+
+    if (!PyArg_ParseTuple(args,
+                          (char *) "OI:virDomainMigrateGetMaxDowntime",
+                          &pyobj_domain, &flags))
+        return NULL;
+
+    domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
+
+    LIBVIRT_BEGIN_ALLOW_THREADS;
+    rc = virDomainMigrateGetMaxDowntime(domain, &downtime, flags);
+    LIBVIRT_END_ALLOW_THREADS;
+
+    if (rc < 0)
+        return VIR_PY_NONE;
+
+    return libvirt_ulonglongWrap(downtime);
+}
+#endif /* LIBVIR_CHECK_VERSION(3, 7, 0) */
+
 #if LIBVIR_CHECK_VERSION(1, 1, 0)
 static PyObject *
 libvirt_virDomainMigrate3(PyObject *self ATTRIBUTE_UNUSED,
@@ -9733,6 +9762,10 @@ static PyMethodDef libvirtMethods[] = {
     {(char *) "virDomainMigrateGetCompressionCache", libvirt_virDomainMigrateGetCompressionCache, METH_VARARGS, NULL},
 #endif /* LIBVIR_CHECK_VERSION(1, 0, 3) */
     {(char *) "virDomainMigrateGetMaxSpeed", libvirt_virDomainMigrateGetMaxSpeed, METH_VARARGS, NULL},
+#if LIBVIR_CHECK_VERSION(3, 7, 0)
+    {(char *) "virDomainMigrateGetMaxDowntime", libvirt_virDomainMigrateGetMaxDowntime, METH_VARARGS, NULL},
+#endif /* LIBVIR_CHECK_VERSION(3, 7, 0) */
+    {(char *) "virDomainMigrateGetMaxSpeed", libvirt_virDomainMigrateGetMaxSpeed, METH_VARARGS, NULL},
 #if LIBVIR_CHECK_VERSION(1, 1, 0)
     {(char *) "virDomainMigrate3", libvirt_virDomainMigrate3, METH_VARARGS, NULL},
     {(char *) "virDomainMigrateToURI3", libvirt_virDomainMigrateToURI3, METH_VARARGS, NULL},
-- 
2.9.5


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