mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 23:07:44 +00:00
qemu: Copy completed migration stats only on success
The destination host gets detailed statistics about the current migration form the source host via migration cookie and copies them to the domain object so that they can be queried using virDomainGetJobStats. However, we should only copy statistics to the domain object when migration finished successfully. Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
d27c66dbaa
commit
b106c8b910
@ -5671,6 +5671,10 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
|
||||
|
||||
dom = virGetDomain(dconn, vm->def->name, vm->def->uuid);
|
||||
} else if (retcode == 0) {
|
||||
unsigned long long timeReceived = 0;
|
||||
|
||||
ignore_value(virTimeMillisNow(&timeReceived));
|
||||
|
||||
if (!virDomainObjIsActive(vm)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("guest unexpectedly quit"));
|
||||
@ -5678,16 +5682,6 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
if (mig->jobInfo) {
|
||||
qemuDomainJobInfoPtr jobInfo = mig->jobInfo;
|
||||
priv->job.completed = jobInfo;
|
||||
mig->jobInfo = NULL;
|
||||
if (jobInfo->sent && virTimeMillisNow(&jobInfo->received) == 0) {
|
||||
jobInfo->timeDelta = jobInfo->received - jobInfo->sent;
|
||||
jobInfo->timeDeltaSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (qemuMigrationVPAssociatePortProfiles(vm->def) < 0)
|
||||
goto endjob;
|
||||
|
||||
@ -5745,7 +5739,16 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
|
||||
}
|
||||
}
|
||||
|
||||
if (priv->job.completed) {
|
||||
if (mig->jobInfo) {
|
||||
qemuDomainJobInfoPtr jobInfo = mig->jobInfo;
|
||||
priv->job.completed = jobInfo;
|
||||
mig->jobInfo = NULL;
|
||||
|
||||
if (jobInfo->sent && timeReceived) {
|
||||
jobInfo->timeDelta = timeReceived - jobInfo->sent;
|
||||
jobInfo->received = timeReceived;
|
||||
jobInfo->timeDeltaSet = true;
|
||||
}
|
||||
qemuDomainJobInfoUpdateTime(priv->job.completed);
|
||||
qemuDomainJobInfoUpdateDowntime(priv->job.completed);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user