From: Eric Blake <eblake@redhat.com>
To: Peter Krempa <pkrempa@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
qemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: Re: [PATCH v2] qapi: Allow getting flat output from 'query-named-block-nodes'
Date: Mon, 20 Jan 2020 13:16:43 -0600 [thread overview]
Message-ID: <67719815-026e-6dba-aea8-0f3273df4fec@redhat.com> (raw)
In-Reply-To: <4470f8c779abc404dcf65e375db195cd91a80651.1579509782.git.pkrempa@redhat.com>
On 1/20/20 2:50 AM, Peter Krempa wrote:
> When a management application manages node names there's no reason to
> recurse into backing images in the output of query-named-block-nodes.
>
> Add a parameter to the command which will return just the top level
> structs.
>
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> ---
>
> Diff to v1:
> - rewrote setting of 'return_flat' in qmp_query_named_block_nodes
> - tried to clarify the QMP schema docs for the new field
>
> This patch does not aim to fix the rather suboptimal original
> documentation of the command as that is going to end up in a bunch of
> bikeshedding.
>
> While I know that there are plans for a new command that should fix
> this, the plans were already there for quite some time without much
> happening. This is a quick fix to a real problem, because if you have
> (maybe unpractically) deep backing chains, the returned JSON is getting
> huge. (140 nesting levels exceeds 10MiB of JSON)
Yep, O(n^2) output growth based on a depth of N is not ideal.
> +++ b/qapi/block-core.json
> @@ -1752,6 +1752,9 @@
> #
> # Get the named block driver list
> #
> +# @flat: Omit the nested data about backing image ("backing-image" key) if true.
> +# Default is false (Since 5.0)
> +#
> # Returns: the list of BlockDeviceInfo
> #
> # Since: 2.0
> @@ -1805,7 +1808,9 @@
> # } } ] }
> #
> ##
> -{ 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] }
> +{ 'command': 'query-named-block-nodes',
> + 'returns': [ 'BlockDeviceInfo' ],
> + 'data': { '*flat': 'bool' } }
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2020-01-20 19:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-20 8:50 [PATCH v2] qapi: Allow getting flat output from 'query-named-block-nodes' Peter Krempa
2020-01-20 19:16 ` Eric Blake [this message]
2020-02-07 10:08 ` Max Reitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=67719815-026e-6dba-aea8-0f3273df4fec@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pkrempa@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).