3 # Run select tests by setting ONLY, or as arguments to the script.
4 # Skip specific tests by setting EXCEPT.
11 # bug number for skipped test:
12 ALWAYS_EXCEPT="$SANITY_LNET_EXCEPT "
13 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
15 # skip the grant tests for ARM until they are fixed
16 if [[ $(uname -m) = aarch64 ]]; then
17 # bug number: LU-14067
21 [ "$SLOW" = "no" ] && EXCEPT_SLOW=""
23 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
25 . $LUSTRE/tests/test-framework.sh
29 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
34 [[ -z $LNETCTL ]] && skip "Need lnetctl"
38 if is_mounted $MOUNT || is_mounted $MOUNT2; then
39 cleanupall || error "Failed cleanup prior to test execution"
44 echo "Cleaning up LNet"
45 lsmod | grep -q lnet &&
46 $LNETCTL lnet unconfigure 2>/dev/null
51 if module_loaded lnet ; then
52 cleanup_lnet || error "Failed to unload modules before test execution"
58 rm -f $TMP/sanity-dlc*
61 if $restore_mounts; then
62 setupall || error "Failed to setup Lustre after test execution"
63 elif $restore_modules; then
65 error "Couldn't load modules after test execution"
71 load_module ../libcfs/libcfs/libcfs
72 # Prevent local MODOPTS_LIBCFS being passed as part of environment
73 # variable to remote nodes
76 set_default_debug "neterror net nettrace malloc"
77 load_module ../lnet/lnet/lnet "$@"
79 LNDPATH=${LNDPATH:-"../lnet/klnds"}
80 if [ -z "$LNETLND" ]; then
82 o2ib*) LNETLND="o2iblnd/ko2iblnd" ;;
83 tcp*) LNETLND="socklnd/ksocklnd" ;;
84 *) local lnd="${NETTYPE%%[0-9]}lnd"
85 [ -f "$LNDPATH/$lnd/k$lnd.ko" ] &&
86 LNETLND="$lnd/k$lnd" ||
87 LNETLND="socklnd/ksocklnd"
90 load_module ../lnet/klnds/$LNETLND
102 echo "ip netns exec $TESTNS $@"
103 ip netns exec $TESTNS "$@"
111 netns_arg="netns $netns"
113 ip link add 'test1pl' type veth peer name $FAKE_IF $netns_arg
114 ip link set 'test1pl' up
115 if [[ -n $netns ]]; then
116 do_ns ip addr add "${FAKE_IP}/31" dev $FAKE_IF
117 do_ns ip link set $FAKE_IF up
119 ip addr add "${FAKE_IP}/31" dev $FAKE_IF
120 ip link set $FAKE_IF up
125 ip link show test1pl >& /dev/null && ip link del test1pl || return 0
136 (ip netns list | grep -q $TESTNS) && ip netns del $TESTNS
141 echo "Loading LNet and configuring DLC"
143 do_lnetctl lnet configure
146 GLOBAL_YAML_FILE=$TMP/sanity-lnet-global.yaml
147 define_global_yaml() {
148 $LNETCTL export --backup >${GLOBAL_YAML_FILE} ||
149 error "Failed to export global yaml $?"
153 if lsmod | grep -q lnet; then
154 do_lnetctl lnet unconfigure ||
155 error "lnetctl lnet unconfigure failed $?"
156 do_lnetctl lnet configure ||
157 error "lnetctl lnet configure failed $?"
159 configure_dlc || error "configure_dlc failed $?"
164 append_global_yaml() {
165 [[ ! -e ${GLOBAL_YAML_FILE} ]] &&
166 error "Missing global yaml at ${GLOBAL_YAML_FILE}"
168 cat ${GLOBAL_YAML_FILE} >> $TMP/sanity-lnet-$testnum-expected.yaml
171 create_base_yaml_file() {
175 compare_yaml_files() {
176 local expected="$TMP/sanity-lnet-$testnum-expected.yaml"
177 local actual="$TMP/sanity-lnet-$testnum-actual.yaml"
179 ! [[ -e $expected ]] && echo "$expected not found" && return 1
180 ! [[ -e $actual ]] && echo "$actual not found" && return 1
181 diff -upN ${actual} ${expected} || rc=$?
191 local net="${nid//*@/}"
192 local addr="${nid//@*/}"
194 local num_re='[0-9]\+'
195 local ip_re="[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"
197 if [[ $net =~ gni[0-9]* ]]; then
198 [[ $addr =~ ${num_re} ]] && return 0
200 [[ $addr =~ ${ip_re} ]] && return 0
205 local yfile=$TMP/sanity-lnet-$testnum-actual.yaml
206 local primary_nids=$(awk '/- primary nid:/{print $NF}' $yfile | xargs echo)
207 local secondary_nids=$(awk '/- nid:/{print $NF}' $yfile | xargs echo)
208 local gateway_nids=$(awk '/gateway:/{print $NF}' $yfile | xargs echo)
211 for nid in $primary_nids $secondary_nids; do
212 validate_nid "$nid" || error "Bad NID \"${nid}\""
217 validate_peer_nids() {
219 local nids_per_peer="$2"
221 local expect_p="$num_peers"
222 # The primary nid also shows up in the list of secondary nids
223 local expect_s="$(($num_peers + $(($nids_per_peer*$num_peers))))"
225 local actual_p=$(grep -c -- '- primary nid:' $TMP/sanity-lnet-$testnum-actual.yaml)
226 local actual_s=$(grep -c -- '- nid:' $TMP/sanity-lnet-$testnum-actual.yaml)
227 if [[ $expect_p -ne $actual_p ]]; then
229 error "Expected $expect_p but found $actual_p primary nids"
230 elif [[ $expect_s -ne $actual_s ]]; then
232 error "Expected $expect_s but found $actual_s secondary nids"
237 validate_gateway_nids() {
238 local expect_gw=$(grep -c -- 'gateway:' $TMP/sanity-lnet-$testnum-expected.yaml)
239 local actual_gw=$(grep -c -- 'gateway:' $TMP/sanity-lnet-$testnum-actual.yaml)
240 if [[ $expect_gw -ne $actual_gw ]]; then
242 error "Expected $expect_gw gateways but found $actual_gw gateways"
248 setup_netns || error "setup_netns failed with $?"
250 stack_trap 'cleanup_testsuite' EXIT
253 load_module ../lnet/lnet/lnet || error "Failed to load module rc = $?"
254 do_lnetctl lnet configure || error "lnet configure failed rc = $?"
256 reinit_dlc || return $?
257 do_lnetctl import < ${GLOBAL_YAML_FILE} || error "Import failed $?"
258 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
259 create_base_yaml_file
260 compare_yaml_files || error "Configuration changed after import"
262 run_test 0 "Export empty config, import the config, compare"
265 local prim_nid="${1:+--prim_nid $1}"
266 local nid="${2:+--nid $2}"
268 local actual="$TMP/sanity-lnet-$testnum-actual.yaml"
270 do_lnetctl peer add ${prim_nid} ${nid} || error "peer add failed $?"
271 $LNETCTL export --backup > $actual || error "export failed $?"
277 reinit_dlc || return $?
278 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
280 - primary nid: 1.1.1.1@tcp
286 compare_peer_add "1.1.1.1@tcp"
288 run_test 1 "Add peer with single nid (tcp)"
291 reinit_dlc || return $?
292 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
294 - primary nid: 2.2.2.2@o2ib
300 compare_peer_add "2.2.2.2@o2ib"
302 run_test 2 "Add peer with single nid (o2ib)"
305 reinit_dlc || return $?
306 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
308 - primary nid: 3.3.3.3@tcp
315 compare_peer_add "3.3.3.3@tcp" "3.3.3.3@o2ib"
317 run_test 3 "Add peer with tcp primary o2ib secondary"
320 reinit_dlc || return $?
321 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
323 - primary nid: 4.4.4.4@tcp
332 echo "Add peer with nidrange (tcp)"
333 compare_peer_add "4.4.4.4@tcp" "4.4.4.[1-3]@tcp"
335 echo "Add peer with nidrange that overlaps primary nid (tcp)"
336 compare_peer_add "4.4.4.4@tcp" "4.4.4.[1-4]@tcp"
338 run_test 4 "Add peer with nidrange (tcp)"
341 reinit_dlc || return $?
342 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
344 - primary nid: 5.5.5.5@o2ib
354 echo "Add peer with nidrange (o2ib)"
355 compare_peer_add "5.5.5.5@o2ib" "5.5.5.[1-4]@o2ib"
357 echo "Add peer with nidranage that overlaps primary nid (o2ib)"
358 compare_peer_add "5.5.5.5@o2ib" "5.5.5.[1-4]@o2ib"
360 run_test 5 "Add peer with nidrange (o2ib)"
363 reinit_dlc || return $?
364 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
366 - primary nid: 6.6.6.6@tcp
386 compare_peer_add "6.6.6.6@tcp" \
387 "6.6.[6-7].[0-4/2]@tcp,6.6.[1-4/2].[0-6/3]@o2ib,[6-12/4]@gni"
389 run_test 6 "Add peer with multiple nidranges"
392 local prim_nid="${1:+--prim_nid $1}"
393 local nid="${2:+--nid $2}"
395 local actual="$TMP/sanity-lnet-$testnum-actual.yaml"
397 do_lnetctl peer del ${prim_nid} ${nid} || error "peer del failed $?"
398 $LNETCTL export --backup > $actual || error "export failed $?"
404 reinit_dlc || return $?
405 create_base_yaml_file
407 echo "Delete peer with single nid (tcp)"
408 do_lnetctl peer add --prim_nid 7.7.7.7@tcp || error "Peer add failed $?"
409 compare_peer_del "7.7.7.7@tcp"
411 echo "Delete peer with single nid (o2ib)"
412 do_lnetctl peer add --prim_nid 7.7.7.7@o2ib || error "Peer add failed $?"
413 compare_peer_del "7.7.7.7@o2ib"
415 echo "Delete peer that has multiple nids (tcp)"
416 do_lnetctl peer add --prim_nid 7.7.7.7@tcp --nid 7.7.7.[8-12]@tcp ||
417 error "Peer add failed $?"
418 compare_peer_del "7.7.7.7@tcp"
420 echo "Delete peer that has multiple nids (o2ib)"
421 do_lnetctl peer add --prim_nid 7.7.7.7@o2ib --nid 7.7.7.[8-12]@o2ib ||
422 error "Peer add failed $?"
423 compare_peer_del "7.7.7.7@o2ib"
425 echo "Delete peer that has both tcp and o2ib nids"
426 do_lnetctl peer add --prim_nid 7.7.7.7@tcp \
427 --nid 7.7.7.[9-12]@tcp,7.7.7.[13-15]@o2ib ||
428 error "Peer add failed $?"
429 compare_peer_del "7.7.7.7@tcp"
431 echo "Delete peer with single nid (gni)"
432 do_lnetctl peer add --prim_nid 7@gni || error "Peer add failed $?"
433 compare_peer_del "7@gni"
435 echo "Delete peer that has multiple nids (gni)"
436 do_lnetctl peer add --prim_nid 7@gni --nid [8-12]@gni ||
437 error "Peer add failed $?"
438 compare_peer_del "7@gni"
440 echo "Delete peer that has tcp, o2ib and gni nids"
441 do_lnetctl peer add --prim_nid 7@gni \
442 --nid [8-12]@gni,7.7.7.[9-12]@tcp,7.7.7.[13-15]@o2ib ||
443 error "Peer add failed $?"
444 compare_peer_del "7@gni"
446 run_test 7 "Various peer delete tests"
449 reinit_dlc || return $?
451 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
453 - primary nid: 8.8.8.8@tcp
465 do_lnetctl peer add --prim_nid 8.8.8.8@tcp --nid 8.8.8.[10-15]@tcp ||
466 error "Peer add failed $?"
467 compare_peer_del "8.8.8.8@tcp" "8.8.8.13@tcp"
469 run_test 8 "Delete single secondary nid from peer (tcp)"
472 reinit_dlc || return $?
474 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
476 - primary nid: 9.9.9.9@tcp
483 do_lnetctl peer add --prim_nid 9.9.9.9@tcp \
484 --nid 9.9.9.[11-16]@tcp || error "Peer add failed $?"
485 compare_peer_del "9.9.9.9@tcp" "9.9.9.[11-16]@tcp"
487 run_test 9 "Delete all secondary nids from peer (tcp)"
490 reinit_dlc || return $?
492 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
494 - primary nid: 10.10.10.10@tcp
497 - nid: 10.10.10.10@tcp
498 - nid: 10.10.10.12@tcp
499 - nid: 10.10.10.13@tcp
500 - nid: 10.10.10.15@tcp
501 - nid: 10.10.10.16@tcp
504 do_lnetctl peer add --prim_nid 10.10.10.10@tcp \
505 --nid 10.10.10.[12-16]@tcp || error "Peer add failed $?"
506 compare_peer_del "10.10.10.10@tcp" "10.10.10.14@tcp"
508 run_test 10 "Delete single secondary nid from peer (o2ib)"
511 reinit_dlc || return $?
513 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
515 - primary nid: 11.11.11.11@tcp
518 - nid: 11.11.11.11@tcp
521 do_lnetctl peer add --prim_nid 11.11.11.11@tcp \
522 --nid 11.11.11.[13-17]@tcp || error "Peer add failed $?"
523 compare_peer_del "11.11.11.11@tcp" "11.11.11.[13-17]@tcp"
525 run_test 11 "Delete all secondary nids from peer (o2ib)"
528 reinit_dlc || return $?
530 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
532 - primary nid: 12.12.12.12@o2ib
535 - nid: 12.12.12.12@o2ib
536 - nid: 13.13.13.13@o2ib
537 - nid: 14.13.13.13@o2ib
538 - nid: 14.15.13.13@o2ib
540 - nid: 15.17.1.10@tcp
541 - nid: 15.17.1.20@tcp
544 do_lnetctl peer add --prim_nid 12.12.12.12@o2ib \
545 --nid [13-14/1].[13-15/2].13.13@o2ib,[15-16/3].[17-19/4].[1].[5-20/5]@tcp ||
546 error "Peer add failed $?"
547 compare_peer_del "12.12.12.12@o2ib" "13.15.13.13@o2ib,15.17.1.15@tcp"
549 run_test 12 "Delete a secondary nid from peer (tcp and o2ib)"
552 reinit_dlc || return $?
554 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
556 - primary nid: 13.13.13.13@o2ib
559 - nid: 13.13.13.13@o2ib
562 do_lnetctl peer add --prim_nid 13.13.13.13@o2ib \
563 --nid [14-15].[1-2/1].[1].[100-254/10]@tcp,14.14.[254].14@o2ib ||
564 error "Peer add failed $?"
565 compare_peer_del "13.13.13.13@o2ib" \
566 "[14-15].[1-2/1].[1].[100-254/10]@tcp,14.14.[254].14@o2ib"
568 run_test 13 "Delete all secondary nids from peer (tcp and o2ib)"
574 if [[ $net =~ gni* ]]; then
577 echo "${num}.${num}.${num}.${num}@${net}"
581 create_mr_peer_yaml() {
583 local secondary_nids="$2"
586 echo "Generating peer yaml for $num_peers peers with $secondary_nids secondary nids"
587 echo "peer:" >> $TMP/sanity-lnet-$testnum-expected.yaml
589 local total_nids=$((num_peers + $((num_peers * secondary_nids))))
592 while [[ $created -lt $num_peers ]]; do
593 local primary=$(create_nid ${nidnum} ${net})
594 cat <<EOF >> $TMP/sanity-lnet-$testnum-expected.yaml
595 - primary nid: $primary
601 local start=$((nidnum + 1))
602 local end=$((nidnum + $secondary_nids))
603 for j in $(seq ${start} ${end}); do
604 local nid=$(create_nid $j ${net})
605 echo " - nid: $nid" >> $TMP/sanity-lnet-$testnum-expected.yaml
613 reinit_dlc || return $?
615 echo "Create single peer, single nid, using import"
616 create_mr_peer_yaml 1 0 tcp
617 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
618 error "Import failed $?"
620 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
623 echo "Delete single peer using import --del"
624 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml ||
625 error "Import failed $?"
626 rm -f $TMP/sanity-lnet-$testnum-expected.yaml
627 create_base_yaml_file
628 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
631 run_test 14 "import peer create/delete with single nid"
634 reinit_dlc || return $?
636 echo "Create multiple peers, single nid per peer, using import"
637 create_mr_peer_yaml 5 0 o2ib
638 # The ordering of nids for this use-case is non-deterministic, so we
639 # we can't just diff the expected/actual output.
640 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
641 error "Import failed $?"
642 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
643 validate_peer_nids 5 0
645 echo "Delete multiple peers, single nid per peer, using import --del"
646 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml ||
647 error "Import failed $?"
648 rm -f $TMP/sanity-lnet-$testnum-expected.yaml
649 create_base_yaml_file
650 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
653 run_test 15 "import multi peer create/delete with single nid per peer"
656 reinit_dlc || return $?
658 echo "Create single peer, multiple nids, using import"
659 create_mr_peer_yaml 1 5 tcp
660 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
661 error "Import failed $?"
662 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
663 validate_peer_nids 1 5
665 echo "Delete single peer, multiple nids, using import --del"
666 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml ||
667 error "Import failed $?"
668 rm -f $TMP/sanity-lnet-$testnum-expected.yaml
669 create_base_yaml_file
670 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
673 run_test 16 "import peer create/delete with multiple nids"
676 reinit_dlc || return $?
678 echo "Create multiple peers, multiple nids per peer, using import"
679 create_mr_peer_yaml 5 7 o2ib
680 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
681 error "Import failed $?"
682 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
683 validate_peer_nids 5 7
685 echo "Delete multiple peers, multiple nids per peer, using import --del"
686 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml ||
687 error "Import failed $?"
688 rm -f $TMP/sanity-lnet-$testnum-expected.yaml
689 create_base_yaml_file
690 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
693 run_test 17 "import multi peer create/delete with multiple nids"
696 reinit_dlc || return $?
698 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
700 - primary nid: 1.1.1.1@tcp
709 echo "Import peer with 5 nids"
710 cat $TMP/sanity-lnet-$testnum-expected.yaml
711 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
712 error "Import failed $?"
713 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
715 - primary nid: 1.1.1.1@tcp
722 echo "Delete three of the nids"
723 cat $TMP/sanity-lnet-$testnum-expected.yaml
724 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml
725 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
727 - primary nid: 1.1.1.1@tcp
733 echo "Check peer has expected nids remaining"
734 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
738 run_test 18a "Delete a subset of nids from a single peer using import --del"
741 reinit_dlc || return $?
743 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
745 - primary nid: 1.1.1.1@tcp
753 - primary nid: 6.6.6.6@o2ib
762 echo "Import two peers with 5 nids each"
763 cat $TMP/sanity-lnet-$testnum-expected.yaml
764 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
765 error "Import failed $?"
766 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
768 - primary nid: 1.1.1.1@tcp
774 - primary nid: 6.6.6.6@o2ib
781 echo "Delete three of the nids from each peer"
782 cat $TMP/sanity-lnet-$testnum-expected.yaml
783 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml
784 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
786 - primary nid: 6.6.6.6@o2ib
791 - primary nid: 1.1.1.1@tcp
798 echo "Check peers have expected nids remaining"
799 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
801 validate_peer_nids 2 1
803 run_test 18b "Delete multiple nids from multiple peers using import --del"
806 reinit_dlc || return $?
807 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
809 - primary nid: 19@gni
815 compare_peer_add "19@gni"
817 run_test 19 "Add peer with single nid (gni)"
820 reinit_dlc || return $?
821 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
823 - primary nid: 20@gni
827 - nid: 20.20.20.20@tcp
828 - nid: 20.20.20.20@o2ib
831 compare_peer_add "20@gni" "20.20.20.20@tcp,20.20.20.20@o2ib"
833 run_test 20 "Add peer with gni primary and tcp, o2ib secondary"
836 reinit_dlc || return $?
837 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
839 - primary nid: 21@gni
849 echo "Add peer with nidrange (gni)"
850 compare_peer_add "21@gni" "[22-25]@gni" || error
851 echo "Add peer with nidrange that overlaps primary nid (gni)"
852 compare_peer_add "21@gni" "[21-25]@gni"
854 run_test 21 "Add peer with nidrange (gni)"
857 reinit_dlc || return $?
858 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
860 - primary nid: 22@gni
871 do_lnetctl peer add --prim_nid 22@gni --nid [24-29]@gni ||
872 error "Peer add failed $?"
873 compare_peer_del "22@gni" "26@gni"
875 run_test 22 "Delete single secondary nid from peer (gni)"
878 reinit_dlc || return $?
879 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
881 - primary nid: 23@gni
888 do_lnetctl peer add --prim_nid 23@gni --nid [25-29]@gni ||
889 error "Peer add failed $?"
890 compare_peer_del "23@gni" "[25-29]@gni"
892 run_test 23 "Delete all secondary nids from peer (gni)"
895 reinit_dlc || return $?
896 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
898 - primary nid: 24@gni
903 - nid: 13.13.13.13@o2ib
904 - nid: 14.13.13.13@o2ib
905 - nid: 14.15.13.13@o2ib
907 - nid: 15.17.1.10@tcp
908 - nid: 15.17.1.20@tcp
911 do_lnetctl peer add --prim_nid 24@gni \
912 --nid [13-14/1].[13-15/2].13.13@o2ib,[15-16/3].[17-19/4].[1].[5-20/5]@tcp,[5-12/6]@gni ||
913 error "Peer add failed $?"
914 compare_peer_del "24@gni" "5@gni,13.15.13.13@o2ib,15.17.1.15@tcp"
916 run_test 24 "Delete a secondary nid from peer (tcp, o2ib and gni)"
919 reinit_dlc || return $?
920 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
922 - primary nid: 25@gni
928 do_lnetctl peer add --prim_nid 25@gni \
929 --nid [26-27].[4-10/3].26.26@tcp,26.26.26.26@o2ib,[30-35]@gni ||
930 error "Peer add failed $?"
931 compare_peer_del "25@gni" \
932 "[26-27].[4-10/3].26.26@tcp,26.26.26.26@o2ib,[30-35]@gni"
934 run_test 25 "Delete all secondary nids from peer (tcp, gni and o2ib)"
937 reinit_dlc || return $?
939 echo "Invalid prim_nid - peer add"
940 do_lnetctl peer add --prim_nid foobar &&
941 error "Command should have failed"
943 echo "Invalid prim_nid - peer del"
944 do_lnetctl peer del --prim_nid foobar &&
945 error "Command should have failed"
947 echo "Delete non-existing peer"
948 do_lnetctl peer del --prim_nid 1.1.1.1@o2ib &&
949 error "Command should have failed"
951 echo "Don't provide mandatory argument for peer del"
952 do_lnetctl peer del --nid 1.1.1.1@tcp &&
953 error "Command should have failed"
955 echo "Don't provide mandatory argument for peer add"
956 do_lnetctl peer add --nid 1.1.1.1@tcp &&
957 error "Command should have failed"
959 echo "Don't provide mandatory arguments peer add"
960 do_lnetctl peer add &&
961 error "Command should have failed"
963 echo "Invalid secondary nids"
964 do_lnetctl peer add --prim_nid 1.1.1.1@tcp --nid foobar &&
965 error "Command should have failed"
967 echo "Exceed max nids per peer"
968 do_lnetctl peer add --prim_nid 1.1.1.1@tcp --nid 1.1.1.[2-255]@tcp &&
969 error "Command should have failed"
971 echo "Invalid net type"
972 do_lnetctl peer add --prim_nid 1@foo &&
973 error "Command should have failed"
975 echo "Invalid nid format"
976 local invalid_nids="1@tcp 1@o2ib 1.1.1.1@gni"
979 for nid in ${invalid_nids}; do
980 echo "Check invalid primary nid - '$nid'"
981 do_lnetctl peer add --prim_nid $nid &&
982 error "Command should have failed"
985 local invalid_strs="[2-1]@gni [a-f/x]@gni 256.256.256.256@tcp"
986 invalid_strs+=" 1.1.1.1.[2-5/f]@tcp 1.]2[.3.4@o2ib"
987 invalid_strs+="1.[2-4,[5-6],7-8].1.1@tcp foobar"
990 for nidstr in ${invalid_strs}; do
991 echo "Check invalid nidstring - '$nidstr'"
992 do_lnetctl peer add --prim_nid 1.1.1.1@tcp --nid $nidstr &&
993 error "Command should have failed"
996 echo "Add non-local gateway"
997 do_lnetctl route add --net tcp --gateway 1@gni &&
998 error "Command should have failed"
1002 run_test 99a "Check various invalid inputs to lnetctl peer"
1005 reinit_dlc || return $?
1007 create_base_yaml_file
1009 cat <<EOF > $TMP/sanity-lnet-$testnum-invalid.yaml
1011 - primary nid: 99.99.99.99@tcp
1014 - nid: 99.99.99.99@tcp
1016 do_lnetctl import < $TMP/sanity-lnet-$testnum-invalid.yaml &&
1017 error "import should have failed"
1018 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
1021 run_test 99b "Invalid value for Multi-Rail in yaml import"
1025 local ip=$(ip addr show dev $if | awk '/ inet /{print $2}')
1033 if ! lsmod | grep -q ksocklnd ; then
1034 load_module ../lnet/klnds/socklnd/ksocklnd ||
1035 error "Can't load ksocklnd.ko"
1038 do_lnetctl net add --net ${net} --if ${if} ||
1039 error "Failed to add net ${net} on if ${if}"
1042 compare_route_add() {
1046 local actual="$TMP/sanity-lnet-$testnum-actual.yaml"
1048 do_lnetctl route add --net ${rnet} --gateway ${gw} ||
1049 error "route add failed $?"
1050 # CPT configuration is pruned from the exported yaml, since the default
1051 # can vary across test systems (unlike default values for things like
1052 # peer_credits, peer_timeout, etc.)
1053 $LNETCTL export --backup | grep -v CPT > $actual ||
1054 error "export failed $?"
1055 validate_gateway_nids
1060 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1061 reinit_dlc || return $?
1062 add_net "tcp" "eth0"
1063 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
1072 peer_buffer_credits: 0
1076 gateway: 7.7.7.7@tcp
1079 health_sensitivity: 1
1081 - primary nid: 7.7.7.7@tcp
1087 compare_route_add "tcp7" "7.7.7.7@tcp" || return $?
1090 run_test 100 "Add route with single gw (tcp)"
1093 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1094 reinit_dlc || return $?
1095 add_net "tcp" "eth0"
1096 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
1105 peer_buffer_credits: 0
1109 gateway: 8.8.8.10@tcp
1112 health_sensitivity: 1
1114 gateway: 8.8.8.9@tcp
1117 health_sensitivity: 1
1119 gateway: 8.8.8.8@tcp
1122 health_sensitivity: 1
1124 - primary nid: 8.8.8.9@tcp
1128 - primary nid: 8.8.8.10@tcp
1132 - primary nid: 8.8.8.8@tcp
1138 compare_route_add "tcp8" "8.8.8.[8-10]@tcp"
1140 run_test 101 "Add route with multiple gw (tcp)"
1142 compare_route_del() {
1146 local actual="$TMP/sanity-lnet-$testnum-actual.yaml"
1148 do_lnetctl route del --net ${rnet} --gateway ${gw} ||
1149 error "route del failed $?"
1150 $LNETCTL export --backup > $actual ||
1151 error "export failed $?"
1152 validate_gateway_nids
1156 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1157 reinit_dlc || return $?
1158 add_net "tcp" "eth0"
1159 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-expected.yaml
1160 do_lnetctl route add --net tcp102 --gateway 102.102.102.102@tcp ||
1161 error "route add failed $?"
1162 compare_route_del "tcp102" "102.102.102.102@tcp"
1164 run_test 102 "Delete route with single gw (tcp)"
1167 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1168 reinit_dlc || return $?
1169 add_net "tcp" "eth0"
1170 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-expected.yaml
1171 do_lnetctl route add --net tcp103 \
1172 --gateway 103.103.103.[103-120/4]@tcp ||
1173 error "route add failed $?"
1174 compare_route_del "tcp103" "103.103.103.[103-120/4]@tcp"
1176 run_test 103 "Delete route with multiple gw (tcp)"
1179 local tyaml="$TMP/sanity-lnet-$testnum-expected.yaml"
1181 reinit_dlc || return $?
1183 # Default value is '3'
1184 local val=$($LNETCTL global show | awk '/response_tracking/{print $NF}')
1186 error "Expect 3 found $val"
1188 echo "Set < 0; Should fail"
1189 do_lnetctl set response_tracking -1 &&
1190 error "should have failed $?"
1192 reinit_dlc || return $?
1195 response_tracking: -10
1197 do_lnetctl import < $tyaml &&
1198 error "should have failed $?"
1200 echo "Check valid values; Should succeed"
1202 for ((i = 0; i < 4; i++)); do
1203 reinit_dlc || return $?
1204 do_lnetctl set response_tracking $i ||
1205 error "should have succeeded $?"
1206 $LNETCTL global show | grep -q "response_tracking: $i" ||
1207 error "Failed to set response_tracking to $i"
1208 reinit_dlc || return $?
1211 response_tracking: $i
1213 do_lnetctl import < $tyaml ||
1214 error "should have succeeded $?"
1215 $LNETCTL global show | grep -q "response_tracking: $i" ||
1216 error "Failed to set response_tracking to $i"
1219 reinit_dlc || return $?
1220 echo "Set > 3; Should fail"
1221 do_lnetctl set response_tracking 4 &&
1222 error "should have failed $?"
1224 reinit_dlc || return $?
1227 response_tracking: 10
1229 do_lnetctl import < $tyaml &&
1230 error "should have failed $?"
1233 run_test 104 "Set/check response_tracking param"
1235 ### load lnet in default namespace, configure in target namespace
1238 cleanup_lnet || exit 1
1239 load_lnet "networks=\"\""
1240 do_ns $LNETCTL lnet configure --all || exit 1
1241 $LNETCTL net show --net tcp | grep -q "nid: ${FAKE_IP}@tcp$"
1243 run_test 200 "load lnet w/o module option, configure in a non-default namespace"
1246 cleanup_lnet || exit 1
1247 load_lnet "networks=tcp($FAKE_IF)"
1248 do_ns $LNETCTL lnet configure --all || exit 1
1249 $LNETCTL net show --net tcp | grep -q "nid: ${FAKE_IP}@tcp$"
1251 run_test 201 "load lnet using networks module options in a non-default namespace"
1254 cleanup_lnet || exit 1
1255 load_lnet "networks=\"\" ip2nets=\"tcp0($FAKE_IF) ${FAKE_IP}\""
1256 do_ns $LNETCTL lnet configure --all || exit 1
1257 $LNETCTL net show | grep -q "nid: ${FAKE_IP}@tcp$"
1259 run_test 202 "load lnet using ip2nets in a non-default namespace"
1262 ### Add the interfaces in the target namespace
1265 cleanup_lnet || exit 1
1267 do_lnetctl lnet configure || exit 1
1268 do_ns $LNETCTL net add --net tcp0 --if $FAKE_IF
1270 run_test 203 "add a network using an interface in the non-default namespace"
1272 LNET_PARAMS_FILE="$TMP/$TESTSUITE.parameters"
1273 function save_lnet_params() {
1274 $LNETCTL global show | egrep -v '^global:$' |
1275 sed 's/://' > $LNET_PARAMS_FILE
1278 function restore_lnet_params() {
1280 while read param value; do
1281 [[ $param == max_intf ]] && continue
1282 [[ $param == lnd_timeout ]] && continue
1283 $LNETCTL set ${param} ${value} ||
1284 error "Failed to restore ${param} to ${value}"
1285 done < $LNET_PARAMS_FILE
1288 function lnet_health_pre() {
1291 # Lower transaction timeout to speed up test execution
1292 $LNETCTL set transaction_timeout 10 ||
1293 error "Failed to set transaction_timeout $?"
1295 # Increase recovery interval so we have time to capture health values
1296 $LNETCTL set recovery_interval 20 ||
1297 error "Failed to set recovery_interval $?"
1299 RETRY_PARAM=$($LNETCTL global show | awk '/retry_count/{print $NF}')
1300 RSND_PRE=$($LNETCTL stats show | awk '/resend_count/{print $NF}')
1301 LO_HVAL_PRE=$($LNETCTL net show -v 2 | awk '/health value/{print $NF}' |
1302 xargs echo | sed 's/ /+/g' | bc -l)
1304 local my_nid=$($LCTL list_nids | head -n 1)
1306 RMT_HVAL_PRE=$($LNETCTL peer show --nid $my_nid -v 2 2>/dev/null |
1307 awk '/health value/{print $NF}' | xargs echo |
1308 sed 's/ /+/g' | bc -l)
1310 # Might not have any peers so initialize to zero.
1311 RMT_HVAL_PRE=${RMT_HVAL_PRE:-0}
1316 function lnet_health_post() {
1317 RSND_POST=$($LNETCTL stats show | awk '/resend_count/{print $NF}')
1318 LO_HVAL_POST=$($LNETCTL net show -v 2 |
1319 awk '/health value/{print $NF}' |
1320 xargs echo | sed 's/ /+/g' | bc -l)
1322 local my_nid=$($LCTL list_nids | head -n 1)
1324 RMT_HVAL_POST=$($LNETCTL peer show --nid $my_nid -v 2 2>/dev/null |
1325 awk '/health value/{print $NF}' | xargs echo |
1326 sed 's/ /+/g' | bc -l)
1328 # Might not have any peers so initialize to zero.
1329 RMT_HVAL_POST=${RMT_HVAL_POST:-0}
1332 echo "Pre resends: $RSND_PRE" &&
1333 echo "Post resends: $RSND_POST" &&
1334 echo "Resends delta: $((RSND_POST - RSND_PRE))" &&
1335 echo "Pre local health: $LO_HVAL_PRE" &&
1336 echo "Post local health: $LO_HVAL_POST" &&
1337 echo "Pre remote health: $RMT_HVAL_PRE" &&
1338 echo "Post remote health: $RMT_HVAL_POST"
1345 function check_no_resends() {
1346 echo "Check that no resends took place"
1347 [[ $RSND_POST -ne $RSND_PRE ]] &&
1348 error "Found resends: $RSND_POST != $RSND_PRE"
1353 function check_resends() {
1354 local delta=$((RSND_POST - RSND_PRE))
1356 echo "Check that $RETRY_PARAM resends took place"
1357 [[ $delta -ne $RETRY_PARAM ]] &&
1358 error "Expected $RETRY_PARAM resends found $delta"
1363 function check_no_local_health() {
1364 echo "Check that local NI health is unchanged"
1365 [[ $LO_HVAL_POST -ne $LO_HVAL_PRE ]] &&
1366 error "Local health changed: $LO_HVAL_POST != $LO_HVAL_PRE"
1371 function check_local_health() {
1372 echo "Check that local NI health has been changed"
1373 [[ $LO_HVAL_POST -eq $LO_HVAL_PRE ]] &&
1374 error "Local health unchanged: $LO_HVAL_POST == $LO_HVAL_PRE"
1379 function check_no_remote_health() {
1380 echo "Check that remote NI health is unchanged"
1381 [[ $RMT_HVAL_POST -ne $RMT_HVAL_PRE ]] &&
1382 error "Remote health changed: $RMT_HVAL_POST != $RMT_HVAL_PRE"
1387 function check_remote_health() {
1388 echo "Check that remote NI health has been changed"
1389 [[ $RMT_HVAL_POST -eq $RMT_HVAL_PRE ]] &&
1390 error "Remote health unchanged: $RMT_HVAL_POST == $RMT_HVAL_PRE"
1395 # See lnet/lnet/lib-msg.c:lnet_health_check()
1396 LNET_LOCAL_RESEND_STATUSES="local_interrupt local_dropped local_aborted"
1397 LNET_LOCAL_RESEND_STATUSES+=" local_no_route local_timeout"
1398 LNET_LOCAL_NO_RESEND_STATUSES="local_error"
1400 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1401 reinit_dlc || return $?
1402 add_net "tcp" "eth0" || return $?
1404 lnet_health_pre || return $?
1407 for hstatus in ${LNET_LOCAL_RESEND_STATUSES} \
1408 ${LNET_LOCAL_NO_RESEND_STATUSES}; do
1409 echo "Simulate $hstatus"
1410 $LCTL net_drop_add -s *@tcp -d *@tcp -m GET -r 1 -e ${hstatus}
1411 do_lnetctl discover $($LCTL list_nids | head -n 1) &&
1412 error "Should have failed"
1413 $LCTL net_drop_del *
1418 check_no_resends || return $?
1419 check_no_local_health || return $?
1423 run_test 204 "Check no health or resends for single-rail local failures"
1426 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1429 for hstatus in ${LNET_LOCAL_RESEND_STATUSES}; do
1430 reinit_dlc || return $?
1431 add_net "tcp" "eth0" || return $?
1432 add_net "tcp1" "eth0" || return $?
1434 echo "Simulate $hstatus"
1437 $LCTL net_drop_add -s *@tcp -d *@tcp -m GET -r 1 -e ${hstatus}
1438 $LCTL net_drop_add -s *@tcp1 -d *@tcp1 -m GET -r 1 -e ${hstatus}
1439 do_lnetctl discover $($LCTL list_nids | head -n 1) &&
1440 error "Should have failed"
1441 $LCTL net_drop_del *
1445 check_resends || return $?
1446 check_local_health || return $?
1449 for hstatus in ${LNET_LOCAL_NO_RESEND_STATUSES}; do
1450 reinit_dlc || return $?
1451 add_net "tcp" "eth0" || return $?
1452 add_net "tcp1" "eth0" || return $?
1454 echo "Simulate $hstatus"
1455 lnet_health_pre || return $?
1457 $LCTL net_drop_add -s *@tcp -d *@tcp -m GET -r 1 -e ${hstatus}
1458 $LCTL net_drop_add -s *@tcp1 -d *@tcp1 -m GET -r 1 -e ${hstatus}
1459 do_lnetctl discover $($LCTL list_nids | head -n 1) &&
1460 error "Should have failed"
1461 $LCTL net_drop_del *
1465 check_no_resends || return $?
1466 check_local_health || return $?
1471 run_test 205 "Check health and resends for multi-rail local failures"
1473 # See lnet/lnet/lib-msg.c:lnet_health_check()
1474 LNET_REMOTE_RESEND_STATUSES="remote_dropped"
1475 LNET_REMOTE_NO_RESEND_STATUSES="remote_error remote_timeout"
1477 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1478 reinit_dlc || return $?
1479 add_net "tcp" "eth0" || return $?
1481 do_lnetctl discover $($LCTL list_nids | head -n 1) ||
1482 error "failed to discover myself"
1484 lnet_health_pre || return $?
1487 for hstatus in ${LNET_REMOTE_RESEND_STATUSES} \
1488 ${LNET_REMOTE_NO_RESEND_STATUSES}; do
1489 echo "Simulate $hstatus"
1490 $LCTL net_drop_add -s *@tcp -d *@tcp -m GET -r 1 -e ${hstatus}
1491 do_lnetctl discover $($LCTL list_nids | head -n 1) &&
1492 error "Should have failed"
1493 $LCTL net_drop_del *
1498 check_no_resends || return $?
1499 check_no_local_health || return $?
1500 check_no_remote_health || return $?
1504 run_test 206 "Check no health or resends for single-rail remote failures"
1507 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1510 for hstatus in ${LNET_REMOTE_RESEND_STATUSES}; do
1511 reinit_dlc || return $?
1512 add_net "tcp" "eth0" || return $?
1513 add_net "tcp1" "eth0" || return $?
1515 do_lnetctl discover $($LCTL list_nids | head -n 1) ||
1516 error "failed to discover myself"
1518 echo "Simulate $hstatus"
1519 lnet_health_pre || return $?
1520 $LCTL net_drop_add -s *@tcp -d *@tcp -m GET -r 1 -e ${hstatus}
1521 $LCTL net_drop_add -s *@tcp1 -d *@tcp1 -m GET -r 1 -e ${hstatus}
1522 do_lnetctl discover $($LCTL list_nids | head -n 1) &&
1523 error "Should have failed"
1524 $LCTL net_drop_del *
1528 check_resends || return $?
1529 check_no_local_health || return $?
1530 check_remote_health || return $?
1532 for hstatus in ${LNET_REMOTE_NO_RESEND_STATUSES}; do
1533 reinit_dlc || return $?
1534 add_net "tcp" "eth0" || return $?
1535 add_net "tcp1" "eth0" || return $?
1537 do_lnetctl discover $($LCTL list_nids | head -n 1) ||
1538 error "failed to discover myself"
1540 echo "Simulate $hstatus"
1541 lnet_health_pre || return $?
1542 $LCTL net_drop_add -s *@tcp -d *@tcp -m GET -r 1 -e ${hstatus}
1543 $LCTL net_drop_add -s *@tcp1 -d *@tcp1 -m GET -r 1 -e ${hstatus}
1544 do_lnetctl discover $($LCTL list_nids | head -n 1) &&
1545 error "Should have failed"
1546 $LCTL net_drop_del *
1550 check_no_resends || return $?
1551 check_no_local_health || return $?
1552 check_remote_health || return $?
1557 run_test 207 "Check health and resends for multi-rail remote errors"
1559 test_208_load_and_check_lnet() {
1563 local num_expected=1
1565 load_lnet "networks=\"\" ip2nets=\"${ip2nets_str}\""
1568 error "Failed to load LNet with ip2nets \"${ip2nets_str}\""
1574 nids=( $($LCTL list_nids) )
1576 [[ ${#nids[@]} -ne ${num_expected} ]] &&
1577 error "Expect ${num_expected} NIDs found ${#nids[@]}"
1579 [[ ${nids[0]} == ${p_nid} ]] ||
1580 error "Expect NID \"${p_nid}\" found \"${nids[0]}\""
1582 [[ -n $s_nid ]] && [[ ${nids[1]} != ${s_nid} ]] &&
1583 error "Expect second NID \"${s_nid}\" found \"${nids[1]}\""
1585 $LCTL net down &>/dev/null
1590 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1592 cleanup_netns || error "Failed to cleanup netns before test execution"
1593 cleanup_lnet || error "Failed to unload modules before test execution"
1594 setup_fakeif || error "Failed to add fake IF"
1596 have_interface "$FAKE_IF" ||
1597 error "Expect $FAKE_IF configured but not found"
1599 local eth0_ip=$(ip --oneline addr show dev eth0 |
1600 awk '/inet /{print $4}' |
1602 local ip2nets_str="tcp(eth0) $eth0_ip"
1604 echo "Configure single NID \"$ip2nets_str\""
1605 test_208_load_and_check_lnet "${ip2nets_str}" "${eth0_ip}@tcp"
1607 ip2nets_str="tcp(eth0) $eth0_ip; tcp1($FAKE_IF) $FAKE_IP"
1608 echo "Configure two NIDs; two NETs \"$ip2nets_str\""
1609 test_208_load_and_check_lnet "${ip2nets_str}" "${eth0_ip}@tcp" \
1612 ip2nets_str="tcp(eth0) $eth0_ip; tcp($FAKE_IF) $FAKE_IP"
1613 echo "Configure two NIDs; one NET \"$ip2nets_str\""
1614 test_208_load_and_check_lnet "${ip2nets_str}" "${eth0_ip}@tcp" \
1616 local addr1=( ${eth0_ip//./ } )
1617 local addr2=( ${FAKE_IP//./ } )
1618 local range="[${addr1[0]},${addr2[0]}]"
1621 for i in $(seq 1 3); do
1622 range+=".[${addr1[$i]},${addr2[$i]}]"
1624 ip2nets_str="tcp(eth0,${FAKE_IF}) ${range}"
1626 echo "Configured two NIDs; one NET alt syntax \"$ip2nets_str\""
1627 test_208_load_and_check_lnet "${ip2nets_str}" "${eth0_ip}@tcp" \
1632 echo "alt syntax with missing IF \"$ip2nets_str\""
1633 load_lnet "networks=\"\" ip2nets=\"${ip2nets_str}\""
1635 echo "$LCTL net up should fail"
1637 error "LNet bringup should have failed"
1641 run_test 208 "Test various kernel ip2nets configurations"
1644 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1646 reinit_dlc || return $?
1647 add_net "tcp" "eth0" || return $?
1649 do_lnetctl discover $($LCTL list_nids | head -n 1) ||
1650 error "failed to discover myself"
1652 echo "Simulate network_timeout w/SR config"
1655 $LCTL net_drop_add -s *@tcp -d *@tcp -m GET -r 1 -e network_timeout
1656 do_lnetctl discover $($LCTL list_nids | head -n 1) &&
1657 error "Should have failed"
1658 $LCTL net_drop_del -a
1662 check_no_resends || return $?
1663 check_no_local_health || return $?
1664 check_no_remote_health || return $?
1666 reinit_dlc || return $?
1667 add_net "tcp" "eth0" || return $?
1668 add_net "tcp1" "eth0" || return $?
1670 do_lnetctl discover $($LCTL list_nids | head -n 1) ||
1671 error "failed to discover myself"
1673 echo "Simulate network_timeout w/MR config"
1676 $LCTL net_drop_add -s *@tcp -d *@tcp -m GET -r 1 -e network_timeout
1677 $LCTL net_drop_add -s *@tcp1 -d *@tcp1 -m GET -r 1 -e network_timeout
1678 do_lnetctl discover $($LCTL list_nids | head -n 1) &&
1679 error "Should have failed"
1680 $LCTL net_drop_del -a
1684 check_no_resends || return $?
1685 check_local_health || return $?
1686 check_remote_health || return $?
1690 run_test 209 "Check health, but not resends, for network timeout"
1695 local out=$TMP/$tfile
1696 local prefix=/usr/include/linux/lnet
1698 # We use a hard coded prefix so that this test will not fail
1701 if ! which $CC > /dev/null 2>&1; then
1702 skip_env "$CC is not installed"
1705 cleanup_lnet || exit 1
1708 if ! [[ -d $prefix ]]; then
1709 # Assume we're running in tree and fixup the include path.
1710 prefix=$LUSTRE/../lnet/include/uapi/linux/lnet
1713 for header in $prefix/*.h; do
1714 if ! [[ -f "$header" ]]; then
1718 $CC -Wall -Werror -std=c99 -include $header -c -x c /dev/null -o $out ||
1719 error "cannot compile '$header'"
1723 run_test 300 "packaged LNet UAPI headers can be compiled"