On Fri, Jan 19, 2018 at 14:53:12 -0500, John Ferlan wrote:
Extract out the parts of qemuDomainGetJobStatsInternal that get
the migration stats. We're about to add the ability to get just
dump information.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/qemu/qemu_driver.c | 52 ++++++++++++++++++++++++++++++++------------------
1 file changed, 33 insertions(+), 19 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 266a76b0e..00a010b45 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13155,13 +13155,43 @@ qemuConnectBaselineCPU(virConnectPtr conn ATTRIBUTE_UNUSED,
static int
+qemuDomainGetJobInfoMigrationStats(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ qemuDomainJobInfoPtr jobInfo)
+{
+ qemuDomainObjPrivatePtr priv = vm->privateData;
+ bool events = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT);
+
+ if (jobInfo->status == QEMU_DOMAIN_JOB_STATUS_ACTIVE ||
+ jobInfo->status == QEMU_DOMAIN_JOB_STATUS_MIGRATING ||
+ jobInfo->status == QEMU_DOMAIN_JOB_STATUS_QEMU_COMPLETED ||
+ jobInfo->status == QEMU_DOMAIN_JOB_STATUS_POSTCOPY) {
+ if (events &&
+ jobInfo->status != QEMU_DOMAIN_JOB_STATUS_ACTIVE &&
+ qemuMigrationFetchStats(driver, vm, QEMU_ASYNC_JOB_NONE,
+ jobInfo, NULL) < 0)
+ return -1;
+
+ if (jobInfo->status == QEMU_DOMAIN_JOB_STATUS_ACTIVE &&
+ qemuMigrationFetchMirrorStats(driver, vm, QEMU_ASYNC_JOB_NONE,
+ jobInfo) < 0)
I just realized we would happily try to fetch storage migration stats
even if the job is not really a migration one (e.g., save or dump). We
should fix this in a separate patch...
+ return -1;
+
+ if (qemuDomainJobInfoUpdateTime(jobInfo) < 0)
+ return -1;
+ }
+
+ return 0;
+}
...
ACK
Jirka