Repository: Azure/WALinuxAgent
Pull request #2689 (2022-10-24 18:52:45)

drop cgroup support for centos
<!-- 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).

codecov[bot]: # [Codecov](https://codecov.io/gh/Azure/WALinuxAgent/pull/2689?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure) Report
> Merging [#2689](https://codecov.io/gh/Azure/WALinuxAgent/pull/2689?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure) (a715943) into [release-2.9.0.0](https://codecov.io/gh/Azure/WALinuxAgent/commit/70bb383c8f873d859a6eee6670b014c2599f1787?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure) (70bb383) will **not change** coverage.
> The diff coverage is `100.00%`.

```diff
@@               Coverage Diff                @@
##           release-2.9.0.0    #2689   +/-   ##
================================================
  Coverage            71.98%   71.98%           
================================================
  Files                  103      103           
  Lines                15698    15698           
  Branches              2245     2245           
================================================
  Hits                 11300    11300           
  Misses                3881     3881           
  Partials               517      517           
```


| [Impacted Files](https://codecov.io/gh/Azure/WALinuxAgent/pull/2689?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure) | Coverage Δ | |
|---|---|---|
| [azurelinuxagent/common/cgroupapi.py](https://codecov.io/gh/Azure/WALinuxAgent/pull/2689/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure#diff-YXp1cmVsaW51eGFnZW50L2NvbW1vbi9jZ3JvdXBhcGkucHk=) | `83.79% <100.00%> (ø)` | |

Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure)


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),