mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
qemu: Introduce QEMU_DOMAIN_JOB_STATS_TYPE_SAVEDUMP
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. Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
93412bb827
commit
9d73df98c2
@ -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:
|
||||
|
@ -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;
|
||||
|
||||
|
||||
|
@ -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. */
|
||||
@ -13171,6 +13171,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;
|
||||
@ -13226,6 +13227,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;
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user