https://bugzilla.redhat.com/show_bug.cgi?id=904160
The following patches will provide the support and functionality in order
to re-enable getting domain memory statistics from the balloon driver based
on the upstream QEMU patch:
https://lists.gnu.org/archive/html/qemu-devel/2013-01/msg04835.html
Statistics gathering requires usage of the QEMU QObject model, specifically
the qom-list command to find the path to the balloon driver and the qom-get/
qom-set commands in order to get/set properties on the object. A future
possible extension would be to allow 'virsh qemuobject [--list|--get|--put]'
where the --list would list a single path and the get/set would allow
viewing/adjusting a specific object path property.
The QObject model requires setting properties after the domain (and device)
has been started. For the balloon driver, in order to enable collection the
property "guest-stats-polling-interval" is used. Since the QObject model has
been in place for a while and the balloon driver has been part of that, the
capability to gather statistics is only discernible if the property is found.
Once found, the property can be changed at any time after startup in order
to exend/shorted the collection interval or disable the collection by setting
the property back to 0 (zero). Setting the property back does not reset
already generated statistics. If statistics haven't been generated at all
they are initialized to -1. Thus if values are set at -1, they will not
be stored in the output. The only possible visual cue to determine that
statistics are disabled is if the polling interval property was 0 (zero).
Since it wasn't clear whether adjusting the dommemstats output to provide
that visual cue, I left that as a future possible exercise - although it is
possible to add it to this patch set where the output would be extended
to indicate the current collection interval period or that collection is
currently disabled, eg one new row "period #".
The collection period interval is saved in a new memballoon stats field
as 'period'. This is saved in the xml as "<stats
period='10'/>". The
capability to dynamically set the period once the domain has started is
controlled by a new '--period <value>' option to the dommemstats command.
The command was extended to support the --live, --current, and --config
options. The implementation uses the existing virDomainSetMemoryFlags with
a new 'VIR_DOMAIN_MEM_PERIOD' flag that the qemuDomainSetMemoryFlags() will
handle. This was methodology was chosen in preference to generating (a)
new driver function(s) to just handle the get/set of the collection period.
John Ferlan (8):
Add qemuMonitorGetObjectListPaths() method for QMP qom-list command
Add qemuMonitorGetObjectProperty() method for QMP qom-get command
Add qemuMonitorSetObjectProperty() method for QMP qom-set command
Add 'period' for Memballoon statistics gathering capability
Determine whether to start balloon memory stats gathering.
Add capability to fetch balloon stats
If available fetch the balloon driver memory stats
Allow balloon driver collection to be adjusted dynamically
docs/formatdomain.html.in | 14 ++
docs/schemas/domaincommon.rng | 7 +
include/libvirt/libvirt.h.in | 1 +
src/conf/domain_conf.c | 27 +++-
src/conf/domain_conf.h | 1 +
src/libvirt.c | 8 +-
src/qemu/qemu_domain.c | 1 +
src/qemu/qemu_domain.h | 2 +
src/qemu/qemu_driver.c | 61 +++++++-
src/qemu/qemu_monitor.c | 79 +++++++++++
src/qemu/qemu_monitor.h | 57 ++++++++
src/qemu/qemu_monitor_json.c | 317 ++++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_monitor_json.h | 18 +++
src/qemu/qemu_process.c | 164 +++++++++++++++++++++-
tests/qemumonitorjsontest.c | 184 ++++++++++++++++++++++++
tools/virsh-domain-monitor.c | 70 +++++++++-
16 files changed, 1000 insertions(+), 11 deletions(-)
--
1.8.1.4