From 4a8f0b4db492960370584a5d72599eac1e0335b1 Mon Sep 17 00:00:00 2001 From: Mrunal Patel Date: Wed, 2 Mar 2016 11:35:52 -0800 Subject: [PATCH] Fix cgroup Set when Paths are specified Signed-off-by: Mrunal Patel --- libcontainer/cgroups/fs/apply_raw.go | 5 +++++ libcontainer/cgroups/systemd/apply_systemd.go | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/libcontainer/cgroups/fs/apply_raw.go b/libcontainer/cgroups/fs/apply_raw.go index c3cfb036c..09cad9d1f 100644 --- a/libcontainer/cgroups/fs/apply_raw.go +++ b/libcontainer/cgroups/fs/apply_raw.go @@ -190,6 +190,11 @@ func (m *Manager) GetStats() (*cgroups.Stats, error) { } func (m *Manager) Set(container *configs.Config) error { + // If Paths are set, then we are just joining cgroups paths + // and there is no need to set any values. + if m.Cgroups.Paths != nil { + return nil + } for _, sys := range subsystems { // Generate fake cgroup data. d, err := getCgroupData(container.Cgroups, -1) diff --git a/libcontainer/cgroups/systemd/apply_systemd.go b/libcontainer/cgroups/systemd/apply_systemd.go index dbf760ad9..c135af84a 100644 --- a/libcontainer/cgroups/systemd/apply_systemd.go +++ b/libcontainer/cgroups/systemd/apply_systemd.go @@ -437,6 +437,11 @@ func (m *Manager) GetStats() (*cgroups.Stats, error) { } func (m *Manager) Set(container *configs.Config) error { + // If Paths are set, then we are just joining cgroups paths + // and there is no need to set any values. + if m.Cgroups.Paths != nil { + return nil + } for _, sys := range subsystems { // Get the subsystem path, but don't error out for not found cgroups. path, err := getSubsystemPath(container.Cgroups, sys.Name())