qom: qom-list-get

Using qom-list and qom-get to get all the nodes and property values in
a QOM tree can take multiple seconds because it requires 1000's of
individual QOM requests.  Some managers fetch the entire tree or a
large subset of it when starting a new VM, and this cost is a
substantial fraction of start up time.

Define the qom-list-get command, which fetches all the properties and
values for a list of paths.  This can be much faster than qom-list
plus qom-get.  When getting an entire QOM tree, I measured a 10x
speedup in elapsed time.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <1752248703-217318-2-git-send-email-steven.sistare@oracle.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
Steve Sistare 2025-07-11 08:45:01 -07:00 committed by Markus Armbruster
parent f96b157ebb
commit 8eb6d39e22
2 changed files with 103 additions and 0 deletions

View file

@ -47,6 +47,34 @@
'*description': 'str',
'*default-value': 'any' } }
##
# @ObjectPropertyValue:
#
# @name: the name of the property.
#
# @type: the type of the property, as described in `ObjectPropertyInfo`.
#
# @value: the value of the property. Absent when the property cannot
# be read.
#
# Since 10.1
##
{ 'struct': 'ObjectPropertyValue',
'data': { 'name': 'str',
'type': 'str',
'*value': 'any' } }
##
# @ObjectPropertiesValues:
#
# @properties: a list of properties.
#
# Since 10.1
##
{ 'struct': 'ObjectPropertiesValues',
'data': { 'properties': [ 'ObjectPropertyValue' ] }}
##
# @qom-list:
#
@ -124,6 +152,28 @@
'returns': 'any',
'allow-preconfig': true }
##
# @qom-list-get:
#
# List properties and their values for each object path in the input
# list.
#
# @paths: The absolute or partial path for each object, as described
# in `qom-get`.
#
# Errors:
# - If any path is not valid or is ambiguous
#
# Returns: A list where each element is the result for the
# corresponding element of @paths.
#
# Since 10.1
##
{ 'command': 'qom-list-get',
'data': { 'paths': [ 'str' ] },
'returns': [ 'ObjectPropertiesValues' ],
'allow-preconfig': true }
##
# @qom-set:
#