Merge pull request #1009 from hqhq/fix_default_cgroup_parent

Fix default cgroup path
This commit is contained in:
Mrunal Patel 2016-08-31 14:23:14 -07:00 committed by GitHub
commit b79076544e
2 changed files with 4 additions and 13 deletions

View File

@ -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
}

View File

@ -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)
}
}