[lxc-devel] [lxd/master] Update lxc.mount.auto based on situation
stgraber on Github
lxc-bot at linuxcontainers.org
Wed Feb 24 18:42:16 UTC 2016
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160224/8e07c199/attachment.bin>
-------------- next part --------------
From 1373eae0dc7cf1c4638be6a0f9e0ed6809c17441 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 24 Feb 2016 13:41:45 -0500
Subject: [PATCH] Update lxc.mount.auto based on situation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/container_lxc.go | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go
index 08fd352..f2a8dd2 100644
--- a/lxd/container_lxc.go
+++ b/lxd/container_lxc.go
@@ -285,7 +285,21 @@ func (c *containerLXC) initLXC() error {
return err
}
- err = lxcSetConfigItem(cc, "lxc.mount.auto", "cgroup:mixed proc:mixed sys:mixed")
+ // Set an appropriate /proc, /sys/ and /sys/fs/cgroup
+ mounts := []string{}
+ if c.IsPrivileged() && !runningInUserns {
+ mounts = append(mounts, "proc:mixed")
+ mounts = append(mounts, "sys:mixed")
+ } else {
+ mounts = append(mounts, "proc:rw")
+ mounts = append(mounts, "sys:rw")
+ }
+
+ if !shared.PathExists("/proc/self/ns/cgroup") {
+ mounts = append(mounts, "cgroup:mixed")
+ }
+
+ err = lxcSetConfigItem(cc, "lxc.mount.auto", strings.Join(mounts, " "))
if err != nil {
return err
}
More information about the lxc-devel
mailing list