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 | 10 ++++++++++
src/qemu/qemu_domain.h | 1 +
src/qemu/qemu_driver.c | 6 ++++--
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index bf9e12271..4c91f6d5f 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -466,6 +466,15 @@ qemuDomainJobInfoToInfo(qemuDomainJobInfoPtr jobInfo,
jobInfo->mirrorStats.transferred;
break;
+ case QEMU_DOMAIN_JOB_STATS_TYPE_SAVEDUMP:
+ info->memTotal = jobInfo->s.migStats.ram_total;
+ info->memRemaining = jobInfo->s.migStats.ram_remaining;
+ info->memProcessed = jobInfo->s.migStats.ram_transferred;
+ info->fileTotal = jobInfo->s.migStats.disk_total;
+ info->fileRemaining = jobInfo->s.migStats.disk_remaining;
+ info->fileProcessed = jobInfo->s.migStats.disk_transferred;
+ break;
+
case QEMU_DOMAIN_JOB_STATS_TYPE_NONE:
case QEMU_DOMAIN_JOB_STATS_TYPE_LAST:
break;
@@ -655,6 +664,7 @@ qemuDomainJobInfoToParams(qemuDomainJobInfoPtr jobInfo,
{
switch ((qemuDomainJobStatsType) 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 d4cad72b9..c891a4e28 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,
QEMU_DOMAIN_JOB_STATS_TYPE_LAST
} qemuDomainJobStatsType;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b9c720221..113bd8480 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. */
@@ -13177,6 +13177,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;
@@ -13232,6 +13233,7 @@ qemuDomainGetJobStatsInternal(virQEMUDriverPtr driver,
switch ((qemuDomainJobStatsType) 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