Whamcloud - gitweb
LU-16822 tests: Modify local_node to check for IPv6 63/55463/4
authorChris Horn <chris.horn@hpe.com>
Mon, 17 Jun 2024 18:09:06 +0000 (12:09 -0600)
committerOleg Drokin <green@whamcloud.com>
Mon, 8 Jul 2024 20:08:21 +0000 (20:08 +0000)
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 <chris.horn@hpe.com>
Change-Id: Id3471376dbb2089a44b00ed7cb9bc2256e5e7501
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55463
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: James Simmons <jsimmons@infradead.org>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Frank Sehr <fsehr@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/sanity-lnet.sh
lustre/tests/test-framework.sh

index 1443c7d..12774c9 100755 (executable)
@@ -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") ]] &&
index 3507ee6..fb20184 100755 (executable)
@@ -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}
 }