[PATCH] libxl: Fix domain startup failure error reporting

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

 



When domain startup fails, domain cleanup calls
libxlNetworkUnwindDevices, which calls virGetConnectNetwork, which
is a top level API entry point, which resets the initial saved error,
leading to clients seeing:

  error: An error occurred, but the cause is unknown

This preserves the error from before virGetConnectNetwork is called.

Signed-off-by: Cole Robinson <crobinso@xxxxxxxxxx>
---
 src/libxl/libxl_domain.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 17b347de4e..bda110e9e6 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -830,12 +830,17 @@ libxlNetworkUnwindDevices(virDomainDef *def)
             /* cleanup actual device */
             virDomainNetRemoveHostdev(def, net);
             if (net->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
-                g_autoptr(virConnect) conn = virGetConnectNetwork();
+                g_autoptr(virConnect) conn = NULL;
+                virErrorPtr save_err;
+
+                virErrorPreserveLast(&save_err);
+                conn = virGetConnectNetwork();
 
                 if (conn)
                     virDomainNetReleaseActualDevice(conn, def, net);
                 else
                     VIR_WARN("Unable to release network device '%s'", NULLSTR(net->ifname));
+                virErrorRestore(&save_err);
             }
         }
     }
-- 
2.36.1




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

  Powered by Linux