From f7d35232ccdaefb48a06ffee002f32c38d99dc69 Mon Sep 17 00:00:00 2001 From: Phil Henderson Date: Fri, 6 Sep 2024 11:11:11 -0400 Subject: [PATCH] DAOS-16484 test: Support mixed speeds when selecting a default interface (#15050) (#15080) Allow selecting a default interface that is running at a different speed on different hosts. Primarily this is to support selecting the ib0 interface by default when the launch node has a slower ib0 interface than the cluster hosts. Signed-off-by: Phil Henderson --- src/tests/ftest/util/environment_utils.py | 3 ++- src/tests/ftest/util/network_utils.py | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/tests/ftest/util/environment_utils.py b/src/tests/ftest/util/environment_utils.py index 8223063a85e..e36d750500e 100644 --- a/src/tests/ftest/util/environment_utils.py +++ b/src/tests/ftest/util/environment_utils.py @@ -9,6 +9,7 @@ from ClusterShell.NodeSet import NodeSet # pylint: disable=import-error,no-name-in-module +from util.host_utils import get_local_host from util.network_utils import (PROVIDER_ALIAS, SUPPORTED_PROVIDERS, NetworkException, get_common_provider, get_fastest_interface) from util.run_utils import run_remote @@ -326,7 +327,7 @@ def _default_interface(self, logger, hosts): # Find all the /sys/class/net interfaces on the launch node (excluding lo) logger.debug("Detecting network devices - D_INTERFACE not set") try: - interface = get_fastest_interface(logger, hosts) + interface = get_fastest_interface(logger, hosts | get_local_host()) except NetworkException as error: raise TestEnvironmentException("Error obtaining a default interface!") from error return interface diff --git a/src/tests/ftest/util/network_utils.py b/src/tests/ftest/util/network_utils.py index 52ba2420964..e3802364d8f 100644 --- a/src/tests/ftest/util/network_utils.py +++ b/src/tests/ftest/util/network_utils.py @@ -405,11 +405,12 @@ def get_fastest_interface(logger, hosts, verbose=True): for interface in common_interfaces: detected_speeds = get_interface_speeds(logger, hosts, interface, verbose) speed_list = [] + speed_hosts = NodeSet() for speed, node_set in detected_speeds.items(): - if node_set == hosts: - # Only include detected homogeneous interface speeds - speed_list.append(speed) - if speed_list: + speed_list.append(speed) + speed_hosts.add(node_set) + if speed_list and speed_hosts == hosts: + # Only include interface speeds if a speed is detected on all the hosts interface_speeds[interface] = min(speed_list) logger.info("Active network interface speeds on %s:", hosts)