]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: Don't give up on first error in qemuMigrationCancelDriverMirror
authorJiri Denemark <jdenemar@redhat.com>
Mon, 11 May 2015 18:15:43 +0000 (20:15 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Fri, 15 May 2015 06:05:31 +0000 (08:05 +0200)
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

index cf56a8be11a2b853e03b4f3b78b82085c7081cdb..8fe1cfbe2393c074dee18889636795ee4c9a5e41 100644 (file)
@@ -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;
 }