On 1/20/20 2:50 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.
Signed-off-by: Peter Krempa <[email protected]>
---
Diff to v1:
- rewrote setting of 'return_flat' in qmp_query_named_block_nodes
- tried to clarify the QMP schema docs for the new field
This patch does not aim to fix the rather suboptimal original
documentation of the command as that is going to end up in a bunch of
bikeshedding.
While I know that there are plans for a new command that should fix
this, the plans were already there for quite some time without much
happening. This is a quick fix to a real problem, because if you have
(maybe unpractically) deep backing chains, the returned JSON is getting
huge. (140 nesting levels exceeds 10MiB of JSON)
Yep, O(n^2) output growth based on a depth of N is not ideal.
+++ b/qapi/block-core.json
@@ -1752,6 +1752,9 @@
#
# Get the named block driver list
#
+# @flat: Omit the nested data about backing image ("backing-image" key) if
true.
+# Default is false (Since 5.0)
+#
# Returns: the list of BlockDeviceInfo
#
# Since: 2.0
@@ -1805,7 +1808,9 @@
# } } ] }
#
##
-{ 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] }
+{ 'command': 'query-named-block-nodes',
+ 'returns': [ 'BlockDeviceInfo' ],
+ 'data': { '*flat': 'bool' } }
Reviewed-by: Eric Blake <[email protected]>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org