提交 b106c8b9 编写于 作者: J Jiri Denemark

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: NJiri Denemark <jdenemar@redhat.com>
上级 d27c66db
......@@ -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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册