Merge pull request #5328 from crosbymichael/refactor-cgroups

Refactor cgroups into subsystems and support metrics
This commit is contained in:
Guillaume J. Charmes 2014-04-21 14:06:17 -07:00
commit a10479fef7
1 changed files with 7 additions and 1 deletions

View File

@ -8,6 +8,8 @@ import (
"syscall" "syscall"
"github.com/dotcloud/docker/pkg/cgroups" "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"
"github.com/dotcloud/docker/pkg/libcontainer/network" "github.com/dotcloud/docker/pkg/libcontainer/network"
"github.com/dotcloud/docker/pkg/system" "github.com/dotcloud/docker/pkg/system"
@ -99,7 +101,11 @@ func (ns *linuxNs) Exec(container *libcontainer.Container, term Terminal, args [
func (ns *linuxNs) SetupCgroups(container *libcontainer.Container, nspid int) (cgroups.ActiveCgroup, error) { func (ns *linuxNs) SetupCgroups(container *libcontainer.Container, nspid int) (cgroups.ActiveCgroup, error) {
if container.Cgroups != nil { if container.Cgroups != nil {
return container.Cgroups.Apply(nspid) c := container.Cgroups
if systemd.UseSystemd() {
return systemd.Apply(c, nspid)
}
return fs.Apply(c, nspid)
} }
return nil, nil return nil, nil
} }