qemu: migration: Reject migration of an empty disk

If you specify disks to migrate it would be possible to select an empty
drive for migration. Reject such config.
This commit is contained in:
Peter Krempa 2017-04-07 17:39:39 +02:00
parent 03766247ae
commit 5a990e0bf3

View 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;
}