Add a TYPE_SAVEDUMP so that when coalescing stats for a save or
dump we don't needlessly try to get the mirror stats for a migration.
Other conditions can still use MIGRATION and SAVEDUMP interchangably
including usage of the @migStats field to fetch/store the data.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/qemu/qemu_domain.c | 13 +++++++++++++
src/qemu/qemu_domain.h | 1 +
src/qemu/qemu_driver.c | 6 ++++--
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 1456cd805..bdb942f57 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -461,6 +461,12 @@ qemuDomainJobInfoToInfo(qemuDomainJobInfoPtr jobInfo,
jobInfo->mirrorStats.transferred;
break;
+ case QEMU_DOMAIN_JOB_STATS_TYPE_SAVEDUMP:
+ info->memTotal = jobInfo->stats.mig.ram_total;
+ info->memRemaining = jobInfo->stats.mig.ram_remaining;
+ info->memProcessed = jobInfo->stats.mig.ram_transferred;
+ break;
+
case QEMU_DOMAIN_JOB_STATS_TYPE_NONE:
break;
}
@@ -585,6 +591,11 @@ qemuDomainMigrationJobInfoToParams(qemuDomainJobInfoPtr jobInfo,
stats->ram_page_size) < 0)
goto error;
+ /* The remaining stats are disk, mirror, or migration specific
+ * so if this is a SAVEDUMP, we can just skip them */
+ if (jobInfo->statsType == QEMU_DOMAIN_JOB_STATS_TYPE_SAVEDUMP)
+ goto done;
+
if (virTypedParamsAddULLong(&par, &npar, &maxpar,
VIR_DOMAIN_JOB_DISK_TOTAL,
stats->disk_total +
@@ -630,6 +641,7 @@ qemuDomainMigrationJobInfoToParams(qemuDomainJobInfoPtr jobInfo,
stats->cpu_throttle_percentage) < 0)
goto error;
+ done:
*type = qemuDomainJobStatusToType(jobInfo->status);
*params = par;
*nparams = npar;
@@ -649,6 +661,7 @@ qemuDomainJobInfoToParams(qemuDomainJobInfoPtr jobInfo,
{
switch (jobInfo->statsType) {
case QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION:
+ case QEMU_DOMAIN_JOB_STATS_TYPE_SAVEDUMP:
return qemuDomainMigrationJobInfoToParams(jobInfo, type, params, nparams);
case QEMU_DOMAIN_JOB_STATS_TYPE_NONE:
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index b913d1918..29a5c7c9a 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -113,6 +113,7 @@ typedef enum {
typedef enum {
QEMU_DOMAIN_JOB_STATS_TYPE_NONE = 0,
QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION,
+ QEMU_DOMAIN_JOB_STATS_TYPE_SAVEDUMP,
} qemuDomainJobStatsType;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 01d9bf1f6..382f03bbe 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3386,7 +3386,7 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom,
goto endjob;
}
- priv->job.current->statsType = QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION;
+ priv->job.current->statsType = QEMU_DOMAIN_JOB_STATS_TYPE_SAVEDUMP;
/* Pause */
if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
@@ -3940,7 +3940,7 @@ qemuDomainCoreDumpWithFormat(virDomainPtr dom,
}
priv = vm->privateData;
- priv->job.current->statsType = QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION;
+ priv->job.current->statsType = QEMU_DOMAIN_JOB_STATS_TYPE_SAVEDUMP;
/* Migrate will always stop the VM, so the resume condition is
independent of whether the stop command is issued. */
@@ -13178,6 +13178,7 @@ qemuDomainGetJobInfoMigrationStats(virQEMUDriverPtr driver,
return -1;
if (jobInfo->status == QEMU_DOMAIN_JOB_STATUS_ACTIVE &&
+ jobInfo->statsType == QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION &&
qemuMigrationFetchMirrorStats(driver, vm, QEMU_ASYNC_JOB_NONE,
jobInfo) < 0)
return -1;
@@ -13233,6 +13234,7 @@ qemuDomainGetJobStatsInternal(virQEMUDriverPtr driver,
switch (jobInfo->statsType) {
case QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION:
+ case QEMU_DOMAIN_JOB_STATS_TYPE_SAVEDUMP:
if (qemuDomainGetJobInfoMigrationStats(driver, vm, jobInfo) < 0)
goto cleanup;
ret = 0;
--
2.13.6