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 <csmcq...@linux.vnet.ibm.com>
Reviewed-by: Jason J. Herne <jjhe...@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiu...@linux.vnet.ibm.com>
---
 src/qemu/qemu_migration.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index e451ef6..011f349 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2157,6 +2157,13 @@ qemuMigrationDriveMirror(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;
+        }
+
         if (!(diskAlias = qemuAliasFromDisk(disk)) ||
             (virAsprintf(&nbd_dest, "nbd:%s:%d:exportname=%s",
                          hoststr, port, diskAlias) < 0))
-- 
2.7.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to