[PATCH v2 04/15] qemu: migration: Create qcow2 v3 images for VIR_MIGRATE_NON_SHARED_DISK

Jiri Denemark jdenemar at redhat.com
Fri Feb 19 20:13:26 UTC 2021


On Fri, Feb 19, 2021 at 12:58:16 +0100, Peter Krempa wrote:
> Use the new format when pre-creating the image for the user. Users
> wishing to use the legacy format can always provide their own images or
> use hared storage.

s/hared/shared/

> Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> ---
>  src/qemu/qemu_migration.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index e8e35c1c7c..94b9b34ca0 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
> @@ -180,6 +180,7 @@ qemuMigrationDstPrecreateDisk(virConnectPtr *conn,
>      char *volStr = NULL;
>      g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
>      const char *format = NULL;
> +    const char *compat = NULL;
>      unsigned int flags = 0;
> 
>      VIR_DEBUG("Precreate disk type=%s", virStorageTypeToString(disk->src->type));
> @@ -212,8 +213,11 @@ qemuMigrationDstPrecreateDisk(virConnectPtr *conn,
>          if (!(pool = virStoragePoolLookupByTargetPath(*conn, basePath)))
>              goto cleanup;
>          format = virStorageFileFormatTypeToString(disk->src->format);
> -        if (disk->src->format == VIR_STORAGE_FILE_QCOW2)
> +        if (disk->src->format == VIR_STORAGE_FILE_QCOW2) {
>              flags |= VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA;
> +            /* format qcow2v3 image */
> +            compat = "1.1";
> +        }
>          break;
> 
>      case VIR_STORAGE_TYPE_VOLUME:

And how about creating v3 only when the source offered bitmaps for
migration? Although automatic creation of disk images during migration
has always been magic and anyone caring about the exact image format on
the destination needs to precreate the images manually.

So I guess this should good enough.

Reviewed-by: Jiri Denemark <jdenemar at redhat.com>




More information about the libvir-list mailing list