]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Public virDomainMigrateSetMaxDowntime API
authorJiri Denemark <jdenemar@redhat.com>
Fri, 12 Mar 2010 13:55:27 +0000 (14:55 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Fri, 19 Mar 2010 21:33:09 +0000 (22:33 +0100)
include/libvirt/libvirt.h.in
src/libvirt.c
src/libvirt_public.syms

index 1430a959ed861b5c68891973867da31055be4d6f..12b8ea12b0e86b00e50f74e6d64781a3b69e793b 100644 (file)
@@ -408,6 +408,10 @@ int virDomainMigrateToURI (virDomainPtr domain, const char *duri,
                            unsigned long flags, const char *dname,
                            unsigned long bandwidth);
 
+int virDomainMigrateSetMaxDowntime (virDomainPtr domain,
+                                    unsigned long long downtime,
+                                    unsigned int flags);
+
 /**
  * VIR_NODEINFO_MAXCPUS:
  * @nodeinfo: virNodeInfo instance
index 74b075b6f5c9e5aa035ab289453e64e5bf66c6ab..7b74fd9336d62e758ecbd441a2f86b5a02909624 100644 (file)
@@ -11312,3 +11312,52 @@ error:
     virDispatchError(conn);
     return -1;
 }
+
+
+/**
+ * virDomainMigrateSetMaxDowntime:
+ * @domain: a domain object
+ * @downtime: maximum tolerable downtime for live migration, in milliseconds
+ * @flags: fine-tuning flags, currently unused, use 0
+ *
+ * Sets maximum tolerable time for which the domain is allowed to be paused
+ * at the end of live migration. It's supposed to be called while the domain is
+ * being live-migrated as a reaction to migration progress.
+ *
+ * Returns 0 in case of success, -1 otherwise.
+ */
+int
+virDomainMigrateSetMaxDowntime(virDomainPtr domain,
+                               unsigned long long downtime,
+                               unsigned int flags)
+{
+    virConnectPtr conn;
+
+    DEBUG("domain=%p, downtime=%llu, flags=%u", domain, downtime, flags);
+
+    virResetLastError();
+
+    if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virDispatchError(NULL);
+        return -1;
+    }
+
+    conn = domain->conn;
+    if (conn->flags & VIR_CONNECT_RO) {
+        virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        goto error;
+    }
+
+    if (conn->driver->domainMigrateSetMaxDowntime) {
+        if (conn->driver->domainMigrateSetMaxDowntime(domain, downtime, flags) < 0)
+            goto error;
+        return 0;
+    }
+
+    virLibConnError(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+
+error:
+    virDispatchError(conn);
+    return -1;
+}
index 8c72ec61427957b87272d43b35f3c1f3f6f00175..623e53cb112264a6f273f5ba29eb6d665c95673f 100644 (file)
@@ -361,6 +361,7 @@ LIBVIRT_0.7.7 {
 LIBVIRT_0.7.8 {
     global:
        virStorageVolWipe;
+        virDomainMigrateSetMaxDowntime;
 } LIBVIRT_0.7.7;
 
 # .... define new API here using predicted next version number ....