Message ID | 1499864249-26305-6-git-send-email-kwolf@redhat.com |
---|---|
State | New |
Headers | show |
On 07/12/2017 07:57 AM, Kevin Wolf wrote: > Instead of listing only monitor-owned BlockBackends in query-block, also > add those anonymous BlockBackends that are owned by a qdev device and as > such under the control of the user. > > This allows to use query-block to inspect BlockBackends for the modern "allows to VERB" is not idiomatic; better is "allows VERBing" (as in "allows using query-block"); or "allows SUBJECT to VERB" (as in the verbose "allows the client to use query-block"). For your particular wording choice, it is also possible to do "allows the use of query-block", although that rewrite is not possible for all VERB. > configuration syntax with -blockdev and -device. > > Signed-off-by: Kevin Wolf <kwolf@redhat.com> > --- > block/qapi.c | 2 +- > hmp.c | 8 ++++---- > 2 files changed, 5 insertions(+), 5 deletions(-) > Reviewed-by: Eric Blake <eblake@redhat.com>
Am 12.07.2017 um 17:47 hat Eric Blake geschrieben: > On 07/12/2017 07:57 AM, Kevin Wolf wrote: > > Instead of listing only monitor-owned BlockBackends in query-block, also > > add those anonymous BlockBackends that are owned by a qdev device and as > > such under the control of the user. > > > > This allows to use query-block to inspect BlockBackends for the modern > > "allows to VERB" is not idiomatic; better is "allows VERBing" (as in > "allows using query-block"); or "allows SUBJECT to VERB" (as in the > verbose "allows the client to use query-block"). Is this inconsistency a known problem in English or should we file a new bug report against it? But as long as this isn't fixed yet, I'll apply your workaround. Kevin
diff --git a/block/qapi.c b/block/qapi.c index 2f86c79..b5bb42b 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -475,7 +475,7 @@ BlockInfoList *qmp_query_block(Error **errp) for (blk = blk_all_next(NULL); blk; blk = blk_all_next(blk)) { BlockInfoList *info; - if (!*blk_name(blk)) { + if (!*blk_name(blk) && !blk_get_attached_dev(blk)) { continue; } diff --git a/hmp.c b/hmp.c index d1d769e..4caa9c1 100644 --- a/hmp.c +++ b/hmp.c @@ -401,16 +401,16 @@ static void print_block_info(Monitor *mon, BlockInfo *info, assert(!info || !info->has_inserted || info->inserted == inserted); - if (info) { + if (info && *info->device) { monitor_printf(mon, "%s", info->device); if (inserted && inserted->has_node_name) { monitor_printf(mon, " (%s)", inserted->node_name); } } else { - assert(inserted); + assert(info || inserted); monitor_printf(mon, "%s", - inserted->has_node_name - ? inserted->node_name + inserted && inserted->has_node_name ? inserted->node_name + : info && info->has_qdev ? info->qdev : "<anonymous>"); }
Instead of listing only monitor-owned BlockBackends in query-block, also add those anonymous BlockBackends that are owned by a qdev device and as such under the control of the user. This allows to use query-block to inspect BlockBackends for the modern configuration syntax with -blockdev and -device. Signed-off-by: Kevin Wolf <kwolf@redhat.com> --- block/qapi.c | 2 +- hmp.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)