From 1bbb066512ba6bc39253e2f7d3a020634d7e9f2a Mon Sep 17 00:00:00 2001 From: Chris Horn Date: Mon, 17 Jun 2024 12:09:06 -0600 Subject: [PATCH] LU-16822 tests: Modify local_node to check for IPv6 Nodes may be configured with just IPv6 addresses, so local_node() needs to look for both IPv4 and IPv6 addresses to determine if a given host is local. sanity-lnet/110 is re-written so that it does not rely on local_addr_list(). Otherwise the test may attempt to configure an NI using an invalid address. This test case can now execute on o2ib configs. Signed-off-by: Chris Horn Change-Id: Id3471376dbb2089a44b00ed7cb9bc2256e5e7501 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55463 Tested-by: jenkins Tested-by: James Simmons Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Frank Sehr Reviewed-by: Oleg Drokin --- lustre/tests/sanity-lnet.sh | 32 ++++++++++++++++---------------- lustre/tests/test-framework.sh | 12 ++++++++---- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/lustre/tests/sanity-lnet.sh b/lustre/tests/sanity-lnet.sh index 1443c7d..12774c9 100755 --- a/lustre/tests/sanity-lnet.sh +++ b/lustre/tests/sanity-lnet.sh @@ -1778,31 +1778,31 @@ test_109() { run_test 109 "Add NI using a network interface alias (LU-16859)" test_110() { - [[ ${NETTYPE} == tcp* ]] || skip "Need tcp NETTYPE" + [[ $NETTYPE =~ (tcp|o2ib) ]] || skip "Need tcp or o2ib NETTYPE" - cleanup_netns || error "Failed to cleanup netns before test execution" - cleanup_lnet || error "Failed to unload modules before test execution" + reinit_dlc || return $? - configure_dlc || error "Failed to configure DLC rc = $?" + add_net ${NETTYPE} ${INTERFACES[0]} || return $? - LOCAL_ADDR_LIST=$(local_addr_list) - set -- $LOCAL_ADDR_LIST - do_lnetctl net add --nid $2@tcp || - error "Failed to add net tcp for IP $2@tcp" + local nid=$($LCTL list_nids) + + reinit_dlc || return $? - $LNETCTL net show --net tcp | grep -q "nid: $2@tcp" || - error "Failed to configure $2@tcp" + do_lnetctl net add --nid $nid || + error "Failed to add net via nid \"$nid\"" - do_lnetctl net del --nid $2@tcp || - error "Failed to del net tcp for IP $2@tcp" + $LNETCTL net show --net $NETTYPE | grep -q "nid: $nid" || + error "Failed to configure $nid" - $LNETCTL net show | grep -q "nid: $2@tcp"&& - error "$2@tcp should have been deleted" + do_lnetctl net del --nid $nid || + error "Failed to del net via nid \"$nid\"" + + $LNETCTL net show | grep -q "nid: $nid" && + error "$nid should have been deleted" cleanup_lnet - setup_netns } -run_test 110 "Add NI using a specific TCP / IP address" +run_test 110 "Configure NI using lnetctl net add --nid" test_111() { [[ $(uname -r | grep "3.10") ]] && diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 3507ee6..fb20184 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -7695,7 +7695,7 @@ host_id() { # Description: # Returns list of ip addresses for each interface local_addr_list() { - ip addr | awk '/inet / {print $2}' | awk -F/ '{print $1}' + ip -o a s | awk '{print $4}' | awk -F/ '{print $1}' } # Description: @@ -7752,9 +7752,13 @@ local_node() { if [ -z "${!is_local-}" ] ; then eval $is_local=false - local host_ip=$(getent ahostsv4 $host_name | - awk 'NR == 1 { print $1 }') - is_local_addr "$host_ip" && eval $is_local=true + local ip4=$(getent ahostsv4 $host_name | + awk 'NR == 1 { print $1 }') + local ip6=$(getent ahostsv6 $host_name | + awk 'NR == 1 { print $1 }') + if is_local_addr $ip4 || is_local_addr $ip6 ; then + eval $is_local=true + fi fi ${!is_local} } -- 1.8.3.1