]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: migration: Reject migration of an empty disk
authorPeter Krempa <pkrempa@redhat.com>
Fri, 7 Apr 2017 15:39:39 +0000 (17:39 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 13 Apr 2017 10:33:24 +0000 (12:33 +0200)
If you specify disks to migrate it would be possible to select an empty
drive for migration. Reject such config.

src/qemu/qemu_migration.c

index b3d42619f261ed2097239f6bf669da9fbe64ec60..9b3285f30206dec78e0406155f17948d4e243875 100644 (file)
@@ -515,9 +515,10 @@ qemuMigrationStartNBDServer(virQEMUDriverPtr driver,
         if (!qemuMigrateDisk(disk, nmigrate_disks, migrate_disks))
             continue;
 
-        if (disk->src->readonly) {
+        if (disk->src->readonly || virStorageSourceIsEmpty(disk->src)) {
             virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
-                           _("Cannot migrate read-only disk %s"), disk->dst);
+                           _("Cannot migrate empty or read-only disk %s"),
+                           disk->dst);
             goto cleanup;
         }