提交 109017d9 编写于 作者: J Jiri Denemark

qemu: Add flags to qemuMigrationWaitForCompletion

The function already takes two bool arguments, switching to flags makes
it a lot easier to read. Especially in case we need to add another
boolean in the future.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
上级 d64adcdb
......@@ -2740,21 +2740,14 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver,
virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob,
virConnectPtr dconn,
bool abort_on_error,
bool storage)
unsigned int flags)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
qemuDomainJobInfoPtr jobInfo = priv->job.current;
bool events = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT);
unsigned int flags;
int rv;
flags = QEMU_MIGRATION_COMPLETED_UPDATE_STATS |
QEMU_MIGRATION_COMPLETED_POSTCOPY;
if (abort_on_error)
flags |= QEMU_MIGRATION_COMPLETED_ABORT_ON_ERROR;
if (storage)
flags |= QEMU_MIGRATION_COMPLETED_CHECK_STORAGE;
flags |= QEMU_MIGRATION_COMPLETED_UPDATE_STATS;
jobInfo->type = VIR_DOMAIN_JOB_UNBOUNDED;
while ((rv = qemuMigrationCompleted(driver, vm, asyncJob,
......@@ -4461,6 +4454,7 @@ qemuMigrationRun(virQEMUDriverPtr driver,
bool abort_on_error = !!(flags & VIR_MIGRATE_ABORT_ON_ERROR);
bool events = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT);
bool inPostCopy = false;
unsigned int waitFlags;
int rc;
VIR_DEBUG("driver=%p, vm=%p, cookiein=%s, cookieinlen=%d, "
......@@ -4646,9 +4640,17 @@ qemuMigrationRun(virQEMUDriverPtr driver,
fd = -1;
}
waitFlags = 0;
if (abort_on_error)
waitFlags |= QEMU_MIGRATION_COMPLETED_ABORT_ON_ERROR;
if (mig->nbd)
waitFlags |= QEMU_MIGRATION_COMPLETED_CHECK_STORAGE;
if (flags & VIR_MIGRATE_POSTCOPY)
waitFlags |= QEMU_MIGRATION_COMPLETED_POSTCOPY;
rc = qemuMigrationWaitForCompletion(driver, vm,
QEMU_ASYNC_JOB_MIGRATION_OUT,
dconn, abort_on_error, !!mig->nbd);
dconn, waitFlags);
if (rc == -2)
goto cancel;
else if (rc == -1)
......@@ -6279,8 +6281,7 @@ qemuMigrationToFile(virQEMUDriverPtr driver, virDomainObjPtr vm,
if (rc < 0)
goto cleanup;
rc = qemuMigrationWaitForCompletion(driver, vm, asyncJob,
NULL, false, false);
rc = qemuMigrationWaitForCompletion(driver, vm, asyncJob, NULL, 0);
if (rc < 0) {
if (rc == -2) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册