[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 2/2] 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 <jdenemar redhat com>
---
 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 7448794..2dce44b 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1861,6 +1861,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++) {
@@ -1869,13 +1871,20 @@ qemuMigrationCancelDriveMirror(virQEMUDriverPtr driver,
         if (!disk->migrating || !disk->blockJobSync)
             continue;
 
-        if (qemuMigrationCancelOneDriveMirror(driver, vm, disk) < 0)
-            return -1;
+        if (qemuMigrationCancelOneDriveMirror(driver, vm, disk) < 0) {
+            ret = -1;
+            if (!err)
+                err = virSaveLastError();
+        }
 
         disk->migrating = false;
     }
 
-    return 0;
+    if (err) {
+        virSetError(err);
+        virFreeError(err);
+    }
+    return ret;
 }
 
 
-- 
2.4.0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]