Merge pull request #1009 from hqhq/fix_default_cgroup_parent
Fix default cgroup path
This commit is contained in:
commit
b79076544e
|
@ -12,7 +12,6 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/opencontainers/runc/libcontainer/cgroups"
|
|
||||||
"github.com/opencontainers/runc/libcontainer/configs"
|
"github.com/opencontainers/runc/libcontainer/configs"
|
||||||
"github.com/opencontainers/runc/libcontainer/seccomp"
|
"github.com/opencontainers/runc/libcontainer/seccomp"
|
||||||
libcontainerUtils "github.com/opencontainers/runc/libcontainer/utils"
|
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) {
|
func createCgroupConfig(name string, useSystemdCgroup bool, spec *specs.Spec) (*configs.Cgroup, error) {
|
||||||
var (
|
var myCgroupPath string
|
||||||
err error
|
|
||||||
myCgroupPath string
|
|
||||||
)
|
|
||||||
|
|
||||||
c := &configs.Cgroup{
|
c := &configs.Cgroup{
|
||||||
Resources: &configs.Resources{},
|
Resources: &configs.Resources{},
|
||||||
|
@ -287,11 +283,7 @@ func createCgroupConfig(name string, useSystemdCgroup bool, spec *specs.Spec) (*
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if myCgroupPath == "" {
|
if myCgroupPath == "" {
|
||||||
myCgroupPath, err = cgroups.GetThisCgroupDir("devices")
|
c.Name = name
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
myCgroupPath = filepath.Join(myCgroupPath, name)
|
|
||||||
}
|
}
|
||||||
c.Path = myCgroupPath
|
c.Path = myCgroupPath
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
package specconv
|
package specconv
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/opencontainers/runtime-spec/specs-go"
|
"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)
|
t.Errorf("Couldn't create Cgroup config: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !strings.HasSuffix(cgroup.Path, "/ContainerID") {
|
if cgroup.Path != "" {
|
||||||
t.Errorf("Wrong cgroupsPath, expected it to have suffix '%s' got '%s'", "/ContainerID", cgroup.Path)
|
t.Errorf("Wrong cgroupsPath, expected it to be empty string, got '%s'", cgroup.Path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue