Commit f0e64b8b by Daniel Lezcano

give explicit error when the cgroup are not found

When the cgroup is not mounted, we silently exit without giving some clues to the user with what is happening. Give some info and an explicit error. Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent 7ad84da7
...@@ -240,6 +240,7 @@ int lxc_cgroup_create(const char *name, pid_t pid) ...@@ -240,6 +240,7 @@ int lxc_cgroup_create(const char *name, pid_t pid)
struct mntent *mntent; struct mntent *mntent;
FILE *file = NULL; FILE *file = NULL;
int err = -1; int err = -1;
int found = 0;
file = setmntent(MTAB, "r"); file = setmntent(MTAB, "r");
if (!file) { if (!file) {
...@@ -253,13 +254,18 @@ int lxc_cgroup_create(const char *name, pid_t pid) ...@@ -253,13 +254,18 @@ int lxc_cgroup_create(const char *name, pid_t pid)
if (!strcmp(mntent->mnt_type, "cgroup")) { if (!strcmp(mntent->mnt_type, "cgroup")) {
INFO("found cgroup mounted at '%s'", mntent->mnt_dir); INFO("[%d] found cgroup mounted at '%s',opts='%s'",
++found, mntent->mnt_dir, mntent->mnt_opts);
err = lxc_one_cgroup_create(name, mntent, pid); err = lxc_one_cgroup_create(name, mntent, pid);
if (err) if (err)
goto out; goto out;
} }
}; };
if (!found)
ERROR("No cgroup mounted on the system");
out: out:
endmntent(file); endmntent(file);
return err; return err;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment