Repository: Azure/WALinuxAgent
Pull request #2685 (2022-10-17 21:35:19)

drop cgroup support for rhel
<!-- DO NOT DELETE THIS TEMPLATE -->

## Description

CX reported the waagent hang issue https://github.com/Azure/WALinuxAgent/issues/2674. RHEL team suspecting that Kernel bug in implementation of cgroups. Since the agent uses cgroups for resource governance, dropping the rhel support to be cautious and avoid potential widespread.
  
Issue # <!-- if any -->
<!--
Please add an informative description that covers that changes made by the pull request. 
This checklist is used to make sure that common issues in a pull request are addressed.
This will expedite the process of getting your pull request merged and avoid extra work on your part to fix issues discovered during the review process.
-->

---

### PR information
- [ ] The title of the PR is clear and informative.
- [ ] There are a small number of commits, each of which has an informative message. This means that previously merged commits do not appear in the history of the PR. For information on cleaning up the commits in your pull request, [see this page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md).
- [ ] If applicable, the PR references the bug/issue that it fixes in the description.
- [ ] New Unit tests were added for the changes made

### Quality of Code and Contribution Guidelines
- [ ] I have read the [contribution guidelines](https://github.com/Azure/WALinuxAgent/blob/master/.github/CONTRIBUTING.md).


Patch:
diff --git a/azurelinuxagent/common/cgroupapi.py b/azurelinuxagent/common/cgroupapi.py
index 2935e251..d7040747 100644
--- a/azurelinuxagent/common/cgroupapi.py
+++ b/azurelinuxagent/common/cgroupapi.py
@@ -60,7 +60,7 @@ class CGroupsApi(object):
         except ValueError:
             return False
         return ((distro_name.lower() == 'ubuntu' and distro_version.major >= 16) or
-                (distro_name.lower() in ("centos", "redhat") and
+                (distro_name.lower() == "centos" and
                  ((distro_version.major == 7 and distro_version.minor >= 4) or distro_version.major >= 8)))
 
     @staticmethod


Test patch:
diff --git a/tests/common/test_cgroupapi.py b/tests/common/test_cgroupapi.py
index 3b70214d..ca380ed2 100644
--- a/tests/common/test_cgroupapi.py
+++ b/tests/common/test_cgroupapi.py
@@ -57,13 +57,13 @@ class CGroupsApiTestCase(_MockedFileSystemTestCase):
             (['ubuntu', '20.04', 'focal'], True),
             (['ubuntu', '20.10', 'groovy'], True),
             (['centos', '7.8', 'Source'], True),
-            (['redhat', '7.8', 'Maipo'], True),
-            (['redhat', '7.9.1908', 'Core'], True),
+            (['redhat', '7.8', 'Maipo'], False),
+            (['redhat', '7.9.1908', 'Core'], False),
             (['centos', '8.1', 'Source'], True),
-            (['redhat', '8.2', 'Maipo'], True),
-            (['redhat', '8.2.2111', 'Core'], True),
+            (['redhat', '8.2', 'Maipo'], False),
+            (['redhat', '8.2.2111', 'Core'], False),
             (['centos', '7.4', 'Source'], True),
-            (['redhat', '7.4', 'Maipo'], True),
+            (['redhat', '7.4', 'Maipo'], False),
             (['centos', '7.5', 'Source'], True),
             (['centos', '7.3', 'Maipo'], False),
             (['redhat', '7.2', 'Maipo'], False),