Skip to content

Freezer controller "doesn't exist" in v2 cgroup #124

@aviramha

Description

@aviramha

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()?;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions