To make sure all job states are properly handled. Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx> --- src/qemu/qemu_driver.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e3582f62a7..85ccc446d7 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -12508,10 +12508,11 @@ qemuDomainGetJobInfoMigrationStats(virQEMUDriver *driver, bool events = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT); - if (jobData->status == VIR_DOMAIN_JOB_STATUS_ACTIVE || - jobData->status == VIR_DOMAIN_JOB_STATUS_MIGRATING || - jobData->status == VIR_DOMAIN_JOB_STATUS_HYPERVISOR_COMPLETED || - jobData->status == VIR_DOMAIN_JOB_STATUS_POSTCOPY) { + switch (jobData->status) { + case VIR_DOMAIN_JOB_STATUS_ACTIVE: + case VIR_DOMAIN_JOB_STATUS_MIGRATING: + case VIR_DOMAIN_JOB_STATUS_HYPERVISOR_COMPLETED: + case VIR_DOMAIN_JOB_STATUS_POSTCOPY: if (events && jobData->status != VIR_DOMAIN_JOB_STATUS_ACTIVE && qemuMigrationAnyFetchStats(driver, vm, VIR_ASYNC_JOB_NONE, @@ -12526,6 +12527,17 @@ qemuDomainGetJobInfoMigrationStats(virQEMUDriver *driver, if (qemuDomainJobDataUpdateTime(jobData) < 0) return -1; + + break; + + case VIR_DOMAIN_JOB_STATUS_NONE: + case VIR_DOMAIN_JOB_STATUS_PAUSED: + case VIR_DOMAIN_JOB_STATUS_COMPLETED: + case VIR_DOMAIN_JOB_STATUS_FAILED: + case VIR_DOMAIN_JOB_STATUS_CANCELED: + default: + /* No migration stats to be fetched in these states. */ + break; } return 0; -- 2.35.1