From: Peter Krempa Date: Mon, 30 Sep 2024 12:16:58 +0000 (+0200) Subject: qemu: migration: Pre-create QCOW2 images for non-shared storage with 0 allocation X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=165b30e06a6d14e8719c82af290d3b20e4cbc462;p=libvirt.git qemu: migration: Pre-create QCOW2 images for non-shared storage with 0 allocation Specify that the parameter for the newly-created qcow2 image is 0 so that only metadata gets preallocated. Otherwise the storage driver code instructs qemu to use 'fallocate' preallocation mode and considers the image fully allocated. Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 7f905f8584..b686e42e58 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -361,6 +361,8 @@ qemuMigrationDstPrecreateDisk(virConnectPtr *conn, virBufferAddLit(&buf, "\n"); virBufferAdjustIndent(&buf, 2); virBufferEscapeString(&buf, "%s\n", volName); + if (disk->src->format == VIR_STORAGE_FILE_QCOW2) + virBufferAddLit(&buf, "0\n"); virBufferAsprintf(&buf, "%llu\n", capacity); virBufferAddLit(&buf, "\n"); virBufferAdjustIndent(&buf, 2);