From 8ee8f939fe0d18db89f190b1faca177e616489c3 Mon Sep 17 00:00:00 2001 From: "Corey S. McQuay" Date: Mon, 26 Sep 2016 13:16:00 -0400 Subject: [PATCH] qemu: migration: Disallow migration of read only disk Currently Libvirt allows attempts to migrate read only disks. Qemu cannot handle this as read only disks cannot be written to on the destination system. The end result is a cryptic error message and a failed migration. This patch causes migration to fail earlier and provides a meaningful error message stating that migrating read only disks is not supported. Signed-off-by: Corey S. McQuay Reviewed-by: Jason J. Herne Reviewed-by: Boris Fiuczynski --- src/qemu/qemu_migration.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index e2ca3303ef..1e7abc53f5 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1765,6 +1765,12 @@ qemuMigrationStartNBDServer(virQEMUDriverPtr driver, if (!qemuMigrateDisk(disk, nmigrate_disks, migrate_disks)) continue; + if (disk->src->readonly) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("Cannot migrate read-only disk %s"), disk->dst); + goto cleanup; + } + VIR_FREE(diskAlias); if (!(diskAlias = qemuAliasFromDisk(disk))) goto cleanup;