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

qemu: Abort migration early if disk mirror failed

Abort migration as soon as we detect that some of the disk mirrors
failed. There's no sense in trying to finish memory migration first.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
上级 cebb110f
...@@ -2524,7 +2524,8 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver, ...@@ -2524,7 +2524,8 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob, qemuDomainAsyncJob asyncJob,
virConnectPtr dconn, virConnectPtr dconn,
bool abort_on_error) bool abort_on_error,
bool storage)
{ {
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
qemuDomainJobInfoPtr jobInfo = priv->job.current; qemuDomainJobInfoPtr jobInfo = priv->job.current;
...@@ -2555,6 +2556,10 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver, ...@@ -2555,6 +2556,10 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver,
if (qemuMigrationUpdateJobStatus(driver, vm, job, asyncJob) == -1) if (qemuMigrationUpdateJobStatus(driver, vm, job, asyncJob) == -1)
goto error; goto error;
if (storage &&
qemuMigrationDriveMirrorReady(driver, vm) < 0)
break;
/* cancel migration if disk I/O error is emitted while migrating */ /* cancel migration if disk I/O error is emitted while migrating */
if (abort_on_error && if (abort_on_error &&
virDomainObjGetState(vm, &pauseReason) == VIR_DOMAIN_PAUSED && virDomainObjGetState(vm, &pauseReason) == VIR_DOMAIN_PAUSED &&
...@@ -4231,20 +4236,12 @@ qemuMigrationRun(virQEMUDriverPtr driver, ...@@ -4231,20 +4236,12 @@ qemuMigrationRun(virQEMUDriverPtr driver,
rc = qemuMigrationWaitForCompletion(driver, vm, rc = qemuMigrationWaitForCompletion(driver, vm,
QEMU_ASYNC_JOB_MIGRATION_OUT, QEMU_ASYNC_JOB_MIGRATION_OUT,
dconn, abort_on_error); dconn, abort_on_error, !!mig->nbd);
if (rc == -2) if (rc == -2)
goto cancel; goto cancel;
else if (rc == -1) else if (rc == -1)
goto cleanup; goto cleanup;
/* Confirm state of drive mirrors */
if (mig->nbd) {
if (qemuMigrationDriveMirrorReady(driver, vm) != 1) {
ret = -1;
goto cancel;
}
}
/* When migration completed, QEMU will have paused the /* When migration completed, QEMU will have paused the
* CPUs for us, but unless we're using the JSON monitor * CPUs for us, but unless we're using the JSON monitor
* we won't have been notified of this, so might still * we won't have been notified of this, so might still
...@@ -5756,7 +5753,8 @@ qemuMigrationToFile(virQEMUDriverPtr driver, virDomainObjPtr vm, ...@@ -5756,7 +5753,8 @@ qemuMigrationToFile(virQEMUDriverPtr driver, virDomainObjPtr vm,
if (rc < 0) if (rc < 0)
goto cleanup; goto cleanup;
rc = qemuMigrationWaitForCompletion(driver, vm, asyncJob, NULL, false); rc = qemuMigrationWaitForCompletion(driver, vm, asyncJob,
NULL, false, false);
if (rc < 0) { if (rc < 0) {
if (rc == -2) { if (rc == -2) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册