Whamcloud - gitweb
LU-14854 mdd: proper handle error in mdd_swap_layouts()
[fs/lustre-release.git] / lustre / tests / sanity-lnet.sh
index 485e105..c33e7b8 100755 (executable)
@@ -1072,6 +1072,8 @@ net:
               peer_credits: 8
               peer_buffer_credits: 0
               credits: 256
+         lnd tunables:
+             conns_per_peer: 1
 route:
     - net: tcp7
       gateway: 7.7.7.7@tcp
@@ -1105,6 +1107,8 @@ net:
               peer_credits: 8
               peer_buffer_credits: 0
               credits: 256
+         lnd tunables:
+             conns_per_peer: 1
 route:
     - net: tcp8
       gateway: 8.8.8.10@tcp
@@ -1844,13 +1848,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
@@ -1988,6 +1995,43 @@ test_213() {
 }
 run_test 213 "Check LNetDist calculation for multiple local NIDs"
 
+test_230() {
+       # LU-12815
+       have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
+
+       echo "Check valid values; Should succeed"
+       local i
+       local lnid
+       for ((i = 4; i < 16; i+=4)); do
+               reinit_dlc || return $?
+               add_net "tcp" "eth0" || return $?
+               do_lnetctl net set --all --conns-per-peer $i ||
+                       error "should have succeeded $?"
+               $LNETCTL net show -v 1 | grep -q "conns_per_peer: $i" ||
+                       error "failed to set conns-per-peer to $i"
+               lnid="$(lctl list_nids | head -n 1)"
+               do_lnetctl ping "$lnid" ||
+                       error "failed to ping myself"
+               printf 'network tcp\nconn_list\n' | lctl | grep -c "$lnid" | grep -q $((2+i*2)) ||
+                       error "expected number of tcp connections $((2+i*2))"
+       done
+
+       reinit_dlc || return $?
+       add_net "tcp" "eth0" || return $?
+       echo "Set > 127; Should fail"
+       do_lnetctl net set --all --conns-per-peer 128 &&
+               error "should have failed $?"
+
+       reinit_dlc || return $?
+       add_net "tcp" "eth0" || return $?
+       echo "Set < 0; Should be ignored"
+       do_lnetctl net set --all --conns-per-peer -1 ||
+               error "should have succeeded $?"
+       $LNETCTL net show -v 1 | grep -q "conns_per_peer: 1" ||
+               error "Did not stay at default"
+}
+run_test 230 "Test setting conns-per-peer"
+
 test_300() {
        # LU-13274
        local header
@@ -2004,9 +2048,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
@@ -2014,7 +2060,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