[PATCH] Fix reporting of errors for p2p migration

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

 



Starting/ending jobs when closing the connection may reset any
error which was reported earlier in p2p migration. We must
save the original error before doing so. This means we can also
just call virConnectClose as normal, instead of virUnrefConnect

* src/qemu/qemu_migration.c: Preserve errors in p2p migration
---
 src/qemu/qemu_migration.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index dfa80e3..1803b9f 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2141,6 +2141,8 @@ static int doPeer2PeerMigrate(struct qemud_driver *driver,
     int ret = -1;
     virConnectPtr dconn = NULL;
     bool p2p;
+    virErrorPtr orig_err = NULL;
+
     VIR_DEBUG("driver=%p, sconn=%p, vm=%p, xmlin=%s, dconnuri=%s, "
               "uri=%s, flags=%lx, dname=%s, resource=%lu",
               driver, sconn, vm, NULLSTR(xmlin), NULLSTR(dconnuri),
@@ -2191,10 +2193,14 @@ static int doPeer2PeerMigrate(struct qemud_driver *driver,
                                   dconnuri, flags, dname, resource);
 
 cleanup:
-    /* don't call virConnectClose(), because that resets any pending errors */
+    orig_err = virSaveLastError();
     qemuDomainObjEnterRemoteWithDriver(driver, vm);
-    virUnrefConnect(dconn);
+    virConnectClose(dconn);
     qemuDomainObjExitRemoteWithDriver(driver, vm);
+    if (orig_err) {
+        virSetError(orig_err);
+        virFreeError(orig_err);
+    }
 
     return ret;
 }
-- 
1.7.4.4

--
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]