mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-04 10:24:37 +00:00
runtime: fix cgroupv2 deletion when sandbox_cgroup_only=false
Currently, when a new sandbox resource controller is created with cgroupsv2 and sandbox_cgroup_only is disabled, the cgroup management falls back to cgroupfs. During deletion, `IsSystemdCgroup` checks if the path contains `:` and tries to delete the cgroup via systemd. However, the cgroup was originally set up via cgroupfs and this process fails with `lstat /sys/fs/cgroup/kubepods.slice/kubepods-besteffort.slice/....scope: no such file or directory`. This patch updates the deletion logic to take in to account the sandbox_cgroup_only=false option and in this case uses the cgroupfs delete. Fixes: #11036 Signed-off-by: Champ-Goblem <cameron@northflank.com>
This commit is contained in:
committed by
Fabiano Fidêncio
parent
3f5dc87284
commit
ef642fe890
@@ -2540,14 +2540,16 @@ func (s *Sandbox) resourceControllerDelete() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
sandboxController, err := resCtrl.LoadResourceController(s.state.SandboxCgroupPath)
|
||||
sandboxController, err := resCtrl.LoadResourceController(s.state.SandboxCgroupPath, s.config.SandboxCgroupOnly)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
resCtrlParent := sandboxController.Parent()
|
||||
if err := sandboxController.MoveTo(resCtrlParent); err != nil {
|
||||
return err
|
||||
if resCtrlParent != "." {
|
||||
if err := sandboxController.MoveTo(resCtrlParent); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if err := sandboxController.Delete(); err != nil {
|
||||
@@ -2555,7 +2557,7 @@ func (s *Sandbox) resourceControllerDelete() error {
|
||||
}
|
||||
|
||||
if s.state.OverheadCgroupPath != "" {
|
||||
overheadController, err := resCtrl.LoadResourceController(s.state.OverheadCgroupPath)
|
||||
overheadController, err := resCtrl.LoadResourceController(s.state.OverheadCgroupPath, s.config.SandboxCgroupOnly)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user