qemu: monitor: Detect image cluster size from 'query-named-block-nodes'

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@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Peter Krempa 2020-08-26 16:41:17 +02:00
parent 90ba5f02da
commit fd49364d8b
2 changed files with 6 additions and 0 deletions

View File

@ -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

View File

@ -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);