From: Peter Krempa Date: Mon, 10 Jun 2013 14:30:48 +0000 (+0200) Subject: qemu: Forbid migration of machines with I/O errors X-Git-Tag: v1.1.0-rc1~103 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f719f217ebf89668ca3c404e4b8288179c26c92;p=thirdparty%2Flibvirt.git qemu: Forbid migration of machines with I/O errors 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. --- diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 4115ca2aa7..48e0d44a41 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -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)) {