]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Forbid migration of machines with I/O errors
authorPeter Krempa <pkrempa@redhat.com>
Mon, 10 Jun 2013 14:30:48 +0000 (16:30 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 11 Jun 2013 12:52:26 +0000 (14:52 +0200)
Such machine can't be successuflly migrated unles the I/O error has
recovered and might lead to data corruption. Forbid this kind of
migration.

src/qemu/qemu_migration.c

index 4115ca2aa7dfe2dff8d42a2c82ec25f9a14a9027..48e0d44a41be83d2f7396fe8419099623bf1507f 100644 (file)
@@ -1423,6 +1423,7 @@ qemuMigrationIsAllowed(virQEMUDriverPtr driver, virDomainObjPtr vm,
                        virDomainDefPtr def, bool remote)
 {
     int nsnapshots;
+    int pauseReason;
     bool forbid;
     int i;
 
@@ -1445,6 +1446,15 @@ qemuMigrationIsAllowed(virQEMUDriverPtr driver, virDomainObjPtr vm,
                                nsnapshots);
                 return false;
             }
+
+            /* cancel migration if disk I/O error is emitted while migrating */
+            if (virDomainObjGetState(vm, &pauseReason) == VIR_DOMAIN_PAUSED &&
+                pauseReason == VIR_DOMAIN_PAUSED_IOERROR) {
+                virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                               _("cannot migrate domain with I/O error"));
+                return false;
+            }
+
         }
 
         if (virDomainHasDiskMirror(vm)) {