[PATCH 4/4] qemu: migration: Skip few checks while doing offline migration

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

 



qemuMigrationIsAllowed would disallow offline migration if the VM
contained host devices or memory modules. Since during offline migration
we don't transfer any state we can safely migrate VMs with such
configuration.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1265049
---
 src/qemu/qemu_migration.c | 87 +++++++++++++++++++++++++----------------------
 1 file changed, 46 insertions(+), 41 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 851c9d0..658998c 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2208,12 +2208,6 @@ qemuMigrationIsAllowed(virQEMUDriverPtr driver,
     int pauseReason;
     size_t i;

-    if (qemuProcessAutoDestroyActive(driver, vm)) {
-        virReportError(VIR_ERR_OPERATION_INVALID,
-                       "%s", _("domain is marked for auto destroy"));
-        return false;
-    }
-
     /* perform these checks only when migrating to remote hosts */
     if (remote) {
         nsnapshots = virDomainSnapshotObjListNum(vm->snapshots, NULL, 0);
@@ -2229,6 +2223,7 @@ qemuMigrationIsAllowed(virQEMUDriverPtr driver,

         /* cancel migration if disk I/O error is emitted while migrating */
         if (flags & VIR_MIGRATE_ABORT_ON_ERROR &&
+            !(flags &  VIR_MIGRATE_OFFLINE) &&
             virDomainObjGetState(vm, &pauseReason) == VIR_DOMAIN_PAUSED &&
             pauseReason == VIR_DOMAIN_PAUSED_IOERROR) {
             virReportError(VIR_ERR_OPERATION_INVALID, "%s",
@@ -2238,46 +2233,56 @@ qemuMigrationIsAllowed(virQEMUDriverPtr driver,

     }

-    if (qemuDomainHasBlockjob(vm, false)) {
-        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
-                       _("domain has an active block job"));
-        return false;
-    }
-
-    if (!qemuMigrationIsAllowedHostdev(vm->def))
-        return false;
-
-    if (vm->def->cpu && vm->def->cpu->mode != VIR_CPU_MODE_HOST_PASSTHROUGH) {
-        for (i = 0; i < vm->def->cpu->nfeatures; i++) {
-            virCPUFeatureDefPtr feature = &vm->def->cpu->features[i];
-
-            if (feature->policy != VIR_CPU_FEATURE_REQUIRE)
-                continue;
-
-            /* QEMU blocks migration and save with invariant TSC enabled */
-            if (STREQ(feature->name, "invtsc")) {
-                virReportError(VIR_ERR_OPERATION_INVALID,
-                               _("domain has CPU feature: %s"),
-                               feature->name);
+    /* following checks don't make sense for offline migration */
+    if (!(flags & VIR_MIGRATE_OFFLINE)) {
+        if (qemuProcessAutoDestroyActive(driver, vm)) {
+            virReportError(VIR_ERR_OPERATION_INVALID,
+                           "%s", _("domain is marked for auto destroy"));
+            return false;
+        }
+
+
+        if (qemuDomainHasBlockjob(vm, false)) {
+            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                           _("domain has an active block job"));
+            return false;
+        }
+
+        if (!qemuMigrationIsAllowedHostdev(vm->def))
+            return false;
+
+        if (vm->def->cpu && vm->def->cpu->mode != VIR_CPU_MODE_HOST_PASSTHROUGH) {
+            for (i = 0; i < vm->def->cpu->nfeatures; i++) {
+                virCPUFeatureDefPtr feature = &vm->def->cpu->features[i];
+
+                if (feature->policy != VIR_CPU_FEATURE_REQUIRE)
+                    continue;
+
+                /* QEMU blocks migration and save with invariant TSC enabled */
+                if (STREQ(feature->name, "invtsc")) {
+                    virReportError(VIR_ERR_OPERATION_INVALID,
+                                   _("domain has CPU feature: %s"),
+                                   feature->name);
+                    return false;
+                }
+            }
+        }
+
+        /* Verify that memory device config can be transferred reliably */
+        for (i = 0; i < vm->def->nmems; i++) {
+            virDomainMemoryDefPtr mem = vm->def->mems[i];
+
+            if (mem->model == VIR_DOMAIN_MEMORY_MODEL_DIMM &&
+                mem->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM) {
+                virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                               _("domain's dimm info lacks slot ID "
+                                 "or base address"));
+
                 return false;
             }
         }
     }

-    /* Verify that memory device config can be transferred reliably */
-    for (i = 0; i < vm->def->nmems; i++) {
-        virDomainMemoryDefPtr mem = vm->def->mems[i];
-
-        if (mem->model == VIR_DOMAIN_MEMORY_MODEL_DIMM &&
-            mem->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM) {
-            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
-                           _("domain's dimm info lacks slot ID "
-                             "or base address"));
-
-            return false;
-        }
-    }
-
     return true;
 }

-- 
2.4.5

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