From 956cdea49f56b22a9be5a50587425cb2b2240023 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Fri, 18 Apr 2014 21:14:58 -0700 Subject: [PATCH 1/3] Refactor cgroups file locations Docker-DCO-1.1-Signed-off-by: Michael Crosby (github: crosbymichael) --- nsinit/exec.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nsinit/exec.go b/nsinit/exec.go index c07c45de..4e2fcefd 100644 --- a/nsinit/exec.go +++ b/nsinit/exec.go @@ -99,7 +99,7 @@ func (ns *linuxNs) Exec(container *libcontainer.Container, term Terminal, args [ func (ns *linuxNs) SetupCgroups(container *libcontainer.Container, nspid int) (cgroups.ActiveCgroup, error) { if container.Cgroups != nil { - return container.Cgroups.Apply(nspid) + return cgroups.Apply(container.Cgroups, nspid) } return nil, nil } From 21d9b9a86a1ad6f668999a353dbeeda868047eb6 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Fri, 18 Apr 2014 21:30:08 -0700 Subject: [PATCH 2/3] Move systemd code into pkg Docker-DCO-1.1-Signed-off-by: Michael Crosby (github: crosbymichael) --- nsinit/exec.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nsinit/exec.go b/nsinit/exec.go index 4e2fcefd..7a315d6f 100644 --- a/nsinit/exec.go +++ b/nsinit/exec.go @@ -8,6 +8,7 @@ import ( "syscall" "github.com/dotcloud/docker/pkg/cgroups" + "github.com/dotcloud/docker/pkg/cgroups/systemd" "github.com/dotcloud/docker/pkg/libcontainer" "github.com/dotcloud/docker/pkg/libcontainer/network" "github.com/dotcloud/docker/pkg/system" @@ -99,7 +100,11 @@ func (ns *linuxNs) Exec(container *libcontainer.Container, term Terminal, args [ func (ns *linuxNs) SetupCgroups(container *libcontainer.Container, nspid int) (cgroups.ActiveCgroup, error) { if container.Cgroups != nil { - return cgroups.Apply(container.Cgroups, nspid) + c := container.Cgroups + if systemd.UseSystemd() { + return systemd.Apply(c, nspid) + } + return rawApply(c, nspid) } return nil, nil } From ad442c6e36a8abb628baed8ca6e98c07cdb4dc13 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Fri, 18 Apr 2014 21:34:26 -0700 Subject: [PATCH 3/3] Move raw cgroups into fs package (filesystem) Docker-DCO-1.1-Signed-off-by: Michael Crosby (github: crosbymichael) --- nsinit/exec.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nsinit/exec.go b/nsinit/exec.go index 7a315d6f..e76e060d 100644 --- a/nsinit/exec.go +++ b/nsinit/exec.go @@ -8,6 +8,7 @@ import ( "syscall" "github.com/dotcloud/docker/pkg/cgroups" + "github.com/dotcloud/docker/pkg/cgroups/fs" "github.com/dotcloud/docker/pkg/cgroups/systemd" "github.com/dotcloud/docker/pkg/libcontainer" "github.com/dotcloud/docker/pkg/libcontainer/network" @@ -104,7 +105,7 @@ func (ns *linuxNs) SetupCgroups(container *libcontainer.Container, nspid int) (c if systemd.UseSystemd() { return systemd.Apply(c, nspid) } - return rawApply(c, nspid) + return fs.Apply(c, nspid) } return nil, nil }