From c4cafa080c8beb9a34a1fecff9331d84385f6440 Mon Sep 17 00:00:00 2001 From: Serge Hallyn Date: Thu, 31 Dec 2015 17:43:15 -0800 Subject: [PATCH] add LXC_CGNS_AWARE env variable for mount hooks This way the lxcfs mount hook can know whether lxc knows about cgroup namespaces. Signed-off-by: Serge Hallyn --- doc/lxc.container.conf.sgml.in | 16 ++++++++++++++++ src/lxc/start.c | 3 +++ 2 files changed, 19 insertions(+) diff --git a/doc/lxc.container.conf.sgml.in b/doc/lxc.container.conf.sgml.in index 1e702c717..18ad924a3 100644 --- a/doc/lxc.container.conf.sgml.in +++ b/doc/lxc.container.conf.sgml.in @@ -1593,6 +1593,22 @@ mknod errno 0 + + + + + + + + If unset, then this version of lxc is not aware of cgroup + namespaces. If set, it will be set to 1, and lxc is aware + of cgroup namespaces. Note this does not guarantee that + cgroup namespaces are enabled in the kernel. This is used + by the lxcfs mount hook. + + + + Logging diff --git a/src/lxc/start.c b/src/lxc/start.c index 6d4d2c211..0d91eb394 100644 --- a/src/lxc/start.c +++ b/src/lxc/start.c @@ -451,6 +451,9 @@ struct lxc_handler *lxc_init(const char *name, struct lxc_conf *conf, const char if (conf->console.log_path && setenv("LXC_CONSOLE_LOGPATH", conf->console.log_path, 1)) { SYSERROR("failed to set environment variable for console log"); } + if (setenv("LXC_CGNS_AWARE", "1", 1)) { + SYSERROR("failed to set LXC_CGNS_AWARE environment variable"); + } /* End of environment variable setup for hooks */ if (run_lxc_hooks(name, "pre-start", conf, handler->lxcpath, NULL)) {