Skip to content

Commit 54e2021

Browse files
committed
libctr/cgroups: don't take init's cgroup into account
Sometimes, the init process is not in the root cgroup. This can be noted by GetInitPath, which already scrubs the path of `init.scope`. This was encountered when trying to patch the Kubelet to handle systemd being in a separate cpuset from root (to allow load balance disabling for containers). At present, there's no way to have libcontainer or runc manage cgroups in a hierarchy outside of the one init is in (unless the path contains `init.scope`, which is limiting) Signed-off-by: Peter Hunt <pehunt@redhat.com>
1 parent da5047c commit 54e2021

File tree

1 file changed

+1
-8
lines changed
  • libcontainer/cgroups/systemd

1 file changed

+1
-8
lines changed

libcontainer/cgroups/systemd/v1.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -271,14 +271,7 @@ func getSubsystemPath(slice, unit, subsystem string) (string, error) {
271271
return "", err
272272
}
273273

274-
initPath, err := cgroups.GetInitCgroup(subsystem)
275-
if err != nil {
276-
return "", err
277-
}
278-
// if pid 1 is systemd 226 or later, it will be in init.scope, not the root
279-
initPath = strings.TrimSuffix(filepath.Clean(initPath), "init.scope")
280-
281-
return filepath.Join(mountpoint, initPath, slice, unit), nil
274+
return filepath.Join(mountpoint, slice, unit), nil
282275
}
283276

284277
func (m *LegacyManager) Freeze(state configs.FreezerState) error {

0 commit comments

Comments
 (0)