summaryrefslogtreecommitdiff
path: root/libpod/container_internal.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-03-21 11:28:16 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-05-11 14:43:57 +0000
commitdf83d361e4fe3c1fc1939b096cb21aa2e7ec3d74 (patch)
tree3f4bb6dba3763a5895135fadecc005eeb0ea96ca /libpod/container_internal.go
parentfee9ec18584bcc31ce4889bdbda2fc2a829eaf5f (diff)
downloadpodman-df83d361e4fe3c1fc1939b096cb21aa2e7ec3d74.tar.gz
podman-df83d361e4fe3c1fc1939b096cb21aa2e7ec3d74.tar.bz2
podman-df83d361e4fe3c1fc1939b096cb21aa2e7ec3d74.zip
Major fixes to systemd cgroup handling
Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #507 Approved by: baude
Diffstat (limited to 'libpod/container_internal.go')
-rw-r--r--libpod/container_internal.go18
1 files changed, 13 insertions, 5 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 644598322..1098dc66c 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -7,6 +7,7 @@ import (
"io"
"io/ioutil"
"os"
+ "path"
"path/filepath"
"regexp"
"strings"
@@ -1128,12 +1129,19 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) {
g.AddProcessEnv("container", "libpod")
}
- cgroupPath, err := c.CGroupPath()("")
- if err != nil {
- return nil, errors.Wrapf(err, "error retrieving CGroup path for container %s", c.ID())
+ if c.runtime.config.CgroupManager == SystemdCgroupsManager {
+ // When runc is set to use Systemd as a cgroup manager, it
+ // expects cgroups to be passed as follows:
+ // slice:prefix:name
+ g.SetLinuxCgroupsPath(path.Base(c.config.CgroupParent) + ":" + "libpod" + ":" + c.ID())
+ } else {
+ cgroupPath, err := c.CGroupPath()
+ if err != nil {
+ return nil, err
+ }
+ logrus.Debugf("Setting CGroup path for container %s to %s", c.ID(), cgroupPath)
+ g.SetLinuxCgroupsPath(cgroupPath)
}
- logrus.Debugf("Setting CGroup path for container %s to %s", c.ID(), cgroupPath)
- g.SetLinuxCgroupsPath(cgroupPath)
return g.Spec(), nil
}