[libvirt] [PATCH 4/5] libvirt.c: Preserve MigratePerform failure

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

 



Signed-off-by: Cole Robinson <crobinso@xxxxxxxxxx>
---
 src/libvirt.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/libvirt.c b/src/libvirt.c
index 4308573..b95a8ed 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -3135,6 +3135,7 @@ virDomainMigrateVersion2 (virDomainPtr domain,
     char *dom_xml = NULL;
     int cookielen = 0, ret;
     virDomainInfo info;
+    virErrorPtr origerr = NULL;
 
     /* Prepare the migration.
      *
@@ -3190,6 +3191,10 @@ virDomainMigrateVersion2 (virDomainPtr domain,
     ret = domain->conn->driver->domainMigratePerform
         (domain, cookie, cookielen, uri, flags, dname, bandwidth);
 
+    /* Perform failed. Make sure Finish doesn't overwrite the error */
+    if (ret < 0)
+        origerr = virSaveLastError();
+
     /* In version 2 of the migration protocol, we pass the
      * status code from the sender to the destination host,
      * so it can do any cleanup if the migration failed.
@@ -3199,6 +3204,10 @@ virDomainMigrateVersion2 (virDomainPtr domain,
         (dconn, dname, cookie, cookielen, uri, flags, ret);
 
  done:
+    if (origerr) {
+        virSetError(origerr);
+        virFreeError(origerr);
+    }
     VIR_FREE (uri_out);
     VIR_FREE (cookie);
     return ddomain;
-- 
1.6.5.2

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