[libvirt] [PATCH 1/3] Ensure lxcContainerMain reports errors on stderr

Daniel P. Berrange berrange at redhat.com
Mon Oct 14 12:09:41 UTC 2013


From: "Daniel P. Berrange" <berrange at redhat.com>

Ensure the lxcContainerMain method reports any errors that
occur during setup to stderr, where libvirtd will pick them
up.

Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
---
 src/lxc/lxc_container.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 7c722cc..9e87175 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1905,6 +1905,15 @@ cleanup:
         ret = virCommandExec(cmd);
     }
 
+    if (ret != 0) {
+        virErrorPtr err = virGetLastError();
+        if (err && err->message)
+            fprintf(stderr, "%s\n", err->message);
+        else
+            fprintf(stderr, "%s\n",
+                    _("Unknown failure in libvirt_lxc startup"));
+    }
+
     virCommandFree(cmd);
     return ret;
 }
-- 
1.8.3.1




More information about the libvir-list mailing list