From 068cc51d42f771d2a453d628c10e199e7d104edd Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 26 Apr 2022 11:49:33 +0200 Subject: qmp: add filtering of statistics by provider Allow retrieving the statistics from a specific provider only. This can be used in the future by HMP commands such as "info sync-profile" or "info profile". The next patch also adds filter-by-provider capabilities to the HMP equivalent of query-stats, "info stats". Example: { "execute": "query-stats", "arguments": { "target": "vm", "providers": [ { "provider": "kvm" } ] } } The QAPI is a bit more verbose than just a list of StatsProvider, so that it can be subsequently extended with filtering of statistics by name. If a provider is specified more than once in the filter, each request will be included separately in the output. Extracted from a patch by Mark Kanda. Reviewed-by: Markus Armbruster Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Paolo Bonzini --- qapi/stats.json | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'qapi') diff --git a/qapi/stats.json b/qapi/stats.json index 8c9abb5..503918e 100644 --- a/qapi/stats.json +++ b/qapi/stats.json @@ -70,6 +70,18 @@ 'data': [ 'vm', 'vcpu' ] } ## +# @StatsRequest: +# +# Indicates a set of statistics that should be returned by query-stats. +# +# @provider: provider for which to return statistics. +# +# Since: 7.1 +## +{ 'struct': 'StatsRequest', + 'data': { 'provider': 'StatsProvider' } } + +## # @StatsVCPUFilter: # # @vcpus: list of QOM paths for the desired vCPU objects. @@ -86,11 +98,14 @@ # request statistics and optionally the required subset of information for # that target: # - which vCPUs to request statistics for +# - which providers to request statistics from # # Since: 7.1 ## { 'union': 'StatsFilter', - 'base': { 'target': 'StatsTarget' }, + 'base': { + 'target': 'StatsTarget', + '*providers': [ 'StatsRequest' ] }, 'discriminator': 'target', 'data': { 'vcpu': 'StatsVCPUFilter' } } @@ -226,5 +241,5 @@ # Since: 7.1 ## { 'command': 'query-stats-schemas', - 'data': { }, + 'data': { '*provider': 'StatsProvider' }, 'returns': [ 'StatsSchema' ] } -- cgit v1.1