Whamcloud - gitweb
LU-14654 tests: Ensure recovery_limit zero works as expected
[fs/lustre-release.git] / lustre / tests / sanity-lnet.sh
index 74eb19a..7b1bd61 100755 (executable)
@@ -1844,13 +1844,16 @@ test_211() {
        # Set health to force it back onto the recovery queue. Set to 500 means
        # in 5 seconds it should be back at maximum value. We'll wait a couple
        # more seconds than that to be safe.
-       # NB: we need to increase the recovery limit so the peer NI is
+       # NB: we reset the recovery limit to 0 (indefinite) so the peer NI is
        # eligible again
-       do_lnetctl set recovery_limit 50 ||
+       do_lnetctl set recovery_limit 0 ||
                error "failed to set recovery_limit"
 
        $LNETCTL peer set --nid $prim_nid --health 500
 
+       check_nid_in_recovq "-p" 1
+       check_ping_count "peer_ni" "2"
+
        sleep 7
 
        check_nid_in_recovq "-p" 0
@@ -1960,6 +1963,34 @@ test_212() {
 }
 run_test 212 "Check discovery refcount loss bug (LU-14627)"
 
+test_213() {
+       have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
+
+       cleanup_netns || error "Failed to cleanup netns before test execution"
+       cleanup_lnet || error "Failed to unload modules before test execution"
+
+       setup_fakeif || error "Failed to add fake IF"
+       have_interface "$FAKE_IF" ||
+               error "Expect $FAKE_IF configured but not found"
+
+       reinit_dlc || return $?
+
+       add_net "tcp" "eth0" || return $?
+       add_net "tcp" "$FAKE_IF" || return $?
+
+       local nid1=$(lctl list_nids | head -n 1)
+       local nid2=$(lctl list_nids | tail --lines 1)
+
+       [[ $(lctl which_nid $nid1 $nid2) == $nid1 ]] ||
+               error "Expect nid1 \"$nid1\" to be preferred"
+
+       [[ $(lctl which_nid $nid2 $nid1) == $nid2 ]] ||
+               error "Expect nid2 \"$nid2\" to be preferred"
+
+       return 0
+}
+run_test 213 "Check LNetDist calculation for multiple local NIDs"
+
 test_300() {
        # LU-13274
        local header
@@ -1976,9 +2007,11 @@ test_300() {
        cleanup_lnet || exit 1
        load_lnet
 
+       local cc_args="-Wall -Werror -std=c99 -c -x c /dev/null -o $out"
        if ! [[ -d $prefix ]]; then
                # Assume we're running in tree and fixup the include path.
                prefix=$LUSTRE/../lnet/include/uapi/linux/lnet
+               cc_args+=" -I $LUSTRE/../lnet/include/uapi"
        fi
 
        for header in $prefix/*.h; do
@@ -1986,7 +2019,8 @@ test_300() {
                        continue
                fi
 
-               $CC -Wall -Werror -std=c99 -include $header -c -x c /dev/null -o $out ||
+               echo "$CC $cc_args -include $header"
+               $CC $cc_args -include $header ||
                        error "cannot compile '$header'"
        done
        rm -f $out