[PATCH V2 1/9] qemu_migration: Add support for mutil-thread compressed migration enable

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

 



We need to set the mutil-thread compress capability as true to enable it.

Signed-off-by: Eli Qiao <liyong.qiao@xxxxxxxxx>
Signed-off-by: ShaoHe Feng <shaohe.feng@xxxxxxxxx>
---
 .gnulib                   |  2 +-
 src/qemu/qemu_migration.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++
 src/qemu/qemu_migration.h |  9 +++++++-
 src/qemu/qemu_monitor.c   |  2 +-
 src/qemu/qemu_monitor.h   |  1 +
 5 files changed, 67 insertions(+), 3 deletions(-)

diff --git a/.gnulib b/.gnulib
index f39477d..875ec93 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit f39477dba778e99392948dd3dd19ec0d46aee932
+Subproject commit 875ec93e1501d2d2a8bab1b64fa66b8ceb51dc67
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 7257182..891ddb6 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2343,6 +2343,52 @@ qemuMigrationSetCompression(virQEMUDriverPtr driver,
     return ret;
 }
 
+int
+qemuMigrationSetMultiThreadCompression(virQEMUDriverPtr driver,
+                                       virDomainObjPtr vm,
+                                       bool state,
+                                       qemuDomainAsyncJob job)
+{
+    qemuDomainObjPrivatePtr priv = vm->privateData;
+    int ret = -1;
+
+    if (qemuDomainObjEnterMonitorAsync(driver, vm, job) < 0)
+        return -1;
+
+    ret = qemuMonitorGetMigrationCapability(
+                priv->mon,
+                QEMU_MONITOR_MIGRATION_CAPS_MT_COMPRESS);
+
+    if (ret < 0) {
+        goto cleanup;
+    } else if (ret == 0 && !state) {
+        /* Unsupported but we want it off anyway */
+        goto cleanup;
+    } else if (ret == 0) {
+        if (job == QEMU_ASYNC_JOB_MIGRATION_IN) {
+            virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
+                           _("Multi-thread compressed migration is not supported by "
+                             "target QEMU binary"));
+        } else {
+            virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
+                           _("Multi-thread compressed migration is not supported by "
+                             "source QEMU binary"));
+        }
+        ret = -1;
+        goto cleanup;
+    }
+
+    ret = qemuMonitorSetMigrationCapability(
+                priv->mon,
+                QEMU_MONITOR_MIGRATION_CAPS_MT_COMPRESS,
+                state);
+
+ cleanup:
+    if (qemuDomainObjExitMonitor(driver, vm) < 0)
+        ret = -1;
+    return ret;
+}
+
 static int
 qemuMigrationSetAutoConverge(virQEMUDriverPtr driver,
                              virDomainObjPtr vm,
@@ -3374,6 +3420,11 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
                                     QEMU_ASYNC_JOB_MIGRATION_IN) < 0)
         goto stop;
 
+    if (qemuMigrationSetMultiThreadCompression(driver, vm,
+                                               flags & VIR_MIGRATE_MT_COMPRESSED,
+                                               QEMU_ASYNC_JOB_MIGRATION_IN) < 0)
+        goto stop;
+
     if (STREQ_NULLABLE(protocol, "rdma") &&
         virProcessSetMaxMemLock(vm->pid, vm->def->mem.hard_limit << 10) < 0) {
         goto stop;
@@ -4231,6 +4282,11 @@ qemuMigrationRun(virQEMUDriverPtr driver,
                                     QEMU_ASYNC_JOB_MIGRATION_OUT) < 0)
         goto cleanup;
 
+    if (qemuMigrationSetMultiThreadCompression(driver, vm,
+                                               flags & VIR_MIGRATE_MT_COMPRESSED,
+                                               QEMU_ASYNC_JOB_MIGRATION_OUT) < 0)
+        goto cleanup;
+
     if (qemuMigrationSetAutoConverge(driver, vm,
                                      flags & VIR_MIGRATE_AUTO_CONVERGE,
                                      QEMU_ASYNC_JOB_MIGRATION_OUT) < 0)
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
index 48c2e8c..1092e5f 100644
--- a/src/qemu/qemu_migration.h
+++ b/src/qemu/qemu_migration.h
@@ -41,7 +41,8 @@
      VIR_MIGRATE_COMPRESSED |                   \
      VIR_MIGRATE_ABORT_ON_ERROR |               \
      VIR_MIGRATE_AUTO_CONVERGE |                \
-     VIR_MIGRATE_RDMA_PIN_ALL)
+     VIR_MIGRATE_RDMA_PIN_ALL |                 \
+     VIR_MIGRATE_MT_COMPRESSED)
 
 /* All supported migration parameters and their types. */
 # define QEMU_MIGRATION_PARAMETERS                                \
@@ -193,4 +194,10 @@ int qemuMigrationFetchJobStatus(virQEMUDriverPtr driver,
                                 qemuDomainAsyncJob asyncJob,
                                 qemuDomainJobInfoPtr jobInfo);
 
+int
+qemuMigrationSetMultiThreadCompression(virQEMUDriverPtr driver,
+                                       virDomainObjPtr vm,
+                                       bool state,
+                                       qemuDomainAsyncJob job);
+
 #endif /* __QEMU_MIGRATION_H__ */
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 6b54f71..a10e94f 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -163,7 +163,7 @@ VIR_ENUM_IMPL(qemuMonitorMigrationStatus,
 
 VIR_ENUM_IMPL(qemuMonitorMigrationCaps,
               QEMU_MONITOR_MIGRATION_CAPS_LAST,
-              "xbzrle", "auto-converge", "rdma-pin-all", "events")
+              "xbzrle", "auto-converge", "rdma-pin-all", "events", "compress")
 
 VIR_ENUM_IMPL(qemuMonitorVMStatus,
               QEMU_MONITOR_VM_STATUS_LAST,
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index ab7d5a7..8bf1058 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -513,6 +513,7 @@ typedef enum {
     QEMU_MONITOR_MIGRATION_CAPS_AUTO_CONVERGE,
     QEMU_MONITOR_MIGRATION_CAPS_RDMA_PIN_ALL,
     QEMU_MONITOR_MIGRATION_CAPS_EVENTS,
+    QEMU_MONITOR_MIGRATION_CAPS_MT_COMPRESS,
 
     QEMU_MONITOR_MIGRATION_CAPS_LAST
 } qemuMonitorMigrationCaps;
-- 
2.1.4

--
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]