mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 15:15:25 +00:00
qemuDomainGetJobStatsInternal: Support migration events
When QEMU supports migration events the qemuDomainJobInfo structure will no longer be updated with migration statistics. We have to enter a job and explicitly ask QEMU every time virDomainGetJob{Info,Stats} is called. Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
3df4d2a45a
commit
66c95964a5
@ -12939,15 +12939,27 @@ qemuConnectBaselineCPU(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
qemuDomainGetJobStatsInternal(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
|
qemuDomainGetJobStatsInternal(virQEMUDriverPtr driver,
|
||||||
virDomainObjPtr vm,
|
virDomainObjPtr vm,
|
||||||
bool completed,
|
bool completed,
|
||||||
qemuDomainJobInfoPtr jobInfo)
|
qemuDomainJobInfoPtr jobInfo)
|
||||||
{
|
{
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
qemuDomainJobInfoPtr info;
|
qemuDomainJobInfoPtr info;
|
||||||
|
bool fetch = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT);
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
|
if (completed)
|
||||||
|
fetch = false;
|
||||||
|
|
||||||
|
/* Do not ask QEMU if migration is not even running yet */
|
||||||
|
if (!priv->job.current || !priv->job.current->status.status)
|
||||||
|
fetch = false;
|
||||||
|
|
||||||
|
if (fetch &&
|
||||||
|
qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (!completed &&
|
if (!completed &&
|
||||||
!virDomainObjIsActive(vm)) {
|
!virDomainObjIsActive(vm)) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||||
@ -12968,12 +12980,19 @@ qemuDomainGetJobStatsInternal(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
|
|||||||
*jobInfo = *info;
|
*jobInfo = *info;
|
||||||
|
|
||||||
if (jobInfo->type == VIR_DOMAIN_JOB_BOUNDED ||
|
if (jobInfo->type == VIR_DOMAIN_JOB_BOUNDED ||
|
||||||
jobInfo->type == VIR_DOMAIN_JOB_UNBOUNDED)
|
jobInfo->type == VIR_DOMAIN_JOB_UNBOUNDED) {
|
||||||
ret = qemuDomainJobInfoUpdateTime(jobInfo);
|
if (fetch)
|
||||||
|
ret = qemuMigrationFetchJobStatus(driver, vm, QEMU_ASYNC_JOB_NONE,
|
||||||
|
jobInfo);
|
||||||
else
|
else
|
||||||
|
ret = qemuDomainJobInfoUpdateTime(jobInfo);
|
||||||
|
} else {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
if (fetch)
|
||||||
|
qemuDomainObjEndJob(driver, vm);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user