mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemu: Store completed stats at the very end of migration
Statistics for a completed migration only make sense if the migration was successful. Let's not store them in priv->job.completed until we are sure it was a success. Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
12a1631440
commit
e031560e87
@ -5718,6 +5718,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
|
|||||||
unsigned long long timeReceived = 0;
|
unsigned long long timeReceived = 0;
|
||||||
virObjectEventPtr event;
|
virObjectEventPtr event;
|
||||||
int rc;
|
int rc;
|
||||||
|
qemuDomainJobInfoPtr jobInfo = NULL;
|
||||||
|
|
||||||
VIR_DEBUG("driver=%p, dconn=%p, vm=%p, cookiein=%s, cookieinlen=%d, "
|
VIR_DEBUG("driver=%p, dconn=%p, vm=%p, cookiein=%s, cookieinlen=%d, "
|
||||||
"cookieout=%p, cookieoutlen=%p, flags=%lx, retcode=%d",
|
"cookieout=%p, cookieoutlen=%p, flags=%lx, retcode=%d",
|
||||||
@ -5861,8 +5862,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mig->jobInfo) {
|
if (mig->jobInfo) {
|
||||||
qemuDomainJobInfoPtr jobInfo = mig->jobInfo;
|
jobInfo = mig->jobInfo;
|
||||||
priv->job.completed = jobInfo;
|
|
||||||
mig->jobInfo = NULL;
|
mig->jobInfo = NULL;
|
||||||
|
|
||||||
if (jobInfo->sent && timeReceived) {
|
if (jobInfo->sent && timeReceived) {
|
||||||
@ -5870,8 +5870,8 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
|
|||||||
jobInfo->received = timeReceived;
|
jobInfo->received = timeReceived;
|
||||||
jobInfo->timeDeltaSet = true;
|
jobInfo->timeDeltaSet = true;
|
||||||
}
|
}
|
||||||
qemuDomainJobInfoUpdateTime(priv->job.completed);
|
qemuDomainJobInfoUpdateTime(jobInfo);
|
||||||
qemuDomainJobInfoUpdateDowntime(priv->job.completed);
|
qemuDomainJobInfoUpdateDowntime(jobInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
dom = virGetDomain(dconn, vm->def->name, vm->def->uuid);
|
dom = virGetDomain(dconn, vm->def->name, vm->def->uuid);
|
||||||
@ -5910,16 +5910,20 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
|
|||||||
qemuDomainEventQueue(driver, event);
|
qemuDomainEventQueue(driver, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dom &&
|
if (dom) {
|
||||||
qemuMigrationBakeCookie(mig, driver, vm, cookieout, cookieoutlen,
|
priv->job.completed = jobInfo;
|
||||||
|
jobInfo = NULL;
|
||||||
|
if (qemuMigrationBakeCookie(mig, driver, vm, cookieout, cookieoutlen,
|
||||||
QEMU_MIGRATION_COOKIE_STATS) < 0)
|
QEMU_MIGRATION_COOKIE_STATS) < 0)
|
||||||
VIR_WARN("Unable to encode migration cookie");
|
VIR_WARN("Unable to encode migration cookie");
|
||||||
|
}
|
||||||
|
|
||||||
qemuMigrationJobFinish(driver, vm);
|
qemuMigrationJobFinish(driver, vm);
|
||||||
if (!virDomainObjIsActive(vm))
|
if (!virDomainObjIsActive(vm))
|
||||||
qemuDomainRemoveInactive(driver, vm);
|
qemuDomainRemoveInactive(driver, vm);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
VIR_FREE(jobInfo);
|
||||||
virPortAllocatorRelease(driver->migrationPorts, port);
|
virPortAllocatorRelease(driver->migrationPorts, port);
|
||||||
if (priv->mon)
|
if (priv->mon)
|
||||||
qemuMonitorSetDomainLog(priv->mon, NULL, NULL, NULL);
|
qemuMonitorSetDomainLog(priv->mon, NULL, NULL, NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user