On Mon, Jan 26, 2026 at 13:27:33 -0600, Eric Blake wrote:
> 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)

In this case the 'backing-image' data is not duplicate as it was the
case with 'query-named-block-nodes', as it is not repeated on top level.

Here using 'flat' decreases the amount of returned information, but in
case of libvirt we don't use anything from the 'backing-image', just
stuff that is related to the frontend device which is not queryable via
'query-named-block-nodes'.

So then perhaps just shorten it to:

 @flat: Omit nested data about the backing image (ie. the contents at
        'inserted.image.backing-image' are trimmed).
        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.

Should I post a v3?


Reply via email to