mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
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:
parent
cebb110f73
commit
a9ba39a1a7
@ -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,
|
|||||||
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,
|
|||||||
|
|
||||||
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,
|
|||||||
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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user