Before this patch a container was able to be started
without mounted cgroup. (only a warning was logged)
This was not consistent between all lxc commands.
For exemple if cgroup is not mounted at time of lxc-execute or lxc-start.
then the lxc-ps that is using the /proc/<pid>/cgroup 
will not be able to identify the pids of lxc container.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
---
 src/lxc/cgroup.c |   11 ++++++++---
 src/lxc/start.c  |    2 +-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/lxc/cgroup.c b/src/lxc/cgroup.c
index a905899..bc90b9a 100644
--- a/src/lxc/cgroup.c
+++ b/src/lxc/cgroup.c
@@ -75,16 +75,21 @@ int lxc_rename_nsgroup(const char *name, pid_t pid)
 	char oldname[MAXPATHLEN];
 	char newname[MAXPATHLEN];
 	char cgroup[MAXPATHLEN];
+	int ret;
 
 	if (get_cgroup_mount(MTAB, cgroup)) {
-		INFO("cgroup is not mounted");
+		ERROR("cgroup is not mounted");
 		return -1;
 	}
 
 	snprintf(oldname, MAXPATHLEN, "%s/%d", cgroup, pid);
 	snprintf(newname, MAXPATHLEN, "%s/%s", cgroup, name);
 
-	return rename(oldname, newname);
+	ret = rename(oldname, newname);
+	if (ret)
+		SYSERROR("failed to rename cgroup %s->%s",
+				 oldname, newname);
+	return ret;
 }
 
 int lxc_link_nsgroup(const char *name)
@@ -95,7 +100,7 @@ int lxc_link_nsgroup(const char *name)
 	int ret;
 
 	if (get_cgroup_mount(MTAB, cgroup)) {
-		INFO("cgroup is not mounted");
+		ERROR("cgroup is not mounted");
 		return -1;
 	}
 
diff --git a/src/lxc/start.c b/src/lxc/start.c
index 4e0c3f1..037a229 100644
--- a/src/lxc/start.c
+++ b/src/lxc/start.c
@@ -552,7 +552,7 @@ int lxc_spawn(const char *name, struct lxc_handler *handler, char *const argv[])
 	}
 
 	if (lxc_rename_nsgroup(name, handler->pid) || lxc_link_nsgroup(name))
-		WARN("cgroupfs not found: cgroup disabled");
+		goto out_abort;
 
 	/* Create the network configuration */
 	if (clone_flags & CLONE_NEWNET &&
-- 
1.6.3.2

-- 


