From 40f3dcea9bbcf4de3a8a59d657cad17c3a14a4cd Mon Sep 17 00:00:00 2001 From: Bhagyashri Date: Wed, 8 Jul 2026 10:40:49 +0530 Subject: [PATCH] AzureImageStandard: add Azure Linux 4.0 support for networkd, dhcp, TCP keepalive, and kvp checks --- .../testsuites/core/azure_image_standard.py | 45 ++++++++++++++++--- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/lisa/microsoft/testsuites/core/azure_image_standard.py b/lisa/microsoft/testsuites/core/azure_image_standard.py index dec9494948..7791e5dc67 100644 --- a/lisa/microsoft/testsuites/core/azure_image_standard.py +++ b/lisa/microsoft/testsuites/core/azure_image_standard.py @@ -57,6 +57,7 @@ Ssh, Stat, Swap, + Sysctl, ) from lisa.tools.lsblk import DiskInfo from lisa.util import ( @@ -526,7 +527,10 @@ def verify_network_file_configuration(self, node: Node) -> None: f"networking=yes should be present in {network_file_path}", ).contains("networking=yes".upper()) elif isinstance(node.os, CBLMariner): - network_file_path = "/etc/systemd/networkd.conf" + if node.os.information.version >= "4.0.0": + network_file_path = "/usr/lib/systemd/networkd.conf" + else: + network_file_path = "/etc/systemd/networkd.conf" file_exists = node.shell.exists(PurePosixPath(network_file_path)) assert_that( file_exists, @@ -668,7 +672,10 @@ def verify_dhcp_file_configuration(self, node: Node) -> None: f"file {dhcp_file_path}", ).contains('DHCLIENT_SET_HOSTNAME="no"') elif isinstance(node.os, CBLMariner): - if node.os.information.version.major == 3: + if ( + node.os.information.version.major == 3 + or node.os.information.version.major == 4 + ): dhcp_file_path = "/etc/dhcpcd.conf" dhcp_file_content = "option host_name" else: @@ -767,11 +774,14 @@ def verify_hv_kvp_daemon_installed(self, node: Node) -> None: if len(running_processes) == 0: raise PassedException("hv_kvp_daemon is not installed") elif isinstance(node.os, CBLMariner): - running_processes = node.tools[Pgrep].get_processes("hypervkvpd") + kvp_daemon_name = "hypervkvpd" + if node.os.information.version >= "4.0.0": + kvp_daemon_name = "hv_kvp_daemon" + running_processes = node.tools[Pgrep].get_processes(kvp_daemon_name) assert_that(running_processes, "Expected one running process").is_length(1) assert_that( - running_processes[0].name, "Expected name 'hypervkvpd'" - ).is_equal_to("hypervkvpd") + running_processes[0].name, f"Expected name '{kvp_daemon_name}'" + ).is_equal_to(kvp_daemon_name) else: raise SkippedException(f"Unsupported distro type : {type(node.os)}") @@ -1338,6 +1348,31 @@ def verify_cloud_init_error_status(self, node: Node) -> None: requirement=simple_requirement(supported_platform_type=[AZURE, READY, HYPERV]), ) def verify_client_active_interval(self, node: Node) -> None: + if isinstance(node.os, CBLMariner) and node.os.information.version.major >= 4: + tcp_keepalive_setting = "TCPKeepAlive" + tcp_keepalive_value = ( + node.tools[Ssh].get(tcp_keepalive_setting).strip().lower() + ) + if tcp_keepalive_value != "yes": + raise LisaException( + f"The {tcp_keepalive_setting} configuration of OpenSSH is " + f"set to {tcp_keepalive_value} in this image. Azure Linux 4+ " + "uses kernel TCP keepalive for SSH, so OpenSSH TCPKeepAlive " + "must be enabled." + ) + setting = "net.ipv4.tcp_keepalive_time" + value = node.tools[Sysctl].get(setting).strip() + keepalive_time = int(value) + if not (30 <= keepalive_time <= 235): + raise LisaException( + f"The {setting} configuration is set to {keepalive_time} " + "seconds in this image. Azure Linux 4+ configures TCP " + "keepalive globally instead of using OpenSSH " + "ClientAliveInterval. Please set net.ipv4.tcp_keepalive_time " + "to a value between 30 and 235." + ) + return + ssh = node.tools[Ssh] setting = "ClientAliveInterval" value = ssh.get(setting)