[lxc-devel] [lxd/master] container_lxc: use lxc.mount.auto shmounts: option
brauner on Github
lxc-bot at linuxcontainers.org
Tue Oct 30 13:39:42 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 497 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20181030/9f95995d/attachment.bin>
-------------- next part --------------
From 0107ac893323d7615a733023b0edde87e67485c3 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Tue, 30 Oct 2018 14:37:00 +0100
Subject: [PATCH] container_lxc: use lxc.mount.auto shmounts: option
Let's use the dedicated shmouts option for lxc.mount.auto mounts in
liblxc.
Needed-by: https://github.com/lxc/lxd/issues/5227
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
lxd/container_lxc.go | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go
index 76e4759c16..0cfc7bb705 100644
--- a/lxd/container_lxc.go
+++ b/lxd/container_lxc.go
@@ -1728,7 +1728,13 @@ func (c *containerLXC) initLXC(config bool) error {
}
// Setup shmounts
- err = lxcSetConfigItem(cc, "lxc.mount.entry", fmt.Sprintf("%s dev/.lxd-mounts none bind,create=dir 0 0", c.ShmountsPath()))
+ if (lxc.HasApiExtension("mount_injection") || util.RuntimeLiblxcVersionAtLeast(3, 1, 0)) {
+ err = lxcSetConfigItem(cc, "lxc.mount.auto", fmt.Sprintf("shmounts:%s:/dev/.lxd-mounts", c.ShmountsPath()))
+ logger.Debugf("Using new \"mount_injection\" extension")
+ } else {
+ err = lxcSetConfigItem(cc, "lxc.mount.entry", fmt.Sprintf("%s dev/.lxd-mounts none bind,create=dir 0 0", c.ShmountsPath()))
+ logger.Debugf("Using legacy mount injection")
+ }
if err != nil {
return err
}
More information about the lxc-devel
mailing list