Commit ec18b0a9 authored by Kevin Wolf's avatar Kevin Wolf
Browse files

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: default avatarKevin Wolf <kwolf@redhat.com>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
Reviewed-by: default avatarJohn Snow <jsnow@redhat.com>
parent d5b68844
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
        }

+4 −4
Original line number Diff line number Diff line
@@ -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>");
    }