qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH RFC] qapi: Allow getting flat output from 'query-named-block-


From: Eric Blake
Subject: Re: [PATCH RFC] qapi: Allow getting flat output from 'query-named-block-nodes'
Date: Fri, 13 Dec 2019 09:23:35 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2

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 <address@hidden>
---
  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 <address@hidden>

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]