
On 09/15/2014 09:42 AM, Peter Krempa wrote:
From: Francesco Romani <fromani@redhat.com>
Future patches which will implement more bulk stats groups for QEMU will need to access the connection object.
To accomodate that, a few changes are needed:
s/accomodate/accommodate/
* enrich internal prototype to pass qemu driver object
* add per-group flag to mark if one collector needs monitor access or not
* If at least one collector of the requested stats needs monitor access we must start a query job for each domain. The specific collectors will run nested monitor jobs inside that.
* If the job can't be acquired we pass flags to the collector so specific collectors that need monitor access can be skipped in order to gather as much data as is possible.
Signed-off-by: Francesco Romani <fromani@redhat.com> Signed-off-by: Peter Krempa <pkrempa@redhat.com> ---
Notes: Version 6: - renamed HAVE_MONITOR to HAVE_JOB
src/qemu/qemu_driver.c | 63 +++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 55 insertions(+), 8 deletions(-)
+static bool +qemuDomainGetStatsNeedMonitor(unsigned int stats) +{ + size_t i; + + for (i = 0; qemuDomainGetStatsWorkers[i].func; i++) + if (stats & qemuDomainGetStatsWorkers[i].stats) + if (qemuDomainGetStatsWorkers[i].monitor)
Could combine two 'if' into one with &&, but as-is works as well.
@@ -17525,12 +17557,22 @@ qemuConnectGetAllDomainStats(virConnectPtr conn, !virConnectGetAllDomainStatsCheckACL(conn, dom->def)) continue;
- if (qemuDomainGetStats(conn, dom, stats, &tmp, flags) < 0) - goto cleanup; + if (HAVE_JOB(domflags) && + qemuDomainObjBeginJob(driver, dom, QEMU_JOB_QUERY) < 0)
Indentation is off. ACK with nit fixed. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org