From 4673f662d3c92c3a55f504394a9c0dc1fa975b82 Mon Sep 17 00:00:00 2001 From: Sergey Cherevko Date: Wed, 25 Dec 2024 16:58:01 +0300 Subject: [PATCH] Added MSVSphere support --- SOURCES/0001-Add-MSVSphere-support.patch | 83 ++++++++++++++++++++++++ SPECS/WALinuxAgent.spec | 8 ++- 2 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 SOURCES/0001-Add-MSVSphere-support.patch diff --git a/SOURCES/0001-Add-MSVSphere-support.patch b/SOURCES/0001-Add-MSVSphere-support.patch new file mode 100644 index 0000000..e6ada3e --- /dev/null +++ b/SOURCES/0001-Add-MSVSphere-support.patch @@ -0,0 +1,83 @@ +From 152c3669cbc1b87bba2984508e822a429134bcea Mon Sep 17 00:00:00 2001 +From: Sergey Cherevko +Date: Wed, 25 Dec 2024 16:33:05 +0300 +Subject: [PATCH] Add MSVSphere support + +--- + azurelinuxagent/common/osutil/factory.py | 2 +- + azurelinuxagent/pa/rdma/factory.py | 2 +- + setup.py | 6 +++--- + tests/common/osutil/test_factory.py | 7 +++++++ + 4 files changed, 12 insertions(+), 5 deletions(-) + +diff --git a/azurelinuxagent/common/osutil/factory.py b/azurelinuxagent/common/osutil/factory.py +index 83123e3..fba8398 100644 +--- a/azurelinuxagent/common/osutil/factory.py ++++ b/azurelinuxagent/common/osutil/factory.py +@@ -115,7 +115,7 @@ def _get_osutil(distro_name, distro_code_name, distro_version, distro_full_name) + + + if distro_name in ("redhat", "rhel", "centos", "oracle", "almalinux", +- "cloudlinux", "rocky"): ++ "cloudlinux", "rocky", "msvsphere"): + if Version(distro_version) < Version("7"): + return Redhat6xOSUtil() + +diff --git a/azurelinuxagent/pa/rdma/factory.py b/azurelinuxagent/pa/rdma/factory.py +index c114dc3..7495bd7 100644 +--- a/azurelinuxagent/pa/rdma/factory.py ++++ b/azurelinuxagent/pa/rdma/factory.py +@@ -40,7 +40,7 @@ def get_rdma_handler( + + if distro_full_name in ('CentOS Linux', 'CentOS', + 'Red Hat Enterprise Linux Server', 'AlmaLinux', +- 'CloudLinux', 'Rocky Linux'): ++ 'CloudLinux', 'Rocky Linux', 'MSVSphere'): + return CentOSRDMAHandler(distro_version) + + if distro_full_name == 'Ubuntu': +diff --git a/setup.py b/setup.py +index 8f5d92b..94facdc 100755 +--- a/setup.py ++++ b/setup.py +@@ -96,8 +96,8 @@ def get_data_files(name, version, fullname): # pylint: disable=R0912 + systemd_dir_path = osutil.get_systemd_unit_file_install_path() + agent_bin_path = osutil.get_agent_bin_path() + +- if name in ('redhat', 'rhel', 'centos', 'almalinux', 'cloudlinux', 'rocky'): +- if version.startswith("8") or version.startswith("9"): ++ if name in ('redhat', 'rhel', 'centos', 'almalinux', 'cloudlinux', 'rocky', 'msvsphere'): ++ if version.startswith("8") or version.startswith("9") or version.startswith("10"): + # redhat8+ default to py3 + set_bin_files(data_files, dest=agent_bin_path, + src=["bin/py3/waagent", "bin/waagent2.0"]) +@@ -106,7 +106,7 @@ def get_data_files(name, version, fullname): # pylint: disable=R0912 + set_conf_files(data_files) + set_logrotate_files(data_files) + set_udev_files(data_files) +- if version.startswith("8") or version.startswith("9"): ++ if version.startswith("8") or version.startswith("9") or version.startswith("10"): + # redhat 8+ uses systemd and python3 + set_systemd_files(data_files, dest=systemd_dir_path, + src=["init/redhat/waagent.service", +diff --git a/tests/common/osutil/test_factory.py b/tests/common/osutil/test_factory.py +index 7bd729c..3c6339b 100644 +--- a/tests/common/osutil/test_factory.py ++++ b/tests/common/osutil/test_factory.py +@@ -55,6 +55,13 @@ class TestOsUtilFactory(AgentTestCase): + self.assertEqual(patch_logger.call_count, 1) + self.assertEqual(ret.get_service_name(), "waagent") + ++ ret = _get_osutil(distro_name="msvsphere", ++ distro_code_name="", ++ distro_full_name="", ++ distro_version="10") ++ self.assertTrue(isinstance(ret, RedhatOSUtil)) ++ self.assertEqual(ret.get_service_name(), "waagent") ++ + def test_get_osutil_it_should_return_ubuntu(self): + ret = _get_osutil(distro_name="ubuntu", + distro_code_name="", +-- +2.43.5 + diff --git a/SPECS/WALinuxAgent.spec b/SPECS/WALinuxAgent.spec index 50555bb..b26a8ac 100644 --- a/SPECS/WALinuxAgent.spec +++ b/SPECS/WALinuxAgent.spec @@ -3,7 +3,7 @@ Name: WALinuxAgent Version: 2.9.1.1 -Release: 7%{?dist} +Release: 7%{?dist}.inferit Summary: The Microsoft Azure Linux Agent License: Apache-2.0 @@ -18,7 +18,8 @@ Patch2: wla-Disable-automatic-log-collector.patch Patch3: wla-redhat-Use-NetworkManager-to-set-DHCP-hostnames-on-r.patch # For RHEL-46713 - [Azure][RHEL-10][WALA] waagent -collect-logs doesn't work and the log is confusing Patch4: wla-skip-cgorup-monitor-2939.patch - +# MSVSphere +Patch100: 0001-Add-MSVSphere-support.patch BuildArch: noarch BuildRequires: python3-devel @@ -129,6 +130,9 @@ rm -rf %{_unitdir}/waagent.service.d/ %endif %changelog +* Wed Dec 25 2024 Sergey Cherevko - 2.9.1.1-7.inferit +- Add MSVSphere support + * Tue Nov 26 2024 MSVSphere Packaging Team - 2.9.1.1-7 - Rebuilt for MSVSphere 10