From f9e8d6a065129f9b33b721712ddfdef36eb80be2 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Thu, 2 Jun 2011 15:25:21 -0400 Subject: [PATCH] lxc: Ensure container actually exists Since we can't really get useful error reporting from virCommandExec since it needs to be the last thing we do. --- src/lxc/lxc_container.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index 26b493ec81..7924858879 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",