From a6922778739200b233fc94cc7dcd2e86c1de4989 Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Mon, 11 May 2015 20:15:43 +0200 Subject: [PATCH] qemu: Don't give up on first error in qemuMigrationCancelDriverMirror When cancelling drive mirror, always try to do that for all disks even if it fails for some of them. Report the first error we saw. Signed-off-by: Jiri Denemark --- src/qemu/qemu_migration.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index cf56a8be11..8fe1cfbe23 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1862,6 +1862,8 @@ static int qemuMigrationCancelDriveMirror(virQEMUDriverPtr driver, virDomainObjPtr vm) { + virErrorPtr err = NULL; + int ret = 0; size_t i; for (i = 0; i < vm->def->ndisks; i++) { @@ -1871,13 +1873,20 @@ qemuMigrationCancelDriveMirror(virQEMUDriverPtr driver, if (!diskPriv->migrating || !diskPriv->blockJobSync) continue; - if (qemuMigrationCancelOneDriveMirror(driver, vm, disk) < 0) - return -1; + if (qemuMigrationCancelOneDriveMirror(driver, vm, disk) < 0) { + ret = -1; + if (!err) + err = virSaveLastError(); + } diskPriv->migrating = false; } - return 0; + if (err) { + virSetError(err); + virFreeError(err); + } + return ret; } -- GitLab