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 RFC] qapi: Allow getting flat output from 'query-named-block-nodes'
Date: Fri, 13 Dec 2019 09:23:35 -0600 [thread overview]
Message-ID: <836c1a18-b67d-0426-2137-8f464e4e5c9b@redhat.com> (raw)
In-Reply-To: <42dae98e1f6a9f444f48a20192f45195337824f0.1576246045.git.pkrempa@redhat.com>
On 12/13/19 8:11 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.
At one point, Kevin was working on a saner command that tried to cut out
on more than just the redundant nesting. But this is certainly a
quick-and-easy fix to ease libvirt's use of the existing command, while
we decide whether to add a saner new command.
>
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> ---
> block.c | 5 +++--
> block/qapi.c | 10 ++++++++--
> blockdev.c | 12 ++++++++++--
> include/block/block.h | 2 +-
> include/block/qapi.h | 4 +++-
> monitor/hmp-cmds.c | 2 +-
> qapi/block-core.json | 6 +++++-
> 7 files changed, 31 insertions(+), 10 deletions(-)
>
> +++ b/blockdev.c
> @@ -3707,9 +3707,17 @@ void qmp_drive_backup(DriveBackup *arg, Error **errp)
> }
> }
>
> -BlockDeviceInfoList *qmp_query_named_block_nodes(Error **errp)
> +BlockDeviceInfoList *qmp_query_named_block_nodes(bool has_flat,
> + bool flat,
> + Error **errp)
> {
> - return bdrv_named_nodes_list(errp);
> + bool return_flat = false;
> +
> + if (has_flat) {
> + return_flat = flat;
> + }
This could be shortened as 'bool return_flat = has_flat && flat;', but
that's not essential.
> +
> + return bdrv_named_nodes_list(return_flat, errp);
> }
>
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:[~2019-12-13 21:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-13 14:11 [PATCH RFC] qapi: Allow getting flat output from 'query-named-block-nodes' Peter Krempa
2019-12-13 15:23 ` Eric Blake [this message]
2019-12-17 7:36 ` Markus Armbruster
2019-12-17 13:15 ` Eric Blake
2019-12-17 15:11 ` Markus Armbruster
2019-12-19 8:54 ` Peter Krempa
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=836c1a18-b67d-0426-2137-8f464e4e5c9b@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).