]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuBlockStorageSourceCreateDetectSize: Propagate cluster size for 'qcow2'
authorPeter Krempa <pkrempa@redhat.com>
Wed, 26 Aug 2020 14:45:51 +0000 (16:45 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 8 Sep 2020 06:48:53 +0000 (08:48 +0200)
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 <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
src/qemu/qemu_block.c

index 0113c64f0f71572e76558acb016caa9ad3967b82..9095986f732167e2bde9148b7470f57e471446b1 100644 (file)
@@ -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 {