[RFC PATCH 2/3] qemu: block: Allow specifying cluster size when using 'blockdev-create'

Peter Krempa pkrempa at redhat.com
Wed Aug 26 14:56:19 UTC 2020


'blockdev-create' allows us to create the image with a custom cluster
size if we wish to. Wire it up for 'qcow2'.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_block.c     | 1 +
 src/util/virstoragefile.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 26c1b42428..0113c64f0f 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -2315,6 +2315,7 @@ qemuBlockStorageSourceCreateGetFormatPropsQcow2(virStorageSourcePtr src,
                                  "s:file", src->nodestorage,
                                  "U:size", src->capacity,
                                  "S:version", qcow2version,
+                                 "P:cluster-size", src->clusterSize,
                                  NULL) < 0)
         return -1;

diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index f73b3ee005..87763cf389 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -318,6 +318,7 @@ struct _virStorageSource {
     unsigned long long capacity; /* in bytes, 0 if unknown */
     unsigned long long allocation; /* in bytes, 0 if unknown */
     unsigned long long physical; /* in bytes, 0 if unknown */
+    unsigned long long clusterSize; /* in bytes, 0 if unknown */
     bool has_allocation; /* Set to true when provided in XML */

     size_t nseclabels;
-- 
2.26.2




More information about the libvir-list mailing list