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

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



Signed-off-by: Cole Robinson <crobinso redhat com>
---
 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


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