Repository: Azure/WALinuxAgent
Pull request #2697 (2022-11-03 20:57:16)

drop cgroup support for centos (#2689)
(cherry picked from commit 2fa01e53c5de85c831e2cf01ae39113ac643f164)

<!-- DO NOT DELETE THIS TEMPLATE -->

## Description

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 d7040747..66e893ef 100644
--- a/azurelinuxagent/common/cgroupapi.py
+++ b/azurelinuxagent/common/cgroupapi.py
@@ -59,9 +59,7 @@ class CGroupsApi(object):
             distro_version = FlexibleVersion(distro_info[1])
         except ValueError:
             return False
-        return ((distro_name.lower() == 'ubuntu' and distro_version.major >= 16) or
-                (distro_name.lower() == "centos" and
-                 ((distro_version.major == 7 and distro_version.minor >= 4) or distro_version.major >= 8)))
+        return distro_name.lower() == 'ubuntu' and distro_version.major >= 16
 
     @staticmethod
     def track_cgroups(extension_cgroups):


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