[PATCH 2/2] qemu: Don't give up on first error in qemuMigrationCancelDriverMirror

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

 



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@xxxxxxxxxx>
---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]