aboutsummaryrefslogtreecommitdiff
path: root/hmp.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2017-07-11 14:00:57 +0200
committerKevin Wolf <kwolf@redhat.com>2017-07-18 15:14:36 +0200
commitec18b0a93a0b8f6f9a72bf2461dc7a0930391bfa (patch)
treee1e5e0ea07313f13ff463c04d222abffa2493d4f /hmp.c
parentd5b68844e6f7c13d30b46cc92ba468e5f92119a6 (diff)
block: List anonymous device BBs in query-block
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 using query-block to inspect BlockBackends for the modern configuration syntax with -blockdev and -device. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'hmp.c')
-rw-r--r--hmp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/hmp.c b/hmp.c
index 0e57f47682..bf1de747d5 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>");
}