[PATCH 5/7] qemu: Disable migration with legacy ivshmem

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

 



Use migration flag for tracking whether newer ivshmem was used.  Restore
from old save will not work, but that shouldn't have been enabled in the
first place.

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 src/qemu/qemu_migration.c | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index e734816c4e12..88b722d1c35d 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -93,6 +93,7 @@ enum qemuMigrationCookieFlags {
     QEMU_MIGRATION_COOKIE_FLAG_STATS,
     QEMU_MIGRATION_COOKIE_FLAG_MEMORY_HOTPLUG,
     QEMU_MIGRATION_COOKIE_FLAG_CPU_HOTPLUG,
+    QEMU_MIGRATION_COOKIE_FLAG_IVSHMEM,

     QEMU_MIGRATION_COOKIE_FLAG_LAST
 };
@@ -107,7 +108,8 @@ VIR_ENUM_IMPL(qemuMigrationCookieFlag,
               "nbd",
               "statistics",
               "memory-hotplug",
-              "cpu-hotplug");
+              "cpu-hotplug",
+              "ivshmem");

 enum qemuMigrationCookieFeatures {
     QEMU_MIGRATION_COOKIE_GRAPHICS  = (1 << QEMU_MIGRATION_COOKIE_FLAG_GRAPHICS),
@@ -118,6 +120,7 @@ enum qemuMigrationCookieFeatures {
     QEMU_MIGRATION_COOKIE_STATS = (1 << QEMU_MIGRATION_COOKIE_FLAG_STATS),
     QEMU_MIGRATION_COOKIE_MEMORY_HOTPLUG = (1 << QEMU_MIGRATION_COOKIE_FLAG_MEMORY_HOTPLUG),
     QEMU_MIGRATION_COOKIE_CPU_HOTPLUG = (1 << QEMU_MIGRATION_COOKIE_FLAG_CPU_HOTPLUG),
+    QEMU_MIGRATION_COOKIE_IVSHMEM = (1 << QEMU_MIGRATION_COOKIE_FLAG_IVSHMEM),
 };

 typedef struct _qemuMigrationCookieGraphics qemuMigrationCookieGraphics;
@@ -1414,6 +1417,9 @@ qemuMigrationBakeCookie(qemuMigrationCookiePtr mig,
     if (flags & QEMU_MIGRATION_COOKIE_CPU_HOTPLUG)
         mig->flagsMandatory |= QEMU_MIGRATION_COOKIE_CPU_HOTPLUG;

+    if (flags & QEMU_MIGRATION_COOKIE_IVSHMEM)
+        mig->flagsMandatory |= QEMU_MIGRATION_COOKIE_IVSHMEM;
+
     if (!(*cookieout = qemuMigrationCookieXMLFormatStr(driver, mig)))
         return -1;

@@ -2272,6 +2278,7 @@ qemuMigrationIsAllowed(virQEMUDriverPtr driver,
     int nsnapshots;
     int pauseReason;
     size_t i;
+    qemuDomainObjPrivatePtr priv = vm->privateData;

     /* perform these checks only when migrating to remote hosts */
     if (remote) {
@@ -2346,6 +2353,16 @@ qemuMigrationIsAllowed(virQEMUDriverPtr driver,
                 return false;
             }
         }
+
+        for (i = 0; i < vm->def->nshmems; i++) {
+            if (!qemuDomainSupportsNonLegacyShmem(priv->qemuCaps,
+                                                  vm->def->shmems[i])) {
+                virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                               _("Migration with shmem device is not "
+                                 "supported with this QEMU binary"));
+                return false;
+            }
+        }
     }

     return true;
@@ -3192,6 +3209,11 @@ qemuMigrationBeginPhase(virQEMUDriverPtr driver,
         }
     }

+    /* We need to signal we are using newer ivshmem models, we
+     * wouldn't get here if we didn't. */
+    if (vm->def->nshmems)
+        cookieFlags |= QEMU_MIGRATION_COOKIE_IVSHMEM;
+
     if (virDomainDefHasMemoryHotplug(vm->def) ||
         ((flags & VIR_MIGRATE_PERSIST_DEST) &&
          vm->newDef && virDomainDefHasMemoryHotplug(vm->newDef)))
@@ -3698,7 +3720,8 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
                                        QEMU_MIGRATION_COOKIE_LOCKSTATE |
                                        QEMU_MIGRATION_COOKIE_NBD |
                                        QEMU_MIGRATION_COOKIE_MEMORY_HOTPLUG |
-                                       QEMU_MIGRATION_COOKIE_CPU_HOTPLUG)))
+                                       QEMU_MIGRATION_COOKIE_CPU_HOTPLUG |
+                                       QEMU_MIGRATION_COOKIE_IVSHMEM)))
         goto cleanup;

     if (STREQ_NULLABLE(protocol, "rdma") &&
-- 
2.10.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]