[libvirt] [PATCH 5/5] qemu: migration: Reject migration of an empty disk

John Ferlan jferlan at redhat.com
Wed Apr 12 23:56:14 UTC 2017



On 04/07/2017 11:50 AM, Peter Krempa wrote:
> If you specify disks to migrate it would be possible to select an empty
> drive for migration. Reject such config.

because ...

> ---
>  src/qemu/qemu_migration.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 


> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index 46f82ab33..09adb0484 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
> @@ -515,9 +515,10 @@ qemuMigrationStartNBDServer(virQEMUDriverPtr driver,
>          if (!qemuMigrateDisk(disk, nmigrate_disks, migrate_disks))
>              continue;

IOW: For disks that are not in our migrate_disk list and this is only
ever called when the flags VIR_MIGRATE_NON_SHARED_DISK |
VIR_MIGRATE_NON_SHARED_INC are set...

So to a degree the checks made in patch 3 make a bit more sense once
it's understood that there's this code.... Like I said - something
subtle in how this all "magically" works...

ACK for this though,

John

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




More information about the libvir-list mailing list