diff --git a/restore.go b/restore.go index fc86e3f5..a96ff329 100644 --- a/restore.go +++ b/restore.go @@ -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) } diff --git a/run.go b/run.go index b09c1fbf..14dd8744 100644 --- a/run.go +++ b/run.go @@ -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 } diff --git a/spec.go b/spec.go index 3ea3e323..444bc625 100644 --- a/spec.go +++ b/spec.go @@ -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...), }