diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2018-03-21 11:28:16 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-05-11 14:43:57 +0000 |
commit | df83d361e4fe3c1fc1939b096cb21aa2e7ec3d74 (patch) | |
tree | 3f4bb6dba3763a5895135fadecc005eeb0ea96ca /libpod/container.go | |
parent | fee9ec18584bcc31ce4889bdbda2fc2a829eaf5f (diff) | |
download | podman-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.go')
-rw-r--r-- | libpod/container.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libpod/container.go b/libpod/container.go index 40e670300..6a48363c9 100644 --- a/libpod/container.go +++ b/libpod/container.go @@ -6,7 +6,6 @@ import ( "path/filepath" "time" - "github.com/containerd/cgroups" "github.com/containernetworking/cni/pkg/types" cnitypes "github.com/containernetworking/cni/pkg/types/current" "github.com/containernetworking/plugins/pkg/ns" @@ -854,9 +853,15 @@ func (c *Container) NamespacePath(ns LinuxNS) (string, error) { } // CGroupPath returns a cgroups "path" for a given container. -func (c *Container) CGroupPath() cgroups.Path { - // TODO add support for systemd cgroup paths - return cgroups.StaticPath(filepath.Join(c.config.CgroupParent, fmt.Sprintf("libpod-conmon-%s", c.ID()))) +func (c *Container) CGroupPath() (string, error) { + switch c.runtime.config.CgroupManager { + case CgroupfsCgroupsManager: + return filepath.Join(c.config.CgroupParent, fmt.Sprintf("libpod-conmon-%s", c.ID())), nil + case SystemdCgroupsManager: + return filepath.Join(c.config.CgroupParent, createUnitName("libpod", c.ID())), nil + default: + return "", errors.Wrapf(ErrInvalidArg, "unsupported CGroup manager %s in use", c.runtime.config.CgroupManager) + } } // RootFsSize returns the root FS size of the container |