[RFC PATCH 0/6] qemu: add support for query-stats-schemas

Amneesh Singh posted 6 patches 1 year, 7 months ago
Failed in applying to current master (apply log)
include/libvirt/libvirt-domain.h              |   1 +
src/libvirt-domain.c                          |   3 +
src/qemu/qemu_capabilities.c                  |   2 +
src/qemu/qemu_capabilities.h                  |   1 +
src/qemu/qemu_domain.c                        |  41 ++++++
src/qemu/qemu_domain.h                        |   5 +
src/qemu/qemu_driver.c                        | 127 ++++++++++++++++++
src/qemu/qemu_monitor.c                       |  67 +++++++++
src/qemu/qemu_monitor.h                       |  39 ++++++
src/qemu/qemu_monitor_json.c                  |  93 +++++++++++++
src/qemu/qemu_monitor_json.h                  |   4 +
.../caps_7.1.0.x86_64.xml                     |   1 +
tools/virsh-domain-monitor.c                  |   7 +
13 files changed, 391 insertions(+)
[RFC PATCH 0/6] qemu: add support for query-stats-schemas
Posted by Amneesh Singh 1 year, 7 months ago
This patch adds an API for query-stats-schemas and uses it to work with
the pre-existing API for query-stats to display those stats.

[1/6]: This patch adds a simple API for query-stats-schemas and an
extractor function to deserialise it into a GHashTable. The GHashTable
here is a pair of the name of the stat and the schema for it. Some
fields in the latter  like the exponent, base and bucket-size are not
utilised in this patchset but they will be useful in the subsequent
patches which add the support for the histograms.

[2/6]: Add query-stats-schemas to the qemu capabilities.

[3/6]: This patch adds the schema hashtable to the
virDomainObjectPrivate. This decision was made due to QEMU upstream not
having vCPUs to generate the schema, so that they could be stored as the
file cache. This might be changed in the future if there is workaround
upstream or if libvirt ends up using a dummy VM just to query the
schema.

[4/6]: This patch simply adds a utility function to traverse the
schemas to find the object that corresponds to the provided QOM path.

[5/6]: This patch adds vCPU stats in addition to the pre-existing ones
using a helper function. Histograms are ignored for now but they will be
added in the next patchset.

[6/6]: This patch adds a new stat worker for QEMU called "Vm" due to the
stats being for the "vm" target. It utilises the same helper function as
above.

Comments are much appreciated.

Amneesh Singh (6):
  qemu_monitor: add qemuMonitorQueryStatsSchema
  qemu_capabilities: add "query-stats-schemas" QMP command to the QEMU
    capabilities
  qemu_domain: add statsSchema to qemuDomainObjPrivate
  qemu_monitor: add qemuMonitorGetStatsByQOMPath
  qemu_driver: add the vCPU stats by KVM to the current stats
  qemu_driver: add new stats worker qemuDomainGetStatsVm

 include/libvirt/libvirt-domain.h              |   1 +
 src/libvirt-domain.c                          |   3 +
 src/qemu/qemu_capabilities.c                  |   2 +
 src/qemu/qemu_capabilities.h                  |   1 +
 src/qemu/qemu_domain.c                        |  41 ++++++
 src/qemu/qemu_domain.h                        |   5 +
 src/qemu/qemu_driver.c                        | 127 ++++++++++++++++++
 src/qemu/qemu_monitor.c                       |  67 +++++++++
 src/qemu/qemu_monitor.h                       |  39 ++++++
 src/qemu/qemu_monitor_json.c                  |  93 +++++++++++++
 src/qemu/qemu_monitor_json.h                  |   4 +
 .../caps_7.1.0.x86_64.xml                     |   1 +
 tools/virsh-domain-monitor.c                  |   7 +
 13 files changed, 391 insertions(+)

-- 
2.37.1
Re: [RFC PATCH 0/6] qemu: add support for query-stats-schemas
Posted by Martin Kletzander 1 year, 6 months ago
On Wed, Sep 07, 2022 at 04:04:17PM +0530, Amneesh Singh wrote:
>This patch adds an API for query-stats-schemas and uses it to work with
>the pre-existing API for query-stats to display those stats.
>
>[1/6]: This patch adds a simple API for query-stats-schemas and an
>extractor function to deserialise it into a GHashTable. The GHashTable
>here is a pair of the name of the stat and the schema for it. Some
>fields in the latter  like the exponent, base and bucket-size are not
>utilised in this patchset but they will be useful in the subsequent
>patches which add the support for the histograms.
>
>[2/6]: Add query-stats-schemas to the qemu capabilities.
>
>[3/6]: This patch adds the schema hashtable to the
>virDomainObjectPrivate. This decision was made due to QEMU upstream not
>having vCPUs to generate the schema, so that they could be stored as the
>file cache. This might be changed in the future if there is workaround
>upstream or if libvirt ends up using a dummy VM just to query the
>schema.
>
>[4/6]: This patch simply adds a utility function to traverse the
>schemas to find the object that corresponds to the provided QOM path.
>
>[5/6]: This patch adds vCPU stats in addition to the pre-existing ones
>using a helper function. Histograms are ignored for now but they will be
>added in the next patchset.
>
>[6/6]: This patch adds a new stat worker for QEMU called "Vm" due to the
>stats being for the "vm" target. It utilises the same helper function as
>above.
>
>Comments are much appreciated.
>
>Amneesh Singh (6):
>  qemu_monitor: add qemuMonitorQueryStatsSchema
>  qemu_capabilities: add "query-stats-schemas" QMP command to the QEMU
>    capabilities
>  qemu_domain: add statsSchema to qemuDomainObjPrivate
>  qemu_monitor: add qemuMonitorGetStatsByQOMPath
>  qemu_driver: add the vCPU stats by KVM to the current stats
>  qemu_driver: add new stats worker qemuDomainGetStatsVm
>

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>

There were some details that I missed previously, so I noted most of
them in individual replies (apart from few tiny details), fixed all of
them and pushed the series.  Sorry it took so long.  Would you mind
rebasing and resending the other series so it does not seem obsolete?

Thank you for the work.

> include/libvirt/libvirt-domain.h              |   1 +
> src/libvirt-domain.c                          |   3 +
> src/qemu/qemu_capabilities.c                  |   2 +
> src/qemu/qemu_capabilities.h                  |   1 +
> src/qemu/qemu_domain.c                        |  41 ++++++
> src/qemu/qemu_domain.h                        |   5 +
> src/qemu/qemu_driver.c                        | 127 ++++++++++++++++++
> src/qemu/qemu_monitor.c                       |  67 +++++++++
> src/qemu/qemu_monitor.h                       |  39 ++++++
> src/qemu/qemu_monitor_json.c                  |  93 +++++++++++++
> src/qemu/qemu_monitor_json.h                  |   4 +
> .../caps_7.1.0.x86_64.xml                     |   1 +
> tools/virsh-domain-monitor.c                  |   7 +
> 13 files changed, 391 insertions(+)
>
>-- 
>2.37.1
>