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: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Jiri Denemark 2015-06-10 11:00:00 +02:00
parent cebb110f73
commit a9ba39a1a7

View File

@ -2524,7 +2524,8 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver,
virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob,
virConnectPtr dconn,
bool abort_on_error)
bool abort_on_error,
bool storage)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
qemuDomainJobInfoPtr jobInfo = priv->job.current;
@ -2555,6 +2556,10 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver,
if (qemuMigrationUpdateJobStatus(driver, vm, job, asyncJob) == -1)
goto error;
if (storage &&
qemuMigrationDriveMirrorReady(driver, vm) < 0)
break;
/* cancel migration if disk I/O error is emitted while migrating */
if (abort_on_error &&
virDomainObjGetState(vm, &pauseReason) == VIR_DOMAIN_PAUSED &&
@ -4231,20 +4236,12 @@ qemuMigrationRun(virQEMUDriverPtr driver,
rc = qemuMigrationWaitForCompletion(driver, vm,
QEMU_ASYNC_JOB_MIGRATION_OUT,
dconn, abort_on_error);
dconn, abort_on_error, !!mig->nbd);
if (rc == -2)
goto cancel;
else if (rc == -1)
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
* CPUs for us, but unless we're using the JSON monitor
* we won't have been notified of this, so might still
@ -5756,7 +5753,8 @@ qemuMigrationToFile(virQEMUDriverPtr driver, virDomainObjPtr vm,
if (rc < 0)
goto cleanup;
rc = qemuMigrationWaitForCompletion(driver, vm, asyncJob, NULL, false);
rc = qemuMigrationWaitForCompletion(driver, vm, asyncJob,
NULL, false, false);
if (rc < 0) {
if (rc == -2) {