summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-10-12 21:58:09 +0200
committerGitHub <noreply@github.com>2021-10-12 21:58:09 +0200
commit97c74f35a130ea512af2572e6dad43971d14e827 (patch)
tree237b48e1873805bf57dd1d46129080e832b28f5b
parentc90beedbe160eb6e8094b492091231f3c5838006 (diff)
parent9042520cfd40cd73c45022d1e3af3cb80157b22a (diff)
downloadpodman-97c74f35a130ea512af2572e6dad43971d14e827.tar.gz
podman-97c74f35a130ea512af2572e6dad43971d14e827.tar.bz2
podman-97c74f35a130ea512af2572e6dad43971d14e827.zip
Merge pull request #11935 from giuseppe/use-cgroup-controllers
cgroups: use cgroup.controllers to read controllers
-rw-r--r--pkg/cgroups/cgroups.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/pkg/cgroups/cgroups.go b/pkg/cgroups/cgroups.go
index 4bb8de69b..f1ef538e4 100644
--- a/pkg/cgroups/cgroups.go
+++ b/pkg/cgroups/cgroups.go
@@ -129,8 +129,8 @@ func init() {
func getAvailableControllers(exclude map[string]controllerHandler, cgroup2 bool) ([]controller, error) {
if cgroup2 {
controllers := []controller{}
- subtreeControl := cgroupRoot + "/cgroup.subtree_control"
- // rootless cgroupv2: check available controllers for current user ,systemd or servicescope will inherit
+ controllersFile := cgroupRoot + "/cgroup.controllers"
+ // rootless cgroupv2: check available controllers for current user, systemd or servicescope will inherit
if rootless.IsRootless() {
userSlice, err := getCgroupPathForCurrentProcess()
if err != nil {
@@ -138,13 +138,13 @@ func getAvailableControllers(exclude map[string]controllerHandler, cgroup2 bool)
}
//userSlice already contains '/' so not adding here
basePath := cgroupRoot + userSlice
- subtreeControl = fmt.Sprintf("%s/cgroup.subtree_control", basePath)
+ controllersFile = fmt.Sprintf("%s/cgroup.controllers", basePath)
}
- subtreeControlBytes, err := ioutil.ReadFile(subtreeControl)
+ controllersFileBytes, err := ioutil.ReadFile(controllersFile)
if err != nil {
- return nil, errors.Wrapf(err, "failed while reading controllers for cgroup v2 from %q", subtreeControl)
+ return nil, errors.Wrapf(err, "failed while reading controllers for cgroup v2 from %q", controllersFile)
}
- for _, controllerName := range strings.Fields(string(subtreeControlBytes)) {
+ for _, controllerName := range strings.Fields(string(controllersFileBytes)) {
c := controller{
name: controllerName,
symlink: false,