import CS WALinuxAgent-2.13.1.1-3.el9

This commit is contained in:
eabdullin 2025-09-15 11:39:40 +00:00
parent 3ec6d3652e
commit 5f5bdbcff5
13 changed files with 328 additions and 312 deletions

View File

@ -1 +1 @@
9d9b8fcd872d8782b96d312fb13f47a41658dd04 SOURCES/v2.7.0.6.tar.gz
3511edebc20381fc108c92e41218cbfc4ed78fa8 SOURCES/v2.13.1.1.tar.gz

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/v2.7.0.6.tar.gz
SOURCES/v2.13.1.1.tar.gz

View File

@ -1,75 +0,0 @@
From 9d071a9b4b40f0f86bb0b739b72c0b9b4870f060 Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Fri, 14 May 2021 09:42:08 +0200
Subject: Initial redhat build configuation.
Using .distro repository to hold redhat tools and configuration.
Package can be built on brew using rh-rhel-koji command.
Note: Old rh-brew target is supported.
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
Merged patches (2.7.0.6):
- 896c5c83 Require iptables package
- a702a0d1 (origin/rhel-9.0.0-beta) source-git: Use dynamic SRPM_NAME
---
.distro/Makefile | 73 ++++++
.distro/Makefile.common | 18 ++
.distro/WALinuxAgent.spec.template | 254 +++++++++++++++++++++
.distro/module-setup.sh | 16 ++
.distro/rpmbuild/BUILD/.gitignore | 2 +
.distro/rpmbuild/RPMS/.gitignore | 2 +
.distro/rpmbuild/SOURCES/.gitignore | 2 +
.distro/rpmbuild/SPECS/.gitignore | 2 +
.distro/rpmbuild/SRPMS/.gitignore | 2 +
.distro/scripts/extract_build_cmd.py | 83 +++++++
.distro/scripts/frh.py | 24 ++
.distro/scripts/git-backport-diff | 327 +++++++++++++++++++++++++++
.distro/scripts/git-compile-check | 215 ++++++++++++++++++
.distro/scripts/process-patches.sh | 92 ++++++++
.distro/scripts/tarball_checksum.sh | 3 +
setup.py | 4 +-
16 files changed, 1117 insertions(+), 2 deletions(-)
create mode 100644 .distro/Makefile
create mode 100644 .distro/Makefile.common
create mode 100644 .distro/WALinuxAgent.spec.template
create mode 100644 .distro/module-setup.sh
create mode 100644 .distro/rpmbuild/BUILD/.gitignore
create mode 100644 .distro/rpmbuild/RPMS/.gitignore
create mode 100644 .distro/rpmbuild/SOURCES/.gitignore
create mode 100644 .distro/rpmbuild/SPECS/.gitignore
create mode 100644 .distro/rpmbuild/SRPMS/.gitignore
create mode 100755 .distro/scripts/extract_build_cmd.py
create mode 100755 .distro/scripts/frh.py
create mode 100755 .distro/scripts/git-backport-diff
create mode 100755 .distro/scripts/git-compile-check
create mode 100755 .distro/scripts/process-patches.sh
create mode 100755 .distro/scripts/tarball_checksum.sh
diff --git a/setup.py b/setup.py
index 12c9e1d6..e4d7cf7e 100755
--- a/setup.py
+++ b/setup.py
@@ -97,7 +97,7 @@ def get_data_files(name, version, fullname): # pylint: disable=R0912
agent_bin_path = osutil.get_agent_bin_path()
if name in ('redhat', 'centos', 'almalinux', 'cloudlinux'): # pylint: disable=R1714
- if version.startswith("8.2"):
+ if version.startswith("9"):
# 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.2"):
+ if version.startswith("9"):
# redhat 8+ uses systemd and python3
set_systemd_files(data_files, dest=systemd_dir_path,
src=["init/redhat/waagent.service",
--
2.31.1

View File

@ -1,40 +0,0 @@
From 8538516744130409f96b3ec956ff5ec1b1c1be11 Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Tue, 24 May 2022 04:10:46 -0400
Subject: Implement restart_if for RedHat OS
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
azurelinuxagent/common/osutil/redhat.py | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/azurelinuxagent/common/osutil/redhat.py b/azurelinuxagent/common/osutil/redhat.py
index 9759d113..a02647cd 100644
--- a/azurelinuxagent/common/osutil/redhat.py
+++ b/azurelinuxagent/common/osutil/redhat.py
@@ -142,3 +142,21 @@ class RedhatOSUtil(Redhat6xOSUtil):
endpoint = self.get_endpoint_from_leases_path('/var/lib/NetworkManager/dhclient-*.lease')
return endpoint
+
+ def restart_if(self, ifname, retries=3, wait=5):
+ """
+ Restart an interface by bouncing the link.
+ """
+ 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")
--
2.31.1

View File

@ -13,5 +13,5 @@ depends() {
# called by dracut
install() {
inst_multiple cut readlink chmod
inst_rules 66-azure-storage.rules 99-azure-product-uuid.rules
inst_rules 10-azure-unmanaged-sriov.rules 66-azure-storage.rules 99-azure-product-uuid.rules
}

View File

@ -1,7 +1,7 @@
From 21616a198bee14a9a95a6dacedcd1b1eca175fc6 Mon Sep 17 00:00:00 2001
From 92baa5663a0baa45e37243936221b0c1795ff324 Mon Sep 17 00:00:00 2001
From: Ani Sinha <anisinha@redhat.com>
Date: Mon, 6 May 2024 11:50:49 +0530
Subject: [PATCH] Disable automatic log collector
Subject: Disable automatic log collector
RH-Author: Ani Sinha <anisinha@redhat.com>
RH-MergeRequest: 11: Disable automatic log collector
@ -17,15 +17,19 @@ Jira: https://issues.redhat.com/browse/RHEL-7273
Upstream: RHEL only.
Signed-off-by: Ani Sinha <anisinha@redhat.com>
Patch-name: wla-Disable-automatic-log-collector.patch
Patch-id:
Patch-present-in-specfile: True
---
config/waagent.conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/waagent.conf b/config/waagent.conf
index 14cd01c8..25ee83d3 100644
index 3c9ad5d4..62d8148e 100644
--- a/config/waagent.conf
+++ b/config/waagent.conf
@@ -73,7 +73,7 @@ Logs.Verbose=n
@@ -70,7 +70,7 @@ Logs.Verbose=n
# Logs.Console=y
# Enable periodic log collection, default is y

View File

@ -1,107 +0,0 @@
From 1671c696f3b0f51e3e317b50aabc5dc84be4ca01 Mon Sep 17 00:00:00 2001
From: Mohammed Gamal <mgamal@redhat.com>
Date: Wed, 3 Aug 2022 13:23:19 +0200
Subject: [PATCH 2/2] Update Log Collector default in Comments and Readme
(#2608)
RH-Author: Mohamed Gamal Morsy <mmorsy@redhat.com>
RH-MergeRequest: 4: Update Log Collector default in Comments and Readme
RH-Commit: [1/1] 2f249d80b7136a0e3dbacb34a75c56454b95b8c2
RH-Bugzilla: 2093965
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2093965
(cherry picked from commit a560872bec103523e73ddcb5fb5705896545ffce)
Signed-off-by: Mohammed Gamal <mgamal@redhat.com>
---
README.md | 2 +-
config/debian/waagent.conf | 2 +-
config/suse/waagent.conf | 2 +-
config/ubuntu/waagent.conf | 2 +-
config/waagent.conf | 2 +-
tests/data/test_waagent.conf | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index c69f43e6..f2f3db46 100644
--- a/README.md
+++ b/README.md
@@ -465,7 +465,7 @@ _Default: y_
If set, agent logs will be periodically collected and uploaded to a secure location for improved supportability.
-NOTE: This feature is only supported ubuntu 16.04+; this flag will not take effect on any other distro.
+NOTE: This feature relies on the agent's resource usage features (cgroups); this flag will not take effect on any distro not supported.
#### __Logs.CollectPeriod__
diff --git a/config/debian/waagent.conf b/config/debian/waagent.conf
index 6bc36604..dfd7afcd 100644
--- a/config/debian/waagent.conf
+++ b/config/debian/waagent.conf
@@ -63,7 +63,7 @@ Logs.Verbose=n
# Enable Console logging, default is y
# Logs.Console=y
-# Enable periodic log collection, default is n
+# Enable periodic log collection, default is y
Logs.Collect=y
# How frequently to collect logs, default is each hour
diff --git a/config/suse/waagent.conf b/config/suse/waagent.conf
index ac9f11a2..c617f9af 100644
--- a/config/suse/waagent.conf
+++ b/config/suse/waagent.conf
@@ -66,7 +66,7 @@ Logs.Verbose=n
# Enable Console logging, default is y
# Logs.Console=y
-# Enable periodic log collection, default is n
+# Enable periodic log collection, default is y
Logs.Collect=y
# How frequently to collect logs, default is each hour
diff --git a/config/ubuntu/waagent.conf b/config/ubuntu/waagent.conf
index 63635a81..19b56bae 100644
--- a/config/ubuntu/waagent.conf
+++ b/config/ubuntu/waagent.conf
@@ -66,7 +66,7 @@ Logs.Verbose=n
# Enable Console logging, default is y
# Logs.Console=y
-# Enable periodic log collection, default is n
+# Enable periodic log collection, default is y
Logs.Collect=y
# How frequently to collect logs, default is each hour
diff --git a/config/waagent.conf b/config/waagent.conf
index c7d10e2f..14cd01c8 100644
--- a/config/waagent.conf
+++ b/config/waagent.conf
@@ -72,7 +72,7 @@ Logs.Verbose=n
# Enable Console logging, default is y
# Logs.Console=y
-# Enable periodic log collection, default is n
+# Enable periodic log collection, default is y
Logs.Collect=y
# How frequently to collect logs, default is each hour
diff --git a/tests/data/test_waagent.conf b/tests/data/test_waagent.conf
index a386228a..cc60886e 100644
--- a/tests/data/test_waagent.conf
+++ b/tests/data/test_waagent.conf
@@ -67,7 +67,7 @@ ResourceDisk.MountOptions=None
# Enable verbose logging (y|n)
Logs.Verbose=n
-# Enable periodic log collection, default is n
+# Enable periodic log collection, default is y
Logs.Collect=y
# How frequently to collect logs, default is each hour
--
2.31.1

View File

@ -0,0 +1,60 @@
From 846d9f18e2ee331e35a7243f73de3bb3c18875df Mon Sep 17 00:00:00 2001
From: Yuxin Sun <yuxisun@redhat.com>
Date: Fri, 27 Jun 2025 01:34:20 +0800
Subject: [PATCH] Use systemctl instead of service to manager services in new
RHEL versions (#3403)
RH-Author: yuxisun <None>
RH-MergeRequest: 19: Use systemctl instead of service to manager services in new RHEL versions (#3403)
RH-Jira: RHEL-97572
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
RH-Commit: [1/1] bc7fe085ed52750264773c1922e8268ace741a8e (yuxisun/WALinuxAgent-src)
In the RHEL bootc base image there's no initscripts-service package installed, so that there's no "service" command by default. This causes many service control commands cannot be executed inside WALA.
From RHEL-7 on, the systemctl command replaces service and chkconfig. So we'd like to drop all the 'service' command and use systemctl instead.
RH-JIRA: RHEL-97572
Upstream PR: https://github.com/Azure/WALinuxAgent/pull/3403
(cherry picked from commit a6cfdfdc3e04884a08cd6dd20fa035b687943fe9)
Signed-off-by: Yuxin Sun <yuxisun@redhat.com>
---
azurelinuxagent/common/osutil/redhat.py | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/azurelinuxagent/common/osutil/redhat.py b/azurelinuxagent/common/osutil/redhat.py
index b85b2d42..cf2d2f78 100644
--- a/azurelinuxagent/common/osutil/redhat.py
+++ b/azurelinuxagent/common/osutil/redhat.py
@@ -245,6 +245,18 @@ class RedhatOSModernUtil(RedhatOSUtil):
def __init__(self): # pylint: disable=W0235
super(RedhatOSModernUtil, self).__init__()
+ def restart_ssh_service(self):
+ return shellutil.run("systemctl condrestart sshd", chk_err=False)
+
+ def stop_agent_service(self):
+ return shellutil.run("systemctl stop {0}".format(self.service_name), chk_err=False)
+
+ def start_agent_service(self):
+ return shellutil.run("systemctl start {0}".format(self.service_name), chk_err=False)
+
+ def restart_network_manager(self):
+ shellutil.run("systemctl restart NetworkManager")
+
def restart_if(self, ifname, retries=3, wait=5):
"""
Restart an interface by bouncing the link. systemd-networkd observes
@@ -270,7 +282,7 @@ class RedhatOSModernUtil(RedhatOSUtil):
# RedhatOSUtil was updated to conditionally run NetworkManager restart in response to a race condition between
# NetworkManager restart and the agent restarting the network interface during publish_hostname. Keeping the
# NetworkManager restart in RedhatOSModernUtil because the issue was not reproduced on these versions.
- shellutil.run("service NetworkManager restart")
+ self.restart_network_manager()
DefaultOSUtil.publish_hostname(self, hostname)
def set_dhcp_hostname(self, hostname):
--
2.50.1

View File

@ -0,0 +1,202 @@
From 756fe22f41c0607394a9b9ba20c15677b3389a21 Mon Sep 17 00:00:00 2001
From: Li Tian <94442129+litian1992@users.noreply.github.com>
Date: Tue, 5 Aug 2025 03:18:10 +0800
Subject: [PATCH] docs: add waagent manpage (#3401)
RH-Author: Li Tian <None>
RH-MergeRequest: 22: redhat: docs: add waagent manpage (RHEL-9) (#3401)
RH-Jira: RHEL-109496
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
RH-Acked-by: Jon Maloy <jmaloy@redhat.com>
RH-Commit: [1/1] a6c0303463f4cd9362d7276119cc81ebe74490ac (litian1/WALinuxAgent)
* docs: add waagent manpage
Add also man page handler in setup.py
---------
Signed-off-by: Li Tian <litian@redhat.com>
Co-authored-by: maddieford <93676569+maddieford@users.noreply.github.com>
(cherry picked from commit 7f9b5568b6572745b7d0776de0ff6fb70a28dba0)
Signed-off-by: Li Tian <litian@redhat.com>
---
.distro/WALinuxAgent.spec | 1 +
doc/man/waagent.1 | 117 ++++++++++++++++++++++++++++++++++++++
setup.py | 14 +++++
3 files changed, 132 insertions(+)
create mode 100644 doc/man/waagent.1
diff --git a/doc/man/waagent.1 b/doc/man/waagent.1
new file mode 100644
index 00000000..b1d8e9eb
--- /dev/null
+++ b/doc/man/waagent.1
@@ -0,0 +1,117 @@
+.TH WAAGENT 1 "June 2025" "Azure Linux Agent" "System Administration"
+.SH NAME
+waagent \- Azure Linux VM Agent
+.SH SYNOPSIS
+.B waagent
+[-verbose] [-force] [-help] [\fISUBCOMMAND\fR]...
+
+.SH DESCRIPTION
+The Azure Linux Agent (waagent) manages virtual machine interaction with the Azure fabric controller.
+
+Most subcommands are not meant to be run directly by the user. However, some subcommands may be useful for debugging (such as collect-logs, version, and show-configuration) and deprovisioning.
+
+.SH SUBCOMMANDS
+.TP
+\fB-collect-logs\fR
+Runs the log collector utility that collects relevant agent logs for debugging and stores them in the agent folder on disk. Exact location will be shown when run. Use flag \fB-full\fR for more exhaustive log collection.
+
+.TP
+\fB-configuration-path FILE\fR
+Used together with \fB-start\fR or \fB-daemon\fR to specify configuration file. Default to /etc/waagent.conf.
+
+.TP
+\fB-daemon -start\fR
+Run waagent as a daemon in background.
+
+.TP
+\fB-deprovision\fR
+Attempt to clean the system and make it suitable for re-provisioning. WARNING: Deprovision does not guarantee that the image is cleared of all sensitive information and suitable for redistribution.
+
+.TP
+\fB-deprovision+user\fR
+Same as \fB-deprovision\fR, but also removes the last provisioned user account.
+
+.TP
+\fB-register-service\fR
+Register waagent as a service and enable it.
+
+.TP
+\fB-run-exthandlers\fR
+Run check for updates to waagent and extension handler. Note that outputs to /dev/console will be temporarily suspended.
+
+.TP
+\fB-setup-firewall=IP\fR
+Set up firewall rules for endpoint \fBIP\fR.
+
+.TP
+\fB-show-configuration\fR
+Print the current configuration, including values read from waagent.conf.
+
+.TP
+\fB-help\fR
+Display usage information.
+
+.TP
+\fB-version\fR
+Show the current version of the agent.
+
+.SH CONFIGURATION
+The agent is configured via this file by default:
+
+.B /etc/waagent.conf
+
+This file contains key=value settings that control agent behavior, including provisioning, disk formatting, resource limits, and certificate handling.
+
+Example entries:
+.RS
+Provisioning.Enabled=y
+ResourceDisk.Format=y
+ResourceDisk.MountPoint=/mnt/resource
+RSA.KeyLength=2048
+Logs.Verbose=y
+.RE
+
+.SH FILES AND DIRECTORIES
+.TP
+\fB/etc/waagent.conf\fR
+Main configuration file.
+
+.TP
+\fB/var/lib/waagent\fR
+State files and provisioning artifacts.
+
+.TP
+\fB/var/log/waagent.log\fR
+Agent log file.
+
+.SH SERVICES
+On systemd systems, the agent runs as:
+.RS
+.B systemctl start <waagent.service|walinuxagent.service>
+.B systemctl enable <waagent.service|walinuxagent.service>
+.RE
+
+.SH EXIT STATUS
+Zero on success, non-zero on error.
+
+.SH EXAMPLES
+.TP
+Deprovision before capturing an image:
+.RS
+waagent -deprovision+user && rm -rf /var/lib/waagent && shutdown -h now
+.RE
+
+.SH SEE ALSO
+.BR systemctl (1),
+.BR cloud-init (1)
+
+.SH HOMEPAGE
+.B https://github.com/Azure/WALinuxAgent
+
+.B https://learn.microsoft.com/en-us/azure/virtual-machines/extensions/agent-linux
+
+.SH COPYRIGHT
+Copyright 2018 Microsoft Corporation
+
+.SH AUTHORS
+Microsoft Azure Linux Team
diff --git a/setup.py b/setup.py
index cf6e90b5..9ed135fb 100755
--- a/setup.py
+++ b/setup.py
@@ -17,7 +17,9 @@
# limitations under the License.
#
+import gzip
import os
+import shutil
import subprocess
import sys
@@ -87,6 +89,16 @@ def set_udev_files(data_files, dest="/etc/udev/rules.d/", src=None):
"config/99-azure-product-uuid.rules"]
data_files.append((dest, src))
+def set_man_files(data_files, dest="/usr/share/man/man1", src=None):
+ if src is None:
+ src = ["doc/man/waagent.1"]
+ src_gz = []
+ for file in src:
+ with open(file, 'rb') as f_in, gzip.open(file+".gz", 'wb') as f_out:
+ shutil.copyfileobj(f_in, f_out)
+ src_gz.append(file+".gz")
+ data_files.append((dest, src_gz))
+
def get_data_files(name, version, fullname): # pylint: disable=R0912
"""
@@ -107,6 +119,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)
+ set_man_files(data_files)
if version.startswith("8") or version.startswith("9"):
# redhat 8+ uses systemd and python3
set_systemd_files(data_files, dest=systemd_dir_path,
@@ -255,6 +268,7 @@ def get_data_files(name, version, fullname): # pylint: disable=R0912
set_logrotate_files(data_files)
set_udev_files(data_files)
set_systemd_files(data_files, dest=systemd_dir_path)
+ set_man_files(data_files)
else:
# Use default setting
set_bin_files(data_files, dest=agent_bin_path)
--
2.50.1

View File

@ -1,7 +1,7 @@
From 7841f8f9c4a76fc3519202a9c6bebf9697a08e19 Mon Sep 17 00:00:00 2001
From c8df88fd1fedb25727fff64ecc5dde1a59d7a976 Mon Sep 17 00:00:00 2001
From: Vitaly Kuznetsov <vkuznets@redhat.com>
Date: Mon, 6 Jan 2025 17:13:11 +0100
Subject: [PATCH] redhat: Add a udev rule to avoid managing slave NICs with
Subject: redhat: Add a udev rule to avoid managing slave NICs with
NetworkManager
RH-Author: Vitaly Kuznetsov <vkuznets@redhat.com>
@ -17,6 +17,10 @@ eventually. For the time being, just put the required udev rule into
WALinuxAgent package.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Patch-name: wla-redhat-Add-a-udev-rule-to-avoid-managing-slave-NICs-.patch
Patch-id:
Patch-present-in-specfile: True
---
.distro/WALinuxAgent.spec | 1 +
config/10-azure-unmanaged-sriov.rules | 6 ++++++
@ -37,7 +41,7 @@ index 00000000..7eefcb26
+# NM_UNMANAGED=1 for NetworkManager
+SUBSYSTEM=="net", ACTION!="remove", DRIVERS=="mana|mlx4_core|mlx5_core", ATTR{flags}=="0x?[89ABCDEF]??", ENV{AZURE_UNMANAGED_SRIOV}="1", ENV{ID_NET_MANAGED_BY}="unmanaged", ENV{NM_UNMANAGED}="1"
diff --git a/setup.py b/setup.py
index e4d7cf7e..ab75563e 100755
index e83f5989..cf6e90b5 100755
--- a/setup.py
+++ b/setup.py
@@ -82,7 +82,8 @@ def set_openbsd_rc_files(data_files, dest="/etc/rc.d/", src=None):

View File

@ -1,57 +0,0 @@
From 6d452b28383c59a8193595daaca13fa8db9338a1 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: 2: redhat: Fix command sequence for restarting net interface
RH-Commit: [1/1] e838ff196b8823f64e08247b3a4dac9d60e5ed72
RH-Bugzilla: 2098233
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=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 <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.31.1

View File

@ -1,8 +1,8 @@
From b85814d5683c7f8a1e1b5f3570bcce0a8f76137b Mon Sep 17 00:00:00 2001
From 8ac14e61d8067bd8b4e60c59b35b4a4227f8a242 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/2] redhat: Use NetworkManager to set DHCP hostnames on
recent RHEL distros
Subject: redhat: Use NetworkManager to set DHCP hostnames on recent RHEL
distros
RH-Author: Mohamed Gamal Morsy <mmorsy@redhat.com>
RH-MergeRequest: 3: redhat: Use NetworkManager to set DHCP hostnames on recent RHEL distros
@ -20,18 +20,22 @@ 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
---
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
index a9a10347..b85b2d42 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")
@@ -272,3 +272,15 @@ class RedhatOSModernUtil(RedhatOSUtil):
# NetworkManager restart in RedhatOSModernUtil because the issue was not reproduced on these versions.
shellutil.run("service NetworkManager restart")
DefaultOSUtil.publish_hostname(self, hostname)
+
+ def set_dhcp_hostname(self, hostname):
+ """
@ -45,5 +49,5 @@ index 5c397ae8..7dd36add 100644
+ if return_code != 0:
+ logger.error("failed to set DHCP hostname for interface {0}: return code {1}".format(ifname, return_code))
--
2.31.1
2.39.3

View File

@ -3,8 +3,8 @@
%global dracut_modname_cvm 97walinuxagentcvm
Name: WALinuxAgent
Version: 2.7.0.6
Release: 11%{?dist}
Version: 2.13.1.1
Release: 3%{?dist}
Summary: The Microsoft Azure Linux Agent
License: ASL 2.0
@ -15,21 +15,16 @@ Source2: module-setup-cvm.sh
Source3: 90-tpm2-import.rules
Source4: tpm2-luks-import.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
# For bz#2114830 - [Azure][WALA][RHEL-9.1] Provisioning failed if no ifcfg-eth0
Patch4: wla-redhat-Use-NetworkManager-to-set-DHCP-hostnames-on-r.patch
# For bz#2093965 - [Azure][WALA][RHEL-9] The description of "Logs.Collect" is incorrect
Patch5: wla-Update-Log-Collector-default-in-Comments-and-Readme-.patch
Patch0001: wla-redhat-Use-NetworkManager-to-set-DHCP-hostnames-on-r.patch
# For RHEL-7273 - [Azure][WALA] Consider to disable Log collector
Patch6: wla-Disable-automatic-log-collector.patch
Patch0002: wla-Disable-automatic-log-collector.patch
# For RHEL-5880 - [Azure][RHEL-9]68-azure-sriov-nm-unmanaged.rules cannot stop NetworkManager-wait-online.service checking SRIOV interface
Patch7: wla-redhat-Add-a-udev-rule-to-avoid-managing-slave-NICs-.patch
# Source-git patches
Patch0003: wla-redhat-Add-a-udev-rule-to-avoid-managing-slave-NICs-.patch
# For RHEL-109496 - [Azure][WALA][RHEL-9] Missing man page
Patch4: wla-docs-add-waagent-manpage-3401.patch
# For RHEL-97572 - [Azure][RHEL-9][WALA][Image mode] Cannot find 'service' command
Patch5: wla-Use-systemctl-instead-of-service-to-manager-services.patch
BuildArch: noarch
@ -133,6 +128,7 @@ rm -rf %{_unitdir}/waagent.service.d/
%files
%doc LICENSE.txt NOTICE README.md
%{_mandir}/man1/waagent.1.gz
%ghost %{_localstatedir}/log/waagent.log
%ghost %{_unitdir}/waagent-network-setup.service
%dir %attr(0700, root, root) %{_sharedstatedir}/waagent
@ -164,6 +160,31 @@ rm -rf %{_unitdir}/waagent.service.d/
%endif
%changelog
* Thu Aug 21 2025 Jon Maloy <jmaloy@redhat.com> - 2.13.1.1-3
- wla-Use-systemctl-instead-of-service-to-manager-services.patch [RHEL-97572]
- Resolves: RHEL-97572
([Azure][RHEL-9][WALA][Image mode] Cannot find 'service' command)
* Thu Aug 21 2025 Jon Maloy <jmaloy@redhat.com> - 2.13.1.1-2
- wla-docs-add-waagent-manpage-3401.patch [RHEL-109496]
- Resolves: RHEL-109496
([Azure][WALA][RHEL-9] Missing man page)
* Thu May 22 2025 Vitaly Kuznetsov <vkuznets@redhat.com> - 2.13.1.1-1
* Rebase to 2.13.1.1 [RHEL-91090]
- Resolves: RHEL-91090
(Rebase to v2.13.1.1 [rhel-9])
* Fri Apr 11 2025 Jon Maloy <jmaloy@redhat.com> - 2.7.0.6-13
- wla-redhat-Include-10-azure-unmanaged-sriov.rules-into-i.patch [RHEL-40957]
- Resolves: RHEL-40957
([Azure][ARM][RHEL-9] Kdump cannot save vmcore via ssh or nfs)
* Wed Apr 02 2025 Jon Maloy <jmaloy@redhat.com> - 2.7.0.6-12
- wla-redhat-Include-10-azure-unmanaged-sriov.rules-into-i.patch [RHEL-40957]
- Resolves: RHEL-40957
([Azure][ARM][RHEL-9] Kdump cannot save vmcore via ssh or nfs)
* Fri Jan 17 2025 Miroslav Rezanina <mrezanin@redhat.com> - 2.7.0.6-11
- wla-redhat-Add-a-udev-rule-to-avoid-managing-slave-NICs-.patch [RHEL-5880]
- Resolves: RHEL-5880