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

[libvirt] [PATCH 7/7] lxc: Ensure container <init> actually exists



Since we can't really get useful error reporting from virCommandExec since
it needs to be the last thing we do.

Signed-off-by: Cole Robinson <crobinso redhat com>
---
 src/lxc/lxc_container.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 26b493e..7924858 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -785,6 +785,13 @@ static int lxcContainerChild( void *data )
     if (lxcContainerSetupMounts(vmDef, root) < 0)
         goto cleanup;
 
+    if (!virFileExists(vmDef->os.init)) {
+        virReportSystemError(errno,
+                    _("cannot find init path '%s' relative to container root"),
+                    vmDef->os.init);
+        goto cleanup;
+    }
+
     /* Wait for interface devices to show up */
     if (lxcContainerWaitForContinue(argv->monitor) < 0) {
         virReportSystemError(errno, "%s",
-- 
1.7.4.4


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