[PATCH v2 2/8] Added public API to start post-copy migration

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

 



Signed-off-by: Cristian Klein <cristian.klein@xxxxxxxxx>
---
 include/libvirt/libvirt.h.in |  3 +++
 src/driver.h                 |  5 +++++
 src/libvirt.c                | 39 +++++++++++++++++++++++++++++++++++++++
 src/libvirt_public.syms      |  5 +++++
 src/remote/remote_driver.c   |  1 +
 src/remote/remote_protocol.x | 13 ++++++++++++-
 src/remote_protocol-structs  |  5 +++++
 7 files changed, 70 insertions(+), 1 deletion(-)

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 82f3aeb..84cd5a4 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -1346,6 +1346,9 @@ int virDomainMigrateToURI3(virDomainPtr domain,
                            unsigned int nparams,
                            unsigned int flags);
 
+int virDomainMigrateStartPostCopy (virDomainPtr domain,
+                                   unsigned int flags);
+
 int virDomainMigrateSetMaxDowntime (virDomainPtr domain,
                                     unsigned long long downtime,
                                     unsigned int flags);
diff --git a/src/driver.h b/src/driver.h
index dc62a8e..9eb29e2 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -1221,6 +1221,10 @@ typedef int
                         unsigned int cellCount,
                         unsigned int flags);
 
+typedef int
+(*virDrvDomainMigrateStartPostCopy)(virDomainPtr domain,
+                                    unsigned int flags);
+
 typedef struct _virDriver virDriver;
 typedef virDriver *virDriverPtr;
 
@@ -1445,6 +1449,7 @@ struct _virDriver {
     virDrvConnectGetDomainCapabilities connectGetDomainCapabilities;
     virDrvConnectGetAllDomainStats connectGetAllDomainStats;
     virDrvNodeAllocPages nodeAllocPages;
+    virDrvDomainMigrateStartPostCopy domainMigrateStartPostCopy;
 };
 
 
diff --git a/src/libvirt.c b/src/libvirt.c
index 2c8ffbe..5bb1897 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -17803,6 +17803,45 @@ virDomainMigrateSetCompressionCache(virDomainPtr domain,
 
 
 /**
+ * virDomainMigrateStartPostCopy:
+ * @domain: a domain object
+ * @flags: extra flags; not used yet, so callers should always pass 0
+ *
+ * Starts post-copy migration. This function has to be called while
+ * migration (initially pre-copy) is in progress. The migration operation
+ * must be called with the VIR_MIGRATE_POSTCOPY flag.
+ *
+ * Returns 0 in case of success, -1 otherwise.
+ */
+int
+virDomainMigrateStartPostCopy(virDomainPtr domain,
+                              unsigned int flags)
+{
+    virConnectPtr conn;
+
+    VIR_DOMAIN_DEBUG(domain);
+
+    virResetLastError();
+
+    virCheckDomainReturn(domain, -1);
+    conn = domain->conn;
+
+    virCheckReadOnlyGoto(conn->flags, error);
+
+    if (conn->driver->domainMigrateStartPostCopy) {
+        if (conn->driver->domainMigrateStartPostCopy(domain, flags) < 0)
+            goto error;
+        return 0;
+    }
+
+    virReportUnsupportedError();
+ error:
+    virDispatchError(conn);
+    return -1;
+}
+
+
+/**
  * virDomainMigrateSetMaxSpeed:
  * @domain: a domain object
  * @bandwidth: migration bandwidth limit in MiB/s
diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
index 5f95802..190eb11 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -684,4 +684,9 @@ LIBVIRT_1.2.9 {
         virNodeAllocPages;
 } LIBVIRT_1.2.8;
 
+LIBVIRT_1.2.10 {
+    global:
+        virDomainMigrateStartPostCopy;
+} LIBVIRT_1.2.9;
+
 # .... define new API here using predicted next version number ....
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 6c49e49..03257ec 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -8239,6 +8239,7 @@ static virDriver remote_driver = {
     .connectGetDomainCapabilities = remoteConnectGetDomainCapabilities, /* 1.2.7 */
     .connectGetAllDomainStats = remoteConnectGetAllDomainStats, /* 1.2.8 */
     .nodeAllocPages = remoteNodeAllocPages, /* 1.2.9 */
+    .domainMigrateStartPostCopy = remoteDomainMigrateStartPostCopy, /* 1.2.10 */
 };
 
 static virNetworkDriver network_driver = {
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index db12cda..dfbc119 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -3111,6 +3111,11 @@ struct remote_connect_get_all_domain_stats_args {
 struct remote_connect_get_all_domain_stats_ret {
     remote_domain_stats_record retStats<REMOTE_DOMAIN_LIST_MAX>;
 };
+
+struct remote_domain_migrate_start_post_copy_args {
+    remote_nonnull_domain dom;
+    unsigned int flags;
+};
 /*----- Protocol. -----*/
 
 /* Define the program number, protocol version and procedure numbers here. */
@@ -5505,5 +5510,11 @@ enum remote_procedure {
      * @generate: none
      * @acl: connect:write
      */
-    REMOTE_PROC_NODE_ALLOC_PAGES = 347
+    REMOTE_PROC_NODE_ALLOC_PAGES = 347,
+
+    /**
+     * @generate: both
+     * @acl: domain:migrate
+     */
+    REMOTE_PROC_DOMAIN_MIGRATE_START_POST_COPY = 348
 };
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index 362baf9..fd98c80 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -2579,6 +2579,10 @@ struct remote_connect_get_all_domain_stats_ret {
                 remote_domain_stats_record * retStats_val;
         } retStats;
 };
+struct remote_domain_migrate_start_post_copy_args {
+        remote_nonnull_domain      dom;
+        u_int                      flags;
+};
 enum remote_procedure {
         REMOTE_PROC_CONNECT_OPEN = 1,
         REMOTE_PROC_CONNECT_CLOSE = 2,
@@ -2927,4 +2931,5 @@ enum remote_procedure {
         REMOTE_PROC_DOMAIN_BLOCK_COPY = 345,
         REMOTE_PROC_DOMAIN_EVENT_CALLBACK_TUNABLE = 346,
         REMOTE_PROC_NODE_ALLOC_PAGES = 347,
+        REMOTE_PROC_DOMAIN_MIGRATE_START_POST_COPY = 348,
 };
-- 
1.9.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]