* Thu Jul 11 2024 Miroslav Rezanina <mrezanin@redhat.com> - 2.9.1.1-6

- wla-redhat-Use-NetworkManager-to-set-DHCP-hostnames-on-r.patch [RHEL-40966]
- wla-redhat-Remove-all-waagent-unit-files-when-uninstalli.patch [RHEL-40966]
- wla-redhat-Mark-directories-properly-in-the-files-list.patch [RHEL-40966]
- wla-redhat-Remove-files-inside-WALA-services-directory.patch [RHEL-40966]
- Resolves: RHEL-40966
  ([Azure][WALA][RHEL-10] Provisioning failed if no ifcfg-eth0)
This commit is contained in:
Miroslav Rezanina 2024-07-11 08:53:18 -04:00
parent 02f5b5a36f
commit 20d55ddd6a
2 changed files with 74 additions and 1 deletions

View File

@ -3,7 +3,7 @@
Name: WALinuxAgent
Version: 2.9.1.1
Release: 5%{?dist}
Release: 6%{?dist}
Summary: The Microsoft Azure Linux Agent
License: Apache-2.0
@ -14,6 +14,8 @@ Source1: module-setup.sh
Patch1: 0001-waagent.service-set-ConditionVirtualization-microsof.patch
# For RHEL-35963 - [Azure][WALA] Consider to disable Log collector [rhel-10]
Patch2: wla-Disable-automatic-log-collector.patch
# For RHEL-40966 - [Azure][WALA][RHEL-10] Provisioning failed if no ifcfg-eth0
Patch3: wla-redhat-Use-NetworkManager-to-set-DHCP-hostnames-on-r.patch
BuildArch: noarch
@ -99,10 +101,12 @@ install -m0755 -D -t %{buildroot}%{_prefix}/lib/dracut/modules.d/%{dracut_modnam
%postun
%systemd_postun_with_restart waagent.service
rm -rf %{_unitdir}/waagent.service.d/
%files
%doc LICENSE.txt NOTICE README.md
%ghost %{_localstatedir}/log/waagent.log
%ghost %{_unitdir}/waagent-network-setup.service
%dir %attr(0700, root, root) %{_sharedstatedir}/waagent
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%{_sbindir}/waagent
@ -123,6 +127,14 @@ install -m0755 -D -t %{buildroot}%{_prefix}/lib/dracut/modules.d/%{dracut_modnam
%endif
%changelog
* Thu Jul 11 2024 Miroslav Rezanina <mrezanin@redhat.com> - 2.9.1.1-6
- wla-redhat-Use-NetworkManager-to-set-DHCP-hostnames-on-r.patch [RHEL-40966]
- wla-redhat-Remove-all-waagent-unit-files-when-uninstalli.patch [RHEL-40966]
- wla-redhat-Mark-directories-properly-in-the-files-list.patch [RHEL-40966]
- wla-redhat-Remove-files-inside-WALA-services-directory.patch [RHEL-40966]
- Resolves: RHEL-40966
([Azure][WALA][RHEL-10] Provisioning failed if no ifcfg-eth0)
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 2.9.1.1-5
- Bump release for June 2024 mass rebuild

View File

@ -0,0 +1,61 @@
From 8cc6f62bd1be39e60be6ae606ea4beb76ae24d7c Mon Sep 17 00:00:00 2001
From: Mohammed Gamal <mgamal@redhat.com>
Date: Fri, 29 Jul 2022 13:07:13 +0200
Subject: [PATCH 1/4] redhat: Use NetworkManager to set DHCP hostnames on
recent RHEL distros
RH-Author: Ani Sinha <anisinha@redhat.com>
RH-MergeRequest: 13: sync c10s branch from c9s
RH-Jira: RHEL-40966
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
RH-Commit: [1/4] 05e1d05db526deae49e976dea3bae140ea1b2ecf (anisinha/centos-wa-linux-agent)
RH-Author: Mohamed Gamal Morsy <mmorsy@redhat.com>
RH-MergeRequest: 3: redhat: Use NetworkManager to set DHCP hostnames on recent RHEL distros
RH-Commit: [1/1] 2bf51293796ba0e8567e436836adc0547f062b04
RH-Bugzilla: 2114830
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2114830
Recent versions of RHEL 8 and RHEL 9 started using NetworkManager to configure
network intefaces instead of sysconfig files. Configurations are no longer
stored in /etc/sysconfig/ifcfg-{interface}.
Fix this for setting DHCP hostnames in those RHEL versions.
Signed-off-by: Mohammed Gamal <mgamal@redhat.com>
Patch-name: wla-redhat-Use-NetworkManager-to-set-DHCP-hostnames-on-r.patch
Patch-id:
Patch-present-in-specfile: True
(cherry picked from commit 8400a993c6c27f8f8fc598f81e2c329dc8255805)
---
azurelinuxagent/common/osutil/redhat.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/azurelinuxagent/common/osutil/redhat.py b/azurelinuxagent/common/osutil/redhat.py
index 312dd160..4b46a97a 100644
--- a/azurelinuxagent/common/osutil/redhat.py
+++ b/azurelinuxagent/common/osutil/redhat.py
@@ -164,3 +164,15 @@ class RedhatOSModernUtil(RedhatOSUtil):
time.sleep(wait)
else:
logger.warn("exceeded restart retries")
+
+ def set_dhcp_hostname(self, hostname):
+ """
+ Recent RHEL distributions use network manager instead of sysconfig files
+ to configure network interfaces
+ """
+ ifname = self.get_if_name()
+
+ return_code = shellutil.run("nmcli device modify {0} ipv4.dhcp-hostname {1} ipv6.dhcp-hostname {1}".format(ifname, hostname))
+
+ if return_code != 0:
+ logger.error("failed to set DHCP hostname for interface {0}: return code {1}".format(ifname, return_code))
--
2.39.3