]> xenbits.xensource.com Git - libvirt.git/commitdiff
Add virDomainMigrateGetMaxDowntime public API
authorScott Garfinkle <scottgar@linux.vnet.ibm.com>
Thu, 17 Aug 2017 22:17:19 +0000 (17:17 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Sat, 26 Aug 2017 11:55:17 +0000 (07:55 -0400)
Add virDomainMigrateGetMaxDowntime to support querying maximum allowable
downtime during live migration.

include/libvirt/libvirt-domain.h
src/driver-hypervisor.h
src/libvirt-domain.c
src/libvirt_public.syms

index a3bb9cbe9c43d2d61aec5e3de9b68bee30606a72..fae24ac93ea106826d0bd08612532fab2345bf88 100644 (file)
@@ -1039,6 +1039,10 @@ int virDomainMigrateToURI3(virDomainPtr domain,
                            unsigned int nparams,
                            unsigned int flags);
 
+int virDomainMigrateGetMaxDowntime(virDomainPtr domain,
+                                   unsigned long long *downtime,
+                                   unsigned int flags);
+
 int virDomainMigrateSetMaxDowntime (virDomainPtr domain,
                                     unsigned long long downtime,
                                     unsigned int flags);
index 3053d7ae8c61a7dd5baefb79aaa6dc8af1ff892c..7b35e9e68da0de3780184ced6efccdac63e6023a 100644 (file)
@@ -696,6 +696,11 @@ typedef int
 typedef int
 (*virDrvDomainAbortJob)(virDomainPtr domain);
 
+typedef int
+(*virDrvDomainMigrateGetMaxDowntime)(virDomainPtr domain,
+                                     unsigned long long *downtime,
+                                     unsigned int flags);
+
 typedef int
 (*virDrvDomainMigrateSetMaxDowntime)(virDomainPtr domain,
                                      unsigned long long downtime,
@@ -1412,6 +1417,7 @@ struct _virHypervisorDriver {
     virDrvDomainGetJobInfo domainGetJobInfo;
     virDrvDomainGetJobStats domainGetJobStats;
     virDrvDomainAbortJob domainAbortJob;
+    virDrvDomainMigrateGetMaxDowntime domainMigrateGetMaxDowntime;
     virDrvDomainMigrateSetMaxDowntime domainMigrateSetMaxDowntime;
     virDrvDomainMigrateGetCompressionCache domainMigrateGetCompressionCache;
     virDrvDomainMigrateSetCompressionCache domainMigrateSetCompressionCache;
index 87fca29c4d44fcc6fe148e33a93b9710038d054f..4d0ac30d5955020363baf88eed9a260072463676 100644 (file)
@@ -8776,6 +8776,47 @@ virDomainMigrateSetMaxDowntime(virDomainPtr domain,
 }
 
 
+/**
+ * virDomainMigrateGetMaxDowntime:
+ * @domain: a domain object
+ * @downtime: return value of the maximum tolerable downtime for live
+ *            migration, in milliseconds
+ * @flags: extra flags; not used yet, so callers should always pass 0
+ *
+ * Gets current maximum tolerable time for which the domain may be paused
+ * at the end of live migration.
+ *
+ * Returns 0 in case of success, -1 otherwise.
+ */
+int
+virDomainMigrateGetMaxDowntime(virDomainPtr domain,
+                               unsigned long long *downtime,
+                               unsigned int flags)
+{
+    virConnectPtr conn;
+
+    VIR_DOMAIN_DEBUG(domain, "downtime = %p, flags=%x", downtime, flags);
+
+    virResetLastError();
+
+    virCheckDomainReturn(domain, -1);
+    conn = domain->conn;
+
+    virCheckNonNullArgGoto(downtime, error);
+
+    if (conn->driver->domainMigrateGetMaxDowntime) {
+        if (conn->driver->domainMigrateGetMaxDowntime(domain, downtime, flags) < 0)
+            goto error;
+        return 0;
+    }
+
+    virReportUnsupportedError();
+ error:
+    virDispatchError(conn);
+    return -1;
+}
+
+
 /**
  * virDomainMigrateGetCompressionCache:
  * @domain: a domain object
index fac77fbea88139328e7a646fc30a1329d2b1db44..b55ca4b553104a666b006931bbdc780834bb4a5e 100644 (file)
@@ -768,4 +768,8 @@ LIBVIRT_3.4.0 {
         virStreamSparseSendAll;
 } LIBVIRT_3.1.0;
 
+LIBVIRT_3.7.0 {
+    global:
+        virDomainMigrateGetMaxDowntime;
+} LIBVIRT_3.4.0;
 # .... define new API here using predicted next version number ....