提交 defc8790 编写于 作者: N Nikolay Shirokovskiy 提交者: Jiri Denemark

qemu: always get job condition on getting job stats

Looks like it is more simple to drop this optimization as we are
going to add getting disks stats during migration via quering qemu
process and checking if we have to acquire job condition becomes
more complicate.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
上级 5a274d4f
...@@ -12973,7 +12973,7 @@ qemuDomainGetJobStatsInternal(virQEMUDriverPtr driver, ...@@ -12973,7 +12973,7 @@ qemuDomainGetJobStatsInternal(virQEMUDriverPtr driver,
qemuDomainJobInfoPtr jobInfo) qemuDomainJobInfoPtr jobInfo)
{ {
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
bool fetch = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT); bool events = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT);
int ret = -1; int ret = -1;
if (completed) { if (completed) {
...@@ -12992,12 +12992,7 @@ qemuDomainGetJobStatsInternal(virQEMUDriverPtr driver, ...@@ -12992,12 +12992,7 @@ qemuDomainGetJobStatsInternal(virQEMUDriverPtr driver,
return -1; return -1;
} }
/* Do not ask QEMU if migration is not even running yet */ if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
if (!priv->job.current ||
priv->job.current->status == QEMU_DOMAIN_JOB_STATUS_ACTIVE)
fetch = false;
if (fetch && qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
return -1; return -1;
if (!virDomainObjIsActive(vm)) { if (!virDomainObjIsActive(vm)) {
...@@ -13016,7 +13011,8 @@ qemuDomainGetJobStatsInternal(virQEMUDriverPtr driver, ...@@ -13016,7 +13011,8 @@ qemuDomainGetJobStatsInternal(virQEMUDriverPtr driver,
if (jobInfo->status == QEMU_DOMAIN_JOB_STATUS_ACTIVE || if (jobInfo->status == QEMU_DOMAIN_JOB_STATUS_ACTIVE ||
jobInfo->status == QEMU_DOMAIN_JOB_STATUS_MIGRATING || jobInfo->status == QEMU_DOMAIN_JOB_STATUS_MIGRATING ||
jobInfo->status == QEMU_DOMAIN_JOB_STATUS_POSTCOPY) { jobInfo->status == QEMU_DOMAIN_JOB_STATUS_POSTCOPY) {
if (fetch && if (events &&
jobInfo->status != QEMU_DOMAIN_JOB_STATUS_ACTIVE &&
qemuMigrationFetchStats(driver, vm, QEMU_ASYNC_JOB_NONE, jobInfo) < 0) qemuMigrationFetchStats(driver, vm, QEMU_ASYNC_JOB_NONE, jobInfo) < 0)
goto cleanup; goto cleanup;
...@@ -13027,8 +13023,7 @@ qemuDomainGetJobStatsInternal(virQEMUDriverPtr driver, ...@@ -13027,8 +13023,7 @@ qemuDomainGetJobStatsInternal(virQEMUDriverPtr driver,
ret = 0; ret = 0;
cleanup: cleanup:
if (fetch) qemuDomainObjEndJob(driver, vm);
qemuDomainObjEndJob(driver, vm);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册