[PATCH 37/68] qemu: Set always-on migration caps in ParamsCheck

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

 



Some migration capabilities are always enabled if QEMU supports them. We
can just drop the explicit code for them and let
qemuMigrationParamsCheck automatically set such capabilities.

QEMU_MONITOR_MIGRATION_CAPS_EVENTS would normally be one of the always
on features, but it is the only feature we want to enable even for other
jobs which internally use migration (such as save and snapshot). Hence
this capability is set very early after libvirtd connects to QEMU
monitor.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 src/qemu/qemu_migration.c        |  6 ------
 src/qemu/qemu_migration_params.c | 28 ++++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index f3006d8aa4..bb8f506659 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -3362,12 +3362,6 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
                                          migParams) < 0)
         goto error;
 
-    if (qemuMigrationCapsGet(vm, QEMU_MONITOR_MIGRATION_CAPS_PAUSE_BEFORE_SWITCHOVER) &&
-        qemuMigrationParamsSetCapability(vm,
-                                         QEMU_MONITOR_MIGRATION_CAPS_PAUSE_BEFORE_SWITCHOVER,
-                                         true, migParams) < 0)
-        goto error;
-
     if (qemuMigrationParamsCheck(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT,
                                  migParams) < 0)
         goto error;
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index ac99fa29e1..3837bf5b68 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -43,6 +43,19 @@ struct _qemuMigrationParams {
     qemuMonitorMigrationParams params;
 };
 
+typedef struct _qemuMigrationParamsAlwaysOnItem qemuMigrationParamsAlwaysOnItem;
+struct _qemuMigrationParamsAlwaysOnItem {
+    qemuMonitorMigrationCaps cap;
+    int party; /* bit-wise OR of qemuMigrationParty */
+};
+
+/* Migration capabilities which should always be enabled as long as they
+ * are supported by QEMU. */
+static const qemuMigrationParamsAlwaysOnItem qemuMigrationParamsAlwaysOn[] = {
+    {QEMU_MONITOR_MIGRATION_CAPS_PAUSE_BEFORE_SWITCHOVER,
+     QEMU_MIGRATION_SOURCE},
+};
+
 
 static qemuMigrationParamsPtr
 qemuMigrationParamsNew(void)
@@ -399,8 +412,15 @@ qemuMigrationParamsCheck(virQEMUDriverPtr driver,
     qemuDomainObjPrivatePtr priv = vm->privateData;
     qemuMigrationParamsPtr origParams = NULL;
     qemuMonitorMigrationCaps cap;
+    qemuMigrationParty party;
+    size_t i;
     int ret = -1;
 
+    if (asyncJob == QEMU_ASYNC_JOB_MIGRATION_OUT)
+        party = QEMU_MIGRATION_SOURCE;
+    else
+        party = QEMU_MIGRATION_DESTINATION;
+
     for (cap = 0; cap < QEMU_MONITOR_MIGRATION_CAPS_LAST; cap++) {
         bool state = false;
 
@@ -414,6 +434,14 @@ qemuMigrationParamsCheck(virQEMUDriverPtr driver,
         }
     }
 
+    for (i = 0; i < ARRAY_CARDINALITY(qemuMigrationParamsAlwaysOn); i++) {
+        if (qemuMigrationParamsAlwaysOn[i].party & party &&
+            qemuMigrationCapsGet(vm, qemuMigrationParamsAlwaysOn[i].cap)) {
+            ignore_value(virBitmapSetBit(migParams->caps,
+                                         qemuMigrationParamsAlwaysOn[i].cap));
+        }
+    }
+
     if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
         return -1;
 
-- 
2.17.0

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

  Powered by Linux