On Tue, Jan 20, 2026 at 03:45:56PM +0100, Peter Krempa wrote:
> From: Peter Krempa <[email protected]>
>
> Some time ago (commit facda5443f5a8) I've added 'flat' mode (which
> omits 'backing-image' key in reply) to 'query-named-block-nodes' to
> minimize the size of the returned JSON for deeper backing chains.
>
> While 'query-block' behaved slightly better it turns out that in libvirt
> we do call 'query-block' to figure out some information about the
> block device (e.g. throttling info) but we don't look at the backing
> chain itself.
>
> Wire up 'flat' for 'query-block' so that libvirt can ask for an
> abbreviated output. The implementation is much simpler as the internals
> are shared with 'query-named-block-nodes'.
>
> Signed-off-by: Peter Krempa <[email protected]>
> Acked-by: Markus Armbruster <[email protected]>
> ---
> block/monitor/block-hmp-cmds.c | 4 ++--
> block/qapi.c | 9 +++++----
> qapi/block-core.json | 7 +++++++
> ui/cocoa.m | 2 +-
> 4 files changed, 15 insertions(+), 7 deletions(-)
> +++ b/qapi/block-core.json
> @@ -855,6 +855,12 @@
> #
> # Get a list of `BlockInfo` for all virtual block devices.
> #
> +# @flat: Omit the nested data about backing image (Omitted are
> +# contents of 'backing-image' key of the 'ImageInfo' struct
> +# which is returned as 'image' key of 'BlockDeviceInfo' struct
> +# returned as 'inserted' key in 'BlockInfo' struct returned
Extra space.
> +# by this command). Default is false (Since 11.0)
Still hard to parse. Maybe:
@flat: Omit nested data about the backing image (ie. the contents at
'inserted.image.backing-image' are trimmed to avoid duplicate
data about that backing image). Default is false (Since 11.0)
The idea makes sense to me, but I will defer to Markus on whether the
wording still needs a tweak.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization: qemu.org | libguestfs.org