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

Reply via email to