mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 21:15:20 +00:00
qemu: Refactor qemuDomainGetJobInfoMigrationStats
The code was a bit too complicated, especially after removing the check for QEMU_CAPS_MIGRATION_EVENT. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
b5fd70b367
commit
62daebed13
@ -12511,26 +12511,32 @@ qemuDomainGetJobInfoMigrationStats(virQEMUDriver *driver,
|
||||
{
|
||||
qemuDomainJobDataPrivate *privStats = jobData->privateData;
|
||||
|
||||
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) {
|
||||
if (jobData->status != VIR_DOMAIN_JOB_STATUS_ACTIVE &&
|
||||
qemuMigrationAnyFetchStats(driver, vm, VIR_ASYNC_JOB_NONE,
|
||||
jobData, NULL) < 0)
|
||||
return -1;
|
||||
|
||||
if (jobData->status == VIR_DOMAIN_JOB_STATUS_ACTIVE &&
|
||||
privStats->statsType == QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION &&
|
||||
switch (jobData->status) {
|
||||
case VIR_DOMAIN_JOB_STATUS_ACTIVE:
|
||||
if (privStats->statsType == QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION &&
|
||||
qemuMigrationSrcFetchMirrorStats(driver, vm, VIR_ASYNC_JOB_NONE,
|
||||
jobData) < 0)
|
||||
return -1;
|
||||
break;
|
||||
|
||||
if (qemuDomainJobDataUpdateTime(jobData) < 0)
|
||||
case VIR_DOMAIN_JOB_STATUS_MIGRATING:
|
||||
case VIR_DOMAIN_JOB_STATUS_HYPERVISOR_COMPLETED:
|
||||
case VIR_DOMAIN_JOB_STATUS_POSTCOPY:
|
||||
if (qemuMigrationAnyFetchStats(driver, vm, VIR_ASYNC_JOB_NONE,
|
||||
jobData, NULL) < 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:
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return qemuDomainJobDataUpdateTime(jobData);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user