runc: compatibility with cpuset mounted with 'noprefix' option

This commit is contained in:
Leonid Plyushch 2019-07-14 15:33:33 +03:00 committed by Yaksh Bariya
parent d26ef80d91
commit 829ec08dd9
No known key found for this signature in database
GPG Key ID: F7486BA7D3D27581
1 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,46 @@
diff -uNr runc-1.0.0-rc8/libcontainer/cgroups/fs/cpuset.go runc-1.0.0-rc8.mod/libcontainer/cgroups/fs/cpuset.go
--- runc-1.0.0-rc8/libcontainer/cgroups/fs/cpuset.go 2019-04-25 00:48:25.000000000 +0300
+++ runc-1.0.0-rc8.mod/libcontainer/cgroups/fs/cpuset.go 2019-07-14 14:25:08.973734249 +0300
@@ -31,12 +31,12 @@
func (s *CpusetGroup) Set(path string, cgroup *configs.Cgroup) error {
if cgroup.Resources.CpusetCpus != "" {
- if err := writeFile(path, "cpuset.cpus", cgroup.Resources.CpusetCpus); err != nil {
+ if err := writeFile(path, "cpus", cgroup.Resources.CpusetCpus); err != nil {
return err
}
}
if cgroup.Resources.CpusetMems != "" {
- if err := writeFile(path, "cpuset.mems", cgroup.Resources.CpusetMems); err != nil {
+ if err := writeFile(path, "mems", cgroup.Resources.CpusetMems); err != nil {
return err
}
}
@@ -88,10 +88,10 @@
}
func (s *CpusetGroup) getSubsystemSettings(parent string) (cpus []byte, mems []byte, err error) {
- if cpus, err = ioutil.ReadFile(filepath.Join(parent, "cpuset.cpus")); err != nil {
+ if cpus, err = ioutil.ReadFile(filepath.Join(parent, "cpus")); err != nil {
return
}
- if mems, err = ioutil.ReadFile(filepath.Join(parent, "cpuset.mems")); err != nil {
+ if mems, err = ioutil.ReadFile(filepath.Join(parent, "mems")); err != nil {
return
}
return cpus, mems, nil
@@ -135,12 +135,12 @@
}
if s.isEmpty(currentCpus) {
- if err := writeFile(current, "cpuset.cpus", string(parentCpus)); err != nil {
+ if err := writeFile(current, "cpus", string(parentCpus)); err != nil {
return err
}
}
if s.isEmpty(currentMems) {
- if err := writeFile(current, "cpuset.mems", string(parentMems)); err != nil {
+ if err := writeFile(current, "mems", string(parentMems)); err != nil {
return err
}
}