Merge pull request #192 from fabiokung/cgroup-per-container

container id is the cgroup name
This commit is contained in:
Alexander Morozov 2015-08-10 20:40:57 -07:00
commit 15c709ed73
3 changed files with 6 additions and 6 deletions

View File

@ -32,7 +32,7 @@ var restoreCommand = cli.Command{
if err != nil {
fatal(err)
}
config, err := createLibcontainerConfig(spec)
config, err := createLibcontainerConfig(context.GlobalString("id"), spec)
if err != nil {
fatal(err)
}

2
run.go
View File

@ -26,7 +26,7 @@ func init() {
}
func execContainer(context *cli.Context, spec *specs.LinuxSpec) (int, error) {
config, err := createLibcontainerConfig(spec)
config, err := createLibcontainerConfig(context.GlobalString("id"), spec)
if err != nil {
return -1, err
}

View File

@ -176,7 +176,7 @@ func checkSpecVersion(s *specs.LinuxSpec) error {
return nil
}
func createLibcontainerConfig(spec *specs.LinuxSpec) (*configs.Config, error) {
func createLibcontainerConfig(cgroupName string, spec *specs.LinuxSpec) (*configs.Config, error) {
cwd, err := os.Getwd()
if err != nil {
return nil, err
@ -215,7 +215,7 @@ func createLibcontainerConfig(spec *specs.LinuxSpec) (*configs.Config, error) {
if err := setupUserNamespace(spec, config); err != nil {
return nil, err
}
c, err := createCgroupConfig(spec, config.Devices)
c, err := createCgroupConfig(cgroupName, spec, config.Devices)
if err != nil {
return nil, err
}
@ -250,13 +250,13 @@ func createLibcontainerMount(cwd string, m specs.Mount) *configs.Mount {
}
}
func createCgroupConfig(spec *specs.LinuxSpec, devices []*configs.Device) (*configs.Cgroup, error) {
func createCgroupConfig(name string, spec *specs.LinuxSpec, devices []*configs.Device) (*configs.Cgroup, error) {
myCgroupPath, err := cgroups.GetThisCgroupDir("devices")
if err != nil {
return nil, err
}
c := &configs.Cgroup{
Name: getDefaultID(),
Name: name,
Parent: myCgroupPath,
AllowedDevices: append(devices, allowedDevices...),
}