From feb32854cb806b8d90916f7c99bc85cf3eac73ad Mon Sep 17 00:00:00 2001 From: Miroslav Rezanina Date: Fri, 15 Jul 2022 06:22:38 -0400 Subject: [PATCH] * Fri Jul 15 2022 Miroslav Rezanina - 2.7.0.6-2 - wla-redhat-Fix-command-sequence-for-restarting-net-inter.patch [bz#2098233] - Resolves: bz#2098233 ([Azure][WALA][RHEL-9] [9.1] walinuxagent kills network during boot) --- WALinuxAgent.spec | 9 ++- ...nd-sequence-for-restarting-net-inter.patch | 57 +++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 wla-redhat-Fix-command-sequence-for-restarting-net-inter.patch diff --git a/WALinuxAgent.spec b/WALinuxAgent.spec index 4513a9f..7427a19 100644 --- a/WALinuxAgent.spec +++ b/WALinuxAgent.spec @@ -3,7 +3,7 @@ Name: WALinuxAgent Version: 2.7.0.6 -Release: 1%{?dist} +Release: 2%{?dist} Summary: The Microsoft Azure Linux Agent License: ASL 2.0 @@ -14,6 +14,8 @@ Source1: module-setup.sh # Python3.9 fixes Patch0001: 0001-Initial-redhat-build-configuation.patch Patch0002: 0002-Implement-restart_if-for-RedHat-OS.patch +# For bz#2098233 - [Azure][WALA][RHEL-9] [9.1] walinuxagent kills network during boot +Patch3: wla-redhat-Fix-command-sequence-for-restarting-net-inter.patch # Source-git patches @@ -123,6 +125,11 @@ install -m0755 -D -t %{buildroot}%{_prefix}/lib/dracut/modules.d/%{dracut_modnam %endif %changelog +* Fri Jul 15 2022 Miroslav Rezanina - 2.7.0.6-2 +- wla-redhat-Fix-command-sequence-for-restarting-net-inter.patch [bz#2098233] +- Resolves: bz#2098233 + ([Azure][WALA][RHEL-9] [9.1] walinuxagent kills network during boot) + * Wed May 25 2022 Miroslav Rezanina - 2.7.0.6-1 - Rebase to 2.7.0.6-1 [bz#2083464] - Adding restart_if implementation for RHEL [bz#2081944] diff --git a/wla-redhat-Fix-command-sequence-for-restarting-net-inter.patch b/wla-redhat-Fix-command-sequence-for-restarting-net-inter.patch new file mode 100644 index 0000000..2fafa98 --- /dev/null +++ b/wla-redhat-Fix-command-sequence-for-restarting-net-inter.patch @@ -0,0 +1,57 @@ +From 6d452b28383c59a8193595daaca13fa8db9338a1 Mon Sep 17 00:00:00 2001 +From: Mohammed Gamal +Date: Wed, 22 Jun 2022 13:36:07 +0200 +Subject: [PATCH] redhat: Fix command sequence for restarting net interface + +RH-Author: Mohamed Gamal Morsy +RH-MergeRequest: 2: redhat: Fix command sequence for restarting net interface +RH-Commit: [1/1] e838ff196b8823f64e08247b3a4dac9d60e5ed72 +RH-Bugzilla: 2098233 +RH-Acked-by: Vitaly Kuznetsov +RH-Acked-by: Miroslav Rezanina + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2098233 + +Apparently the down and up commands need to be run in the same command, so +connect them together with "&&" operator. Also re-implement restart_if ot handle +warnings same wat as other distros + +Signed-off-by: Mohammed Gamal +--- + azurelinuxagent/common/osutil/redhat.py | 22 ++++++++++------------ + 1 file changed, 10 insertions(+), 12 deletions(-) + +diff --git a/azurelinuxagent/common/osutil/redhat.py b/azurelinuxagent/common/osutil/redhat.py +index a02647cd..5c397ae8 100644 +--- a/azurelinuxagent/common/osutil/redhat.py ++++ b/azurelinuxagent/common/osutil/redhat.py +@@ -147,16 +147,14 @@ class RedhatOSUtil(Redhat6xOSUtil): + """ + Restart an interface by bouncing the link. + """ +- retry_limit=retries+1 ++ retry_limit = retries + 1 + for attempt in range(1, retry_limit): +- try: +- shellutil.run_command(["ip", "link", "set", ifname, "down"]) +- shellutil.run_command(["ip", "link", "set", ifname, "up"]) +- +- except shellutil.CommandError as cmd_err: +- logger.warn("failed to restart {0}: return code {1}".format(ifname, cmd_err.returncode)) +- if attempt < retry_limit: +- logger.info("retrying in {0} seconds".format(wait)) +- time.sleep(wait) +- else: +- logger.warn("exceeded restart retries") ++ return_code = shellutil.run("ip link set {0} down && ip link set {0} up".format(ifname), expected_errors=[1] if attempt < retries else []) ++ if return_code == 0: ++ return ++ logger.warn("failed to restart {0}: return code {1}".format(ifname, return_code)) ++ if attempt < retry_limit: ++ logger.info("retrying in {0} seconds".format(wait)) ++ time.sleep(wait) ++ else: ++ logger.warn("exceeded restart retries") +-- +2.31.1 +