import WALinuxAgent-2.7.0.6-2.el8

This commit is contained in:
CentOS Sources 2022-07-15 14:09:20 +00:00 committed by Stepan Oksanichenko
parent 3f0898b72b
commit bea572a7fd
2 changed files with 66 additions and 1 deletions

View File

@ -0,0 +1,57 @@
From ac21739b94266387360a7ba2b3cfeb44c3df5b01 Mon Sep 17 00:00:00 2001
From: Mohammed Gamal <mgamal@redhat.com>
Date: Wed, 22 Jun 2022 13:36:07 +0200
Subject: [PATCH] redhat: Fix command sequence for restarting net interface
RH-Author: Mohamed Gamal Morsy <mmorsy@redhat.com>
RH-MergeRequest: 4: redhat: Fix command sequence for restarting net interface
RH-Commit: [1/1] ac14220635c30b3361399ae33a5ecd4e7d8cf92b
RH-Bugzilla: 2080826
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2080826
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 <mgamal@redhat.com>
---
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.35.3

View File

@ -1,7 +1,7 @@
Summary: Microsoft Azure Linux Agent
Name: WALinuxAgent
Version: 2.7.0.6
Release: 1%{?dist}
Release: 2%{?dist}
License: ASL 2.0
Group: Development/Libraries
@ -11,6 +11,8 @@ Source0: v2.7.0.6.tar.gz
BuildArch: noarch
Patch0001: 0001-Add-inital-redhat-build-support.patch
Patch0002: 0002-Implement-restart_if-for-RedHat-OS.patch
# For bz#2080826 - [Azure][WALA][RHEL-8] [8.7] walinuxagent kills network during boot
Patch0003: wla-redhat-Fix-command-sequence-for-restarting-net-inter.patch
# rhel requirements
BuildRequires: python3-devel
@ -45,6 +47,7 @@ Udev rules specific to Microsoft Azure Virtual Machines.
%patch0001 -p1
%patch0002 -p1
%patch0003 -p1
%build
%py3_build
@ -83,6 +86,11 @@ rm -rf $RPM_BUILD_ROOT
%{_udevrulesdir}/*.rules
%changelog
* Tue Jul 12 2022 Camilla Conte <cconte@redhat.com> - 2.7.0.6-2
- wla-redhat-Fix-command-sequence-for-restarting-net-inter.patch [bz#2080826]
- Resolves: bz#2080826
([Azure][WALA][RHEL-8] [8.7] walinuxagent kills network during boot)
* Wed May 25 2022 Miroslav Rezanina <mrezanin@redhat.com> - 2.7.0.6-1
- Rebase to 2.7.0.6 [bz#2083465]
- Adding restart_if implementation for RHEL [bz#2085578]