Azure / WALinuxAgent

Microsoft Azure Linux Guest Agent
http://azure.microsoft.com/
Apache License 2.0
535 stars 371 forks source link

[Enancement] Support for CGroups v2 #3136

Open ani-sinha opened 3 months ago

ani-sinha commented 3 months ago

Looking at the code in CGroupConfigurator._Impl.initialize(), it seems WALinuxAgent does not quite support CGroups v2. In __get_cgroup_controllers() we have :

            #                                                                                                                                                                                     
            # check v2 controllers                                                                                                                                                                
            #                                                                                                                                                                                     
            cgroup2_mount_point, cgroup2_controllers = self._cgroups_api.get_cgroup2_controllers()
            if cgroup2_mount_point is not None:
                _log_cgroup_info("cgroups v2 mounted at {0}.  Controllers: [{1}]", cgroup2_mount_point,
                                 cgroup2_controllers)

Then it does not do anything with cgroup2_mount_point etc. __get_cgroup_controllers() returns (None, None) so the following code cpu_controller_root, memory_controller_root = self.__get_cgroup_controllers() makes cpu_controller_root and memory_controller_root both None. This when passed to __get_agent_cgroups() makes the later in turn return (None, None) . Therefore self._agent_cpu_cgroup_path and self._agent_memory_cgroup_path are both None which disabled CGroups support.

This ticket is raised to request support for it. CGroups v2 is default in Centos 9 and above.

maddieford commented 3 months ago

Thanks for raising this @ani-sinha. Development is currently in progress to support v2

sctweedie commented 3 months ago

@maddieford Thanks --- do you have any idea when this might be released?

maddieford commented 3 months ago

The target is to include the initial changes in the next +1 release, but there is no date decided for that release yet. I can post an update here when that release starts.

Please note that the initial changes only add v2 support for the log collector process (this will be opt-in by a flag in waagent.conf). Resource monitoring and enforcement using v2 for the agent and extension processes will come in later releases after the log collector scenario is validated.