[Top][All Lists]

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

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

From: Eric Blake
Subject: Re: [PATCH v2] qapi: Allow getting flat output from 'query-named-block-nodes'
Date: Mon, 20 Jan 2020 13:16:43 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1

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

Signed-off-by: Peter Krempa <address@hidden>

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

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 
+#        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 <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]