From: Peter Krempa Date: Wed, 17 Feb 2021 13:45:49 +0000 (+0100) Subject: qemu: migration: Create qcow2 v3 images for VIR_MIGRATE_NON_SHARED_DISK X-Git-Tag: v7.1.0-rc1~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8da9c7456d480a3e7a6209704149eb3aba5fb864;p=thirdparty%2Flibvirt.git qemu: migration: Create qcow2 v3 images for VIR_MIGRATE_NON_SHARED_DISK 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 shared storage. Signed-off-by: Peter Krempa Reviewed-by: Jiri Denemark --- 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: @@ -261,6 +265,8 @@ qemuMigrationDstPrecreateDisk(virConnectPtr *conn, virBufferAddLit(&buf, "\n"); virBufferAdjustIndent(&buf, 2); virBufferAsprintf(&buf, "\n", format); + if (compat) + virBufferAsprintf(&buf, "%s\n", compat); virBufferAdjustIndent(&buf, -2); virBufferAddLit(&buf, "\n"); virBufferAdjustIndent(&buf, -2);