[RFC PATCH 1/3] qemu: monitor: Detect image cluster size from 'query-named-block-nodes'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Configuring the cluster size of an image may have performance
implications. This patch allows us to detect cluster size for existing
images so that we will be able to propagate it to new images which are
based on existing images e.g. during snapshots/block-copy/etc.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_monitor.h      | 3 +++
 src/qemu/qemu_monitor_json.c | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index d20a15c202..369d63ce12 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -696,6 +696,9 @@ struct _qemuBlockNamedNodeData {

     qemuBlockNamedNodeDataBitmapPtr *bitmaps;
     size_t nbitmaps;
+
+    /* the cluster size of the image is valid only when > 0 */
+    unsigned long long clusterSize;
 };

 virHashTablePtr
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 9cdf6c0f7f..e6d2e7d4db 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2997,6 +2997,9 @@ qemuMonitorJSONBlockGetNamedNodeDataWorker(size_t pos G_GNUC_UNUSED,
     if (virJSONValueObjectGetNumberUlong(img, "actual-size", &ent->physical) < 0)
         ent->physical = ent->capacity;

+    /* try looking up the cluster size */
+    ignore_value(virJSONValueObjectGetNumberUlong(img, "cluster-size", &ent->clusterSize));
+
     if ((bitmaps = virJSONValueObjectGetArray(val, "dirty-bitmaps")))
         qemuMonitorJSONBlockGetNamedNodeDataBitmaps(bitmaps, ent);

-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux