From 4cd53bdbe08a7d890a8d9981bebfc057b9aeabf5 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 25 Oct 2022 03:38:52 -0400 Subject: [PATCH] import WALinuxAgent-2.3.0.2-2.el8_6.3 --- ...rkManager-to-set-DHCP-hostnames-on-r.patch | 48 +++++++++++++++++++ SPECS/WALinuxAgent.spec | 10 +++- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 SOURCES/wla-redhat-Use-NetworkManager-to-set-DHCP-hostnames-on-r.patch diff --git a/SOURCES/wla-redhat-Use-NetworkManager-to-set-DHCP-hostnames-on-r.patch b/SOURCES/wla-redhat-Use-NetworkManager-to-set-DHCP-hostnames-on-r.patch new file mode 100644 index 0000000..cc4d9c1 --- /dev/null +++ b/SOURCES/wla-redhat-Use-NetworkManager-to-set-DHCP-hostnames-on-r.patch @@ -0,0 +1,48 @@ +From 3bc94c896f660e7932d732988f16dc2916fcc1d6 Mon Sep 17 00:00:00 2001 +From: Mohammed Gamal +Date: Fri, 29 Jul 2022 13:07:13 +0200 +Subject: [PATCH] redhat: Use NetworkManager to set DHCP hostnames on recent + RHEL distros + +RH-Author: Mohamed Gamal Morsy +RH-MergeRequest: 13: redhat: Use NetworkManager to set DHCP hostnames on recent RHEL distros +RH-Bugzilla: 2133446 +RH-Acked-by: Miroslav Rezanina +RH-Commit: [1/1] 673e76149dd1f2fb4e23823844ed294fdbbecb1a + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2133446 + +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 +--- + 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 5c397ae8..7dd36add 100644 +--- a/azurelinuxagent/common/osutil/redhat.py ++++ b/azurelinuxagent/common/osutil/redhat.py +@@ -158,3 +158,15 @@ class RedhatOSUtil(Redhat6xOSUtil): + 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.37.3 + diff --git a/SPECS/WALinuxAgent.spec b/SPECS/WALinuxAgent.spec index 97dda6e..37ce560 100644 --- a/SPECS/WALinuxAgent.spec +++ b/SPECS/WALinuxAgent.spec @@ -1,7 +1,7 @@ Summary: Microsoft Azure Linux Agent Name: WALinuxAgent Version: 2.3.0.2 -Release: 2%{?dist}.2 +Release: 2%{?dist}.3 License: ASL 2.0 Group: Development/Libraries @@ -16,6 +16,8 @@ Patch2: wla-Fix-if-hangs-2283.patch Patch3: wla-Implement-restart_if-for-RedHat-OS.patch # For bz#2092753 - [Azure][WALA][RHEL-8] [8.6.z] walinuxagent kills network during boot [rhel-8.6.0.z] Patch4: wla-redhat-Implement-restart_if-correctly-to-eliminate-w.patch +# For bz#2133446 - [Azure][WALA][RHEL-8.7] Provisioning failed if no ifcfg-eth0 [rhel-8.6.0.z] +Patch5: wla-redhat-Use-NetworkManager-to-set-DHCP-hostnames-on-r.patch # rhel requirements BuildRequires: python3-devel @@ -52,6 +54,7 @@ Udev rules specific to Microsoft Azure Virtual Machines. %patch2 -p1 %patch3 -p1 %patch4 -p1 +%patch5 -p1 %build %py3_build @@ -87,6 +90,11 @@ rm -rf $RPM_BUILD_ROOT %{_udevrulesdir}/*.rules %changelog +* Tue Oct 11 2022 Jon Maloy - 2.3.0.2-2.el8_6.3 +- wla-redhat-Use-NetworkManager-to-set-DHCP-hostnames-on-r.patch [bz#2133446] +- Resolves: bz#2133446 + ([Azure][WALA][RHEL-8.7] Provisioning failed if no ifcfg-eth0 [rhel-8.6.0.z]) + * Tue Jul 12 2022 Camilla Conte - 2.3.0.2-2.el8_6.2 - wla-redhat-Implement-restart_if-correctly-to-eliminate-w.patch [bz#2092753] - Resolves: bz#2092753