forked from levex/cgroups-rs
-
Notifications
You must be signed in to change notification settings - Fork 61
Freezer controller "doesn't exist" in v2 cgroup #124
Copy link
Copy link
Open
Labels
Description
Describe the bug
Creating a cgroup with the freezer controller on v2 hierarchy fails with error
Error { kind: SpecifiedControllers, cause: None }
Expected behavior
It should succeed
Additional context
The freezer controller isn't mentioned in the cgroups file anymore, but is still available if accessing /sys/fs/cgroup/cgroup.freeze
I guess the API needs to be altered and can't be same for v1/v2?
let hierarchy = cgroups_rs::hierarchies::auto();
// get pids of all processes in the root cgroup
let root_process_cgroup = cgroups_rs::Cgroup::load(hierarchy, "/proc/1/sys/fs/cgroup");
let root_pids = root_process_cgroup.procs();
let hierarchy = cgroups_rs::hierarchies::auto();
// create new cgroup with freezer only, add this procs - this might exist from previous runs
// of mirrord.
let cgroup = cgroups_rs::Cgroup::new_with_specified_controllers(
hierarchy,
MIRRORD_CGROUP_PATH,
Some(vec!["freezer".to_string()]),
)?; // fails here
for pid in root_pids {
cgroup.add_task(pid)?;
}
let freezer_controller: &FreezerController = cgroup
.controller_of()
.ok_or(AgentError::PauseFailedCgroupFreezerNotFound)?;
freezer_controller.freeze()?;Reactions are currently unavailable