diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2018-01-11 15:22:32 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-01-16 14:58:06 +0000 |
commit | 2ac4192bd3674577c6ab51d6d53a16cb291d0196 (patch) | |
tree | 00945a7241e05fe81d8b18936f05cd52a22fcca5 /libpod/container.go | |
parent | fe0e1cd11bd1d98c7687a58011746f6b189c8d67 (diff) | |
download | podman-2ac4192bd3674577c6ab51d6d53a16cb291d0196.tar.gz podman-2ac4192bd3674577c6ab51d6d53a16cb291d0196.tar.bz2 podman-2ac4192bd3674577c6ab51d6d53a16cb291d0196.zip |
Add support for shared CGroup namespaces
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Closes: #220
Approved by: rhatdan
Diffstat (limited to 'libpod/container.go')
-rw-r--r-- | libpod/container.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libpod/container.go b/libpod/container.go index 89b042d12..7003396ac 100644 --- a/libpod/container.go +++ b/libpod/container.go @@ -81,6 +81,8 @@ const ( UserNS LinuxNS = iota // UTSNS is the UTS namespace UTSNS LinuxNS = iota + // CgroupNS is the CGroup namespace + CgroupNS LinuxNS = iota ) // String returns a string representation of a Linux namespace @@ -101,6 +103,8 @@ func (ns LinuxNS) String() string { return "user" case UTSNS: return "uts" + case CgroupNS: + return "cgroup" default: return "unknown" } @@ -920,6 +924,21 @@ func (c *Container) Init() (err error) { return err } } + if c.config.CgroupNsCtr != "" { + cgroupCtr, err := c.runtime.state.Container(c.config.CgroupNsCtr) + if err != nil { + return err + } + + nsPath, err := cgroupCtr.NamespacePath(CgroupNS) + if err != nil { + return err + } + + if err := g.AddOrReplaceLinuxNamespace(spec.CgroupNamespace, nsPath); err != nil { + return err + } + } c.runningSpec = g.Spec() c.runningSpec.Root.Path = c.state.Mountpoint |