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 <jdenemar(a)redhat.com>
---
Notes:
Version 2:
- rebased (context changed)
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 c4f1c48..d12b7cc 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;
}
--
2.4.0