From: Peter Krempa Date: Wed, 26 Aug 2020 14:45:51 +0000 (+0200) Subject: qemuBlockStorageSourceCreateDetectSize: Propagate cluster size for 'qcow2' X-Git-Tag: v6.8.0-rc1~263 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de79fad40fb6a970fab9dd566ed83ecf56877ea2;p=thirdparty%2Flibvirt.git qemuBlockStorageSourceCreateDetectSize: Propagate cluster size for 'qcow2' Propagate the cluster size from the original image as the user might have configured a custom cluster size for performance reasons. Propagate the cluster size of a qcow2 image to the new overlay or copy. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 0113c64f0f..9095986f73 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -2789,6 +2789,12 @@ qemuBlockStorageSourceCreateDetectSize(virHashTablePtr blockNamedNodeData, return -1; } + /* propagate cluster size if the images are compatible */ + if (templ->format == VIR_STORAGE_FILE_QCOW2 && + src->format == VIR_STORAGE_FILE_QCOW2 && + src->clusterSize == 0) + src->clusterSize = entry->clusterSize; + if (src->format == VIR_STORAGE_FILE_RAW) { src->physical = entry->capacity; } else {