diff --git a/libcontainer/specconv/spec_linux.go b/libcontainer/specconv/spec_linux.go index 856371c6..2dfd8b5d 100644 --- a/libcontainer/specconv/spec_linux.go +++ b/libcontainer/specconv/spec_linux.go @@ -12,7 +12,6 @@ import ( "syscall" "time" - "github.com/opencontainers/runc/libcontainer/cgroups" "github.com/opencontainers/runc/libcontainer/configs" "github.com/opencontainers/runc/libcontainer/seccomp" libcontainerUtils "github.com/opencontainers/runc/libcontainer/utils" @@ -253,10 +252,7 @@ func createLibcontainerMount(cwd string, m specs.Mount) *configs.Mount { } func createCgroupConfig(name string, useSystemdCgroup bool, spec *specs.Spec) (*configs.Cgroup, error) { - var ( - err error - myCgroupPath string - ) + var myCgroupPath string c := &configs.Cgroup{ Resources: &configs.Resources{}, @@ -287,11 +283,7 @@ func createCgroupConfig(name string, useSystemdCgroup bool, spec *specs.Spec) (* } } else { if myCgroupPath == "" { - myCgroupPath, err = cgroups.GetThisCgroupDir("devices") - if err != nil { - return nil, err - } - myCgroupPath = filepath.Join(myCgroupPath, name) + c.Name = name } c.Path = myCgroupPath } diff --git a/libcontainer/specconv/spec_linux_test.go b/libcontainer/specconv/spec_linux_test.go index 3b7c6b78..a4c4495e 100644 --- a/libcontainer/specconv/spec_linux_test.go +++ b/libcontainer/specconv/spec_linux_test.go @@ -3,7 +3,6 @@ package specconv import ( - "strings" "testing" "github.com/opencontainers/runtime-spec/specs-go" @@ -33,7 +32,7 @@ func TestLinuxCgroupsPathNotSpecified(t *testing.T) { t.Errorf("Couldn't create Cgroup config: %v", err) } - if !strings.HasSuffix(cgroup.Path, "/ContainerID") { - t.Errorf("Wrong cgroupsPath, expected it to have suffix '%s' got '%s'", "/ContainerID", cgroup.Path) + if cgroup.Path != "" { + t.Errorf("Wrong cgroupsPath, expected it to be empty string, got '%s'", cgroup.Path) } }