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 export LNETCTL=${LNETCTL:-"$LUSTRE/../lnet/utils/lnetctl"}
35 [ ! -f "$LNETCTL" ] &&
36 export LNETCTL=$(which lnetctl 2> /dev/null)
37 [[ -z $LNETCTL ]] && skip "Need lnetctl"
41 if is_mounted $MOUNT || is_mounted $MOUNT2; then
42 cleanupall || error "Failed cleanup prior to test execution"
47 echo "Cleaning up LNet"
48 lsmod | grep -q lnet &&
49 $LNETCTL lnet unconfigure 2>/dev/null
54 if module_loaded lnet ; then
55 cleanup_lnet || error "Failed to unload modules before test execution"
61 rm -f $TMP/sanity-dlc*
64 if $restore_mounts; then
65 setupall || error "Failed to setup Lustre after test execution"
66 elif $restore_modules; then
68 error "Couldn't load modules after test execution"
74 load_module ../libcfs/libcfs/libcfs
75 # Prevent local MODOPTS_LIBCFS being passed as part of environment
76 # variable to remote nodes
79 set_default_debug "neterror net nettrace malloc"
80 load_module ../lnet/lnet/lnet "$@"
82 LNDPATH=${LNDPATH:-"../lnet/klnds"}
83 if [ -z "$LNETLND" ]; then
85 o2ib*) LNETLND="o2iblnd/ko2iblnd" ;;
86 tcp*) LNETLND="socklnd/ksocklnd" ;;
87 *) local lnd="${NETTYPE%%[0-9]}lnd"
88 [ -f "$LNDPATH/$lnd/k$lnd.ko" ] &&
89 LNETLND="$lnd/k$lnd" ||
90 LNETLND="socklnd/ksocklnd"
93 load_module ../lnet/klnds/$LNETLND
105 echo "ip netns exec $TESTNS $@"
106 ip netns exec $TESTNS "$@"
114 netns_arg="netns $netns"
116 ip link add 'test1pl' type veth peer name $FAKE_IF $netns_arg
117 ip link set 'test1pl' up
118 if [[ -n $netns ]]; then
119 do_ns ip addr add "${FAKE_IP}/31" dev $FAKE_IF
120 do_ns ip link set $FAKE_IF up
122 ip addr add "${FAKE_IP}/31" dev $FAKE_IF
123 ip link set $FAKE_IF up
128 ip link show test1pl >& /dev/null && ip link del test1pl || return 0
139 (ip netns list | grep -q $TESTNS) && ip netns del $TESTNS
144 echo "Loading LNet and configuring DLC"
146 do_lnetctl lnet configure
149 GLOBAL_YAML_FILE=$TMP/sanity-lnet-global.yaml
150 define_global_yaml() {
151 $LNETCTL export --backup >${GLOBAL_YAML_FILE} ||
152 error "Failed to export global yaml $?"
156 if lsmod | grep -q lnet; then
157 do_lnetctl lnet unconfigure ||
158 error "lnetctl lnet unconfigure failed $?"
159 do_lnetctl lnet configure ||
160 error "lnetctl lnet configure failed $?"
162 configure_dlc || error "configure_dlc failed $?"
167 append_global_yaml() {
168 [[ ! -e ${GLOBAL_YAML_FILE} ]] &&
169 error "Missing global yaml at ${GLOBAL_YAML_FILE}"
171 cat ${GLOBAL_YAML_FILE} >> $TMP/sanity-lnet-$testnum-expected.yaml
174 create_base_yaml_file() {
178 compare_yaml_files() {
179 local expected="$TMP/sanity-lnet-$testnum-expected.yaml"
180 local actual="$TMP/sanity-lnet-$testnum-actual.yaml"
182 ! [[ -e $expected ]] && echo "$expected not found" && return 1
183 ! [[ -e $actual ]] && echo "$actual not found" && return 1
184 diff -upN ${actual} ${expected} || rc=$?
194 local net="${nid//*@/}"
195 local addr="${nid//@*/}"
197 local num_re='[0-9]\+'
198 local ip_re="[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"
200 if [[ $net =~ gni[0-9]* ]]; then
201 [[ $addr =~ ${num_re} ]] && return 0
203 [[ $addr =~ ${ip_re} ]] && return 0
208 local yfile=$TMP/sanity-lnet-$testnum-actual.yaml
209 local primary_nids=$(awk '/- primary nid:/{print $NF}' $yfile | xargs echo)
210 local secondary_nids=$(awk '/- nid:/{print $NF}' $yfile | xargs echo)
211 local gateway_nids=$(awk '/gateway:/{print $NF}' $yfile | xargs echo)
214 for nid in $primary_nids $secondary_nids; do
215 validate_nid "$nid" || error "Bad NID \"${nid}\""
220 validate_peer_nids() {
222 local nids_per_peer="$2"
224 local expect_p="$num_peers"
225 # The primary nid also shows up in the list of secondary nids
226 local expect_s="$(($num_peers + $(($nids_per_peer*$num_peers))))"
228 local actual_p=$(grep -c -- '- primary nid:' $TMP/sanity-lnet-$testnum-actual.yaml)
229 local actual_s=$(grep -c -- '- nid:' $TMP/sanity-lnet-$testnum-actual.yaml)
230 if [[ $expect_p -ne $actual_p ]]; then
232 error "Expected $expect_p but found $actual_p primary nids"
233 elif [[ $expect_s -ne $actual_s ]]; then
235 error "Expected $expect_s but found $actual_s secondary nids"
240 validate_gateway_nids() {
241 local expect_gw=$(grep -c -- 'gateway:' $TMP/sanity-lnet-$testnum-expected.yaml)
242 local actual_gw=$(grep -c -- 'gateway:' $TMP/sanity-lnet-$testnum-actual.yaml)
243 if [[ $expect_gw -ne $actual_gw ]]; then
245 error "Expected $expect_gw gateways but found $actual_gw gateways"
251 setup_netns || error "setup_netns failed with $?"
253 stack_trap 'cleanup_testsuite' EXIT
256 load_module ../lnet/lnet/lnet || error "Failed to load module rc = $?"
257 do_lnetctl lnet configure || error "lnet configure failed rc = $?"
259 reinit_dlc || return $?
260 do_lnetctl import < ${GLOBAL_YAML_FILE} || error "Import failed $?"
261 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
262 create_base_yaml_file
263 compare_yaml_files || error "Configuration changed after import"
265 run_test 0 "Export empty config, import the config, compare"
268 local prim_nid="${1:+--prim_nid $1}"
269 local nid="${2:+--nid $2}"
271 local actual="$TMP/sanity-lnet-$testnum-actual.yaml"
273 do_lnetctl peer add ${prim_nid} ${nid} || error "peer add failed $?"
274 $LNETCTL export --backup > $actual || error "export failed $?"
280 reinit_dlc || return $?
281 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
283 - primary nid: 1.1.1.1@tcp
289 compare_peer_add "1.1.1.1@tcp"
291 run_test 1 "Add peer with single nid (tcp)"
294 reinit_dlc || return $?
295 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
297 - primary nid: 2.2.2.2@o2ib
303 compare_peer_add "2.2.2.2@o2ib"
305 run_test 2 "Add peer with single nid (o2ib)"
308 reinit_dlc || return $?
309 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
311 - primary nid: 3.3.3.3@tcp
318 compare_peer_add "3.3.3.3@tcp" "3.3.3.3@o2ib"
320 run_test 3 "Add peer with tcp primary o2ib secondary"
323 reinit_dlc || return $?
324 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
326 - primary nid: 4.4.4.4@tcp
335 echo "Add peer with nidrange (tcp)"
336 compare_peer_add "4.4.4.4@tcp" "4.4.4.[1-3]@tcp"
338 echo "Add peer with nidrange that overlaps primary nid (tcp)"
339 compare_peer_add "4.4.4.4@tcp" "4.4.4.[1-4]@tcp"
341 run_test 4 "Add peer with nidrange (tcp)"
344 reinit_dlc || return $?
345 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
347 - primary nid: 5.5.5.5@o2ib
357 echo "Add peer with nidrange (o2ib)"
358 compare_peer_add "5.5.5.5@o2ib" "5.5.5.[1-4]@o2ib"
360 echo "Add peer with nidranage that overlaps primary nid (o2ib)"
361 compare_peer_add "5.5.5.5@o2ib" "5.5.5.[1-4]@o2ib"
363 run_test 5 "Add peer with nidrange (o2ib)"
366 reinit_dlc || return $?
367 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
369 - primary nid: 6.6.6.6@tcp
389 compare_peer_add "6.6.6.6@tcp" \
390 "6.6.[6-7].[0-4/2]@tcp,6.6.[1-4/2].[0-6/3]@o2ib,[6-12/4]@gni"
392 run_test 6 "Add peer with multiple nidranges"
395 local prim_nid="${1:+--prim_nid $1}"
396 local nid="${2:+--nid $2}"
398 local actual="$TMP/sanity-lnet-$testnum-actual.yaml"
400 do_lnetctl peer del ${prim_nid} ${nid} || error "peer del failed $?"
401 $LNETCTL export --backup > $actual || error "export failed $?"
407 reinit_dlc || return $?
408 create_base_yaml_file
410 echo "Delete peer with single nid (tcp)"
411 do_lnetctl peer add --prim_nid 7.7.7.7@tcp || error "Peer add failed $?"
412 compare_peer_del "7.7.7.7@tcp"
414 echo "Delete peer with single nid (o2ib)"
415 do_lnetctl peer add --prim_nid 7.7.7.7@o2ib || error "Peer add failed $?"
416 compare_peer_del "7.7.7.7@o2ib"
418 echo "Delete peer that has multiple nids (tcp)"
419 do_lnetctl peer add --prim_nid 7.7.7.7@tcp --nid 7.7.7.[8-12]@tcp ||
420 error "Peer add failed $?"
421 compare_peer_del "7.7.7.7@tcp"
423 echo "Delete peer that has multiple nids (o2ib)"
424 do_lnetctl peer add --prim_nid 7.7.7.7@o2ib --nid 7.7.7.[8-12]@o2ib ||
425 error "Peer add failed $?"
426 compare_peer_del "7.7.7.7@o2ib"
428 echo "Delete peer that has both tcp and o2ib nids"
429 do_lnetctl peer add --prim_nid 7.7.7.7@tcp \
430 --nid 7.7.7.[9-12]@tcp,7.7.7.[13-15]@o2ib ||
431 error "Peer add failed $?"
432 compare_peer_del "7.7.7.7@tcp"
434 echo "Delete peer with single nid (gni)"
435 do_lnetctl peer add --prim_nid 7@gni || error "Peer add failed $?"
436 compare_peer_del "7@gni"
438 echo "Delete peer that has multiple nids (gni)"
439 do_lnetctl peer add --prim_nid 7@gni --nid [8-12]@gni ||
440 error "Peer add failed $?"
441 compare_peer_del "7@gni"
443 echo "Delete peer that has tcp, o2ib and gni nids"
444 do_lnetctl peer add --prim_nid 7@gni \
445 --nid [8-12]@gni,7.7.7.[9-12]@tcp,7.7.7.[13-15]@o2ib ||
446 error "Peer add failed $?"
447 compare_peer_del "7@gni"
449 run_test 7 "Various peer delete tests"
452 reinit_dlc || return $?
454 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
456 - primary nid: 8.8.8.8@tcp
468 do_lnetctl peer add --prim_nid 8.8.8.8@tcp --nid 8.8.8.[10-15]@tcp ||
469 error "Peer add failed $?"
470 compare_peer_del "8.8.8.8@tcp" "8.8.8.13@tcp"
472 run_test 8 "Delete single secondary nid from peer (tcp)"
475 reinit_dlc || return $?
477 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
479 - primary nid: 9.9.9.9@tcp
486 do_lnetctl peer add --prim_nid 9.9.9.9@tcp \
487 --nid 9.9.9.[11-16]@tcp || error "Peer add failed $?"
488 compare_peer_del "9.9.9.9@tcp" "9.9.9.[11-16]@tcp"
490 run_test 9 "Delete all secondary nids from peer (tcp)"
493 reinit_dlc || return $?
495 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
497 - primary nid: 10.10.10.10@tcp
500 - nid: 10.10.10.10@tcp
501 - nid: 10.10.10.12@tcp
502 - nid: 10.10.10.13@tcp
503 - nid: 10.10.10.15@tcp
504 - nid: 10.10.10.16@tcp
507 do_lnetctl peer add --prim_nid 10.10.10.10@tcp \
508 --nid 10.10.10.[12-16]@tcp || error "Peer add failed $?"
509 compare_peer_del "10.10.10.10@tcp" "10.10.10.14@tcp"
511 run_test 10 "Delete single secondary nid from peer (o2ib)"
514 reinit_dlc || return $?
516 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
518 - primary nid: 11.11.11.11@tcp
521 - nid: 11.11.11.11@tcp
524 do_lnetctl peer add --prim_nid 11.11.11.11@tcp \
525 --nid 11.11.11.[13-17]@tcp || error "Peer add failed $?"
526 compare_peer_del "11.11.11.11@tcp" "11.11.11.[13-17]@tcp"
528 run_test 11 "Delete all secondary nids from peer (o2ib)"
531 reinit_dlc || return $?
533 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
535 - primary nid: 12.12.12.12@o2ib
538 - nid: 12.12.12.12@o2ib
539 - nid: 13.13.13.13@o2ib
540 - nid: 14.13.13.13@o2ib
541 - nid: 14.15.13.13@o2ib
543 - nid: 15.17.1.10@tcp
544 - nid: 15.17.1.20@tcp
547 do_lnetctl peer add --prim_nid 12.12.12.12@o2ib \
548 --nid [13-14/1].[13-15/2].13.13@o2ib,[15-16/3].[17-19/4].[1].[5-20/5]@tcp ||
549 error "Peer add failed $?"
550 compare_peer_del "12.12.12.12@o2ib" "13.15.13.13@o2ib,15.17.1.15@tcp"
552 run_test 12 "Delete a secondary nid from peer (tcp and o2ib)"
555 reinit_dlc || return $?
557 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
559 - primary nid: 13.13.13.13@o2ib
562 - nid: 13.13.13.13@o2ib
565 do_lnetctl peer add --prim_nid 13.13.13.13@o2ib \
566 --nid [14-15].[1-2/1].[1].[100-254/10]@tcp,14.14.[254].14@o2ib ||
567 error "Peer add failed $?"
568 compare_peer_del "13.13.13.13@o2ib" \
569 "[14-15].[1-2/1].[1].[100-254/10]@tcp,14.14.[254].14@o2ib"
571 run_test 13 "Delete all secondary nids from peer (tcp and o2ib)"
577 if [[ $net =~ gni* ]]; then
580 echo "${num}.${num}.${num}.${num}@${net}"
584 create_mr_peer_yaml() {
586 local secondary_nids="$2"
589 echo "Generating peer yaml for $num_peers peers with $secondary_nids secondary nids"
590 echo "peer:" >> $TMP/sanity-lnet-$testnum-expected.yaml
592 local total_nids=$((num_peers + $((num_peers * secondary_nids))))
595 while [[ $created -lt $num_peers ]]; do
596 local primary=$(create_nid ${nidnum} ${net})
597 cat <<EOF >> $TMP/sanity-lnet-$testnum-expected.yaml
598 - primary nid: $primary
604 local start=$((nidnum + 1))
605 local end=$((nidnum + $secondary_nids))
606 for j in $(seq ${start} ${end}); do
607 local nid=$(create_nid $j ${net})
608 echo " - nid: $nid" >> $TMP/sanity-lnet-$testnum-expected.yaml
616 reinit_dlc || return $?
618 echo "Create single peer, single nid, using import"
619 create_mr_peer_yaml 1 0 tcp
620 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
621 error "Import failed $?"
623 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
626 echo "Delete single peer using import --del"
627 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml ||
628 error "Import failed $?"
629 rm -f $TMP/sanity-lnet-$testnum-expected.yaml
630 create_base_yaml_file
631 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
634 run_test 14 "import peer create/delete with single nid"
637 reinit_dlc || return $?
639 echo "Create multiple peers, single nid per peer, using import"
640 create_mr_peer_yaml 5 0 o2ib
641 # The ordering of nids for this use-case is non-deterministic, so we
642 # we can't just diff the expected/actual output.
643 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
644 error "Import failed $?"
645 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
646 validate_peer_nids 5 0
648 echo "Delete multiple peers, single nid per peer, using import --del"
649 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml ||
650 error "Import failed $?"
651 rm -f $TMP/sanity-lnet-$testnum-expected.yaml
652 create_base_yaml_file
653 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
656 run_test 15 "import multi peer create/delete with single nid per peer"
659 reinit_dlc || return $?
661 echo "Create single peer, multiple nids, using import"
662 create_mr_peer_yaml 1 5 tcp
663 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
664 error "Import failed $?"
665 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
666 validate_peer_nids 1 5
668 echo "Delete single peer, multiple nids, using import --del"
669 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml ||
670 error "Import failed $?"
671 rm -f $TMP/sanity-lnet-$testnum-expected.yaml
672 create_base_yaml_file
673 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
676 run_test 16 "import peer create/delete with multiple nids"
679 reinit_dlc || return $?
681 echo "Create multiple peers, multiple nids per peer, using import"
682 create_mr_peer_yaml 5 7 o2ib
683 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
684 error "Import failed $?"
685 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
686 validate_peer_nids 5 7
688 echo "Delete multiple peers, multiple nids per peer, using import --del"
689 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml ||
690 error "Import failed $?"
691 rm -f $TMP/sanity-lnet-$testnum-expected.yaml
692 create_base_yaml_file
693 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
696 run_test 17 "import multi peer create/delete with multiple nids"
699 reinit_dlc || return $?
701 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
703 - primary nid: 1.1.1.1@tcp
712 echo "Import peer with 5 nids"
713 cat $TMP/sanity-lnet-$testnum-expected.yaml
714 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
715 error "Import failed $?"
716 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
718 - primary nid: 1.1.1.1@tcp
725 echo "Delete three of the nids"
726 cat $TMP/sanity-lnet-$testnum-expected.yaml
727 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml
728 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
730 - primary nid: 1.1.1.1@tcp
736 echo "Check peer has expected nids remaining"
737 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
741 run_test 18a "Delete a subset of nids from a single peer using import --del"
744 reinit_dlc || return $?
746 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
748 - primary nid: 1.1.1.1@tcp
756 - primary nid: 6.6.6.6@o2ib
765 echo "Import two peers with 5 nids each"
766 cat $TMP/sanity-lnet-$testnum-expected.yaml
767 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
768 error "Import failed $?"
769 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
771 - primary nid: 1.1.1.1@tcp
777 - primary nid: 6.6.6.6@o2ib
784 echo "Delete three of the nids from each peer"
785 cat $TMP/sanity-lnet-$testnum-expected.yaml
786 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml
787 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
789 - primary nid: 6.6.6.6@o2ib
794 - primary nid: 1.1.1.1@tcp
801 echo "Check peers have expected nids remaining"
802 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
804 validate_peer_nids 2 1
806 run_test 18b "Delete multiple nids from multiple peers using import --del"
809 reinit_dlc || return $?
810 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
812 - primary nid: 19@gni
818 compare_peer_add "19@gni"
820 run_test 19 "Add peer with single nid (gni)"
823 reinit_dlc || return $?
824 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
826 - primary nid: 20@gni
830 - nid: 20.20.20.20@tcp
831 - nid: 20.20.20.20@o2ib
834 compare_peer_add "20@gni" "20.20.20.20@tcp,20.20.20.20@o2ib"
836 run_test 20 "Add peer with gni primary and tcp, o2ib secondary"
839 reinit_dlc || return $?
840 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
842 - primary nid: 21@gni
852 echo "Add peer with nidrange (gni)"
853 compare_peer_add "21@gni" "[22-25]@gni" || error
854 echo "Add peer with nidrange that overlaps primary nid (gni)"
855 compare_peer_add "21@gni" "[21-25]@gni"
857 run_test 21 "Add peer with nidrange (gni)"
860 reinit_dlc || return $?
861 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
863 - primary nid: 22@gni
874 do_lnetctl peer add --prim_nid 22@gni --nid [24-29]@gni ||
875 error "Peer add failed $?"
876 compare_peer_del "22@gni" "26@gni"
878 run_test 22 "Delete single secondary nid from peer (gni)"
881 reinit_dlc || return $?
882 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
884 - primary nid: 23@gni
891 do_lnetctl peer add --prim_nid 23@gni --nid [25-29]@gni ||
892 error "Peer add failed $?"
893 compare_peer_del "23@gni" "[25-29]@gni"
895 run_test 23 "Delete all secondary nids from peer (gni)"
898 reinit_dlc || return $?
899 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
901 - primary nid: 24@gni
906 - nid: 13.13.13.13@o2ib
907 - nid: 14.13.13.13@o2ib
908 - nid: 14.15.13.13@o2ib
910 - nid: 15.17.1.10@tcp
911 - nid: 15.17.1.20@tcp
914 do_lnetctl peer add --prim_nid 24@gni \
915 --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 ||
916 error "Peer add failed $?"
917 compare_peer_del "24@gni" "5@gni,13.15.13.13@o2ib,15.17.1.15@tcp"
919 run_test 24 "Delete a secondary nid from peer (tcp, o2ib and gni)"
922 reinit_dlc || return $?
923 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
925 - primary nid: 25@gni
931 do_lnetctl peer add --prim_nid 25@gni \
932 --nid [26-27].[4-10/3].26.26@tcp,26.26.26.26@o2ib,[30-35]@gni ||
933 error "Peer add failed $?"
934 compare_peer_del "25@gni" \
935 "[26-27].[4-10/3].26.26@tcp,26.26.26.26@o2ib,[30-35]@gni"
937 run_test 25 "Delete all secondary nids from peer (tcp, gni and o2ib)"
940 reinit_dlc || return $?
942 echo "Invalid prim_nid - peer add"
943 do_lnetctl peer add --prim_nid foobar &&
944 error "Command should have failed"
946 echo "Invalid prim_nid - peer del"
947 do_lnetctl peer del --prim_nid foobar &&
948 error "Command should have failed"
950 echo "Delete non-existing peer"
951 do_lnetctl peer del --prim_nid 1.1.1.1@o2ib &&
952 error "Command should have failed"
954 echo "Don't provide mandatory argument for peer del"
955 do_lnetctl peer del --nid 1.1.1.1@tcp &&
956 error "Command should have failed"
958 echo "Don't provide mandatory argument for peer add"
959 do_lnetctl peer add --nid 1.1.1.1@tcp &&
960 error "Command should have failed"
962 echo "Don't provide mandatory arguments peer add"
963 do_lnetctl peer add &&
964 error "Command should have failed"
966 echo "Invalid secondary nids"
967 do_lnetctl peer add --prim_nid 1.1.1.1@tcp --nid foobar &&
968 error "Command should have failed"
970 echo "Exceed max nids per peer"
971 do_lnetctl peer add --prim_nid 1.1.1.1@tcp --nid 1.1.1.[2-255]@tcp &&
972 error "Command should have failed"
974 echo "Invalid net type"
975 do_lnetctl peer add --prim_nid 1@foo &&
976 error "Command should have failed"
978 echo "Invalid nid format"
979 local invalid_nids="1@tcp 1@o2ib 1.1.1.1@gni"
982 for nid in ${invalid_nids}; do
983 echo "Check invalid primary nid - '$nid'"
984 do_lnetctl peer add --prim_nid $nid &&
985 error "Command should have failed"
988 local invalid_strs="[2-1]@gni [a-f/x]@gni 256.256.256.256@tcp"
989 invalid_strs+=" 1.1.1.1.[2-5/f]@tcp 1.]2[.3.4@o2ib"
990 invalid_strs+="1.[2-4,[5-6],7-8].1.1@tcp foobar"
993 for nidstr in ${invalid_strs}; do
994 echo "Check invalid nidstring - '$nidstr'"
995 do_lnetctl peer add --prim_nid 1.1.1.1@tcp --nid $nidstr &&
996 error "Command should have failed"
999 echo "Add non-local gateway"
1000 do_lnetctl route add --net tcp --gateway 1@gni &&
1001 error "Command should have failed"
1005 run_test 99a "Check various invalid inputs to lnetctl peer"
1008 reinit_dlc || return $?
1010 create_base_yaml_file
1012 cat <<EOF > $TMP/sanity-lnet-$testnum-invalid.yaml
1014 - primary nid: 99.99.99.99@tcp
1017 - nid: 99.99.99.99@tcp
1019 do_lnetctl import < $TMP/sanity-lnet-$testnum-invalid.yaml &&
1020 error "import should have failed"
1021 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
1024 run_test 99b "Invalid value for Multi-Rail in yaml import"
1028 local ip=$(ip addr show dev $if | awk '/ inet /{print $2}')
1036 if ! lsmod | grep -q ksocklnd ; then
1037 load_module ../lnet/klnds/socklnd/ksocklnd ||
1038 error "Can't load ksocklnd.ko"
1041 do_lnetctl net add --net ${net} --if ${if} ||
1042 error "Failed to add net ${net} on if ${if}"
1045 compare_route_add() {
1049 local actual="$TMP/sanity-lnet-$testnum-actual.yaml"
1051 do_lnetctl route add --net ${rnet} --gateway ${gw} ||
1052 error "route add failed $?"
1053 # CPT configuration is pruned from the exported yaml, since the default
1054 # can vary across test systems (unlike default values for things like
1055 # peer_credits, peer_timeout, etc.)
1056 $LNETCTL export --backup | grep -v CPT > $actual ||
1057 error "export failed $?"
1058 validate_gateway_nids
1063 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1064 reinit_dlc || return $?
1065 add_net "tcp" "eth0"
1066 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
1075 peer_buffer_credits: 0
1079 gateway: 7.7.7.7@tcp
1082 health_sensitivity: 1
1084 - primary nid: 7.7.7.7@tcp
1090 compare_route_add "tcp7" "7.7.7.7@tcp" || return $?
1093 run_test 100 "Add route with single gw (tcp)"
1096 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1097 reinit_dlc || return $?
1098 add_net "tcp" "eth0"
1099 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
1108 peer_buffer_credits: 0
1112 gateway: 8.8.8.10@tcp
1115 health_sensitivity: 1
1117 gateway: 8.8.8.9@tcp
1120 health_sensitivity: 1
1122 gateway: 8.8.8.8@tcp
1125 health_sensitivity: 1
1127 - primary nid: 8.8.8.9@tcp
1131 - primary nid: 8.8.8.10@tcp
1135 - primary nid: 8.8.8.8@tcp
1141 compare_route_add "tcp8" "8.8.8.[8-10]@tcp"
1143 run_test 101 "Add route with multiple gw (tcp)"
1145 compare_route_del() {
1149 local actual="$TMP/sanity-lnet-$testnum-actual.yaml"
1151 do_lnetctl route del --net ${rnet} --gateway ${gw} ||
1152 error "route del failed $?"
1153 $LNETCTL export --backup > $actual ||
1154 error "export failed $?"
1155 validate_gateway_nids
1159 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1160 reinit_dlc || return $?
1161 add_net "tcp" "eth0"
1162 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-expected.yaml
1163 do_lnetctl route add --net tcp102 --gateway 102.102.102.102@tcp ||
1164 error "route add failed $?"
1165 compare_route_del "tcp102" "102.102.102.102@tcp"
1167 run_test 102 "Delete route with single gw (tcp)"
1170 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1171 reinit_dlc || return $?
1172 add_net "tcp" "eth0"
1173 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-expected.yaml
1174 do_lnetctl route add --net tcp103 \
1175 --gateway 103.103.103.[103-120/4]@tcp ||
1176 error "route add failed $?"
1177 compare_route_del "tcp103" "103.103.103.[103-120/4]@tcp"
1179 run_test 103 "Delete route with multiple gw (tcp)"
1182 local tyaml="$TMP/sanity-lnet-$testnum-expected.yaml"
1184 reinit_dlc || return $?
1186 # Default value is '3'
1187 local val=$($LNETCTL global show | awk '/response_tracking/{print $NF}')
1189 error "Expect 3 found $val"
1191 echo "Set < 0; Should fail"
1192 do_lnetctl set response_tracking -1 &&
1193 error "should have failed $?"
1195 reinit_dlc || return $?
1198 response_tracking: -10
1200 do_lnetctl import < $tyaml &&
1201 error "should have failed $?"
1203 echo "Check valid values; Should succeed"
1205 for ((i = 0; i < 4; i++)); do
1206 reinit_dlc || return $?
1207 do_lnetctl set response_tracking $i ||
1208 error "should have succeeded $?"
1209 $LNETCTL global show | grep -q "response_tracking: $i" ||
1210 error "Failed to set response_tracking to $i"
1211 reinit_dlc || return $?
1214 response_tracking: $i
1216 do_lnetctl import < $tyaml ||
1217 error "should have succeeded $?"
1218 $LNETCTL global show | grep -q "response_tracking: $i" ||
1219 error "Failed to set response_tracking to $i"
1222 reinit_dlc || return $?
1223 echo "Set > 3; Should fail"
1224 do_lnetctl set response_tracking 4 &&
1225 error "should have failed $?"
1227 reinit_dlc || return $?
1230 response_tracking: 10
1232 do_lnetctl import < $tyaml &&
1233 error "should have failed $?"
1236 run_test 104 "Set/check response_tracking param"
1238 ### load lnet in default namespace, configure in target namespace
1241 cleanup_lnet || exit 1
1242 load_lnet "networks=\"\""
1243 do_ns $LNETCTL lnet configure --all || exit 1
1244 $LNETCTL net show --net tcp | grep -q "nid: ${FAKE_IP}@tcp$"
1246 run_test 200 "load lnet w/o module option, configure in a non-default namespace"
1249 cleanup_lnet || exit 1
1250 load_lnet "networks=tcp($FAKE_IF)"
1251 do_ns $LNETCTL lnet configure --all || exit 1
1252 $LNETCTL net show --net tcp | grep -q "nid: ${FAKE_IP}@tcp$"
1254 run_test 201 "load lnet using networks module options in a non-default namespace"
1257 cleanup_lnet || exit 1
1258 load_lnet "networks=\"\" ip2nets=\"tcp0($FAKE_IF) ${FAKE_IP}\""
1259 do_ns $LNETCTL lnet configure --all || exit 1
1260 $LNETCTL net show | grep -q "nid: ${FAKE_IP}@tcp$"
1262 run_test 202 "load lnet using ip2nets in a non-default namespace"
1265 ### Add the interfaces in the target namespace
1268 cleanup_lnet || exit 1
1270 do_lnetctl lnet configure || exit 1
1271 do_ns $LNETCTL net add --net tcp0 --if $FAKE_IF
1273 run_test 203 "add a network using an interface in the non-default namespace"
1275 LNET_PARAMS_FILE="$TMP/$TESTSUITE.parameters"
1276 function save_lnet_params() {
1277 $LNETCTL global show | egrep -v '^global:$' |
1278 sed 's/://' > $LNET_PARAMS_FILE
1281 function restore_lnet_params() {
1283 while read param value; do
1284 [[ $param == max_intf ]] && continue
1285 [[ $param == lnd_timeout ]] && continue
1286 $LNETCTL set ${param} ${value} ||
1287 error "Failed to restore ${param} to ${value}"
1288 done < $LNET_PARAMS_FILE
1291 function lnet_health_pre() {
1294 # Lower transaction timeout to speed up test execution
1295 $LNETCTL set transaction_timeout 10 ||
1296 error "Failed to set transaction_timeout $?"
1298 # Increase recovery interval so we have time to capture health values
1299 $LNETCTL set recovery_interval 20 ||
1300 error "Failed to set recovery_interval $?"
1302 RETRY_PARAM=$($LNETCTL global show | awk '/retry_count/{print $NF}')
1303 RSND_PRE=$($LNETCTL stats show | awk '/resend_count/{print $NF}')
1304 LO_HVAL_PRE=$($LNETCTL net show -v 2 | awk '/health value/{print $NF}' |
1305 xargs echo | sed 's/ /+/g' | bc -l)
1307 local my_nid=$($LCTL list_nids | head -n 1)
1309 RMT_HVAL_PRE=$($LNETCTL peer show --nid $my_nid -v 2 2>/dev/null |
1310 awk '/health value/{print $NF}' | xargs echo |
1311 sed 's/ /+/g' | bc -l)
1313 # Might not have any peers so initialize to zero.
1314 RMT_HVAL_PRE=${RMT_HVAL_PRE:-0}
1319 function lnet_health_post() {
1320 RSND_POST=$($LNETCTL stats show | awk '/resend_count/{print $NF}')
1321 LO_HVAL_POST=$($LNETCTL net show -v 2 |
1322 awk '/health value/{print $NF}' |
1323 xargs echo | sed 's/ /+/g' | bc -l)
1325 local my_nid=$($LCTL list_nids | head -n 1)
1327 RMT_HVAL_POST=$($LNETCTL peer show --nid $my_nid -v 2 2>/dev/null |
1328 awk '/health value/{print $NF}' | xargs echo |
1329 sed 's/ /+/g' | bc -l)
1331 # Might not have any peers so initialize to zero.
1332 RMT_HVAL_POST=${RMT_HVAL_POST:-0}
1335 echo "Pre resends: $RSND_PRE" &&
1336 echo "Post resends: $RSND_POST" &&
1337 echo "Resends delta: $((RSND_POST - RSND_PRE))" &&
1338 echo "Pre local health: $LO_HVAL_PRE" &&
1339 echo "Post local health: $LO_HVAL_POST" &&
1340 echo "Pre remote health: $RMT_HVAL_PRE" &&
1341 echo "Post remote health: $RMT_HVAL_POST"
1348 function check_no_resends() {
1349 echo "Check that no resends took place"
1350 [[ $RSND_POST -ne $RSND_PRE ]] &&
1351 error "Found resends: $RSND_POST != $RSND_PRE"
1356 function check_resends() {
1357 local delta=$((RSND_POST - RSND_PRE))
1359 echo "Check that $RETRY_PARAM resends took place"
1360 [[ $delta -ne $RETRY_PARAM ]] &&
1361 error "Expected $RETRY_PARAM resends found $delta"
1366 function check_no_local_health() {
1367 echo "Check that local NI health is unchanged"
1368 [[ $LO_HVAL_POST -ne $LO_HVAL_PRE ]] &&
1369 error "Local health changed: $LO_HVAL_POST != $LO_HVAL_PRE"
1374 function check_local_health() {
1375 echo "Check that local NI health has been changed"
1376 [[ $LO_HVAL_POST -eq $LO_HVAL_PRE ]] &&
1377 error "Local health unchanged: $LO_HVAL_POST == $LO_HVAL_PRE"
1382 function check_no_remote_health() {
1383 echo "Check that remote NI health is unchanged"
1384 [[ $RMT_HVAL_POST -ne $RMT_HVAL_PRE ]] &&
1385 error "Remote health changed: $RMT_HVAL_POST != $RMT_HVAL_PRE"
1390 function check_remote_health() {
1391 echo "Check that remote NI health has been changed"
1392 [[ $RMT_HVAL_POST -eq $RMT_HVAL_PRE ]] &&
1393 error "Remote health unchanged: $RMT_HVAL_POST == $RMT_HVAL_PRE"
1398 # See lnet/lnet/lib-msg.c:lnet_health_check()
1399 LNET_LOCAL_RESEND_STATUSES="local_interrupt local_dropped local_aborted"
1400 LNET_LOCAL_RESEND_STATUSES+=" local_no_route local_timeout"
1401 LNET_LOCAL_NO_RESEND_STATUSES="local_error"
1403 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1404 reinit_dlc || return $?
1405 add_net "tcp" "eth0" || return $?
1407 lnet_health_pre || return $?
1410 for hstatus in ${LNET_LOCAL_RESEND_STATUSES} \
1411 ${LNET_LOCAL_NO_RESEND_STATUSES}; do
1412 echo "Simulate $hstatus"
1413 $LCTL net_drop_add -s *@tcp -d *@tcp -m GET -r 1 -e ${hstatus}
1414 do_lnetctl discover $($LCTL list_nids | head -n 1) &&
1415 error "Should have failed"
1416 $LCTL net_drop_del *
1421 check_no_resends || return $?
1422 check_no_local_health || return $?
1426 run_test 204 "Check no health or resends for single-rail local failures"
1429 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1432 for hstatus in ${LNET_LOCAL_RESEND_STATUSES}; do
1433 reinit_dlc || return $?
1434 add_net "tcp" "eth0" || return $?
1435 add_net "tcp1" "eth0" || return $?
1437 echo "Simulate $hstatus"
1440 $LCTL net_drop_add -s *@tcp -d *@tcp -m GET -r 1 -e ${hstatus}
1441 $LCTL net_drop_add -s *@tcp1 -d *@tcp1 -m GET -r 1 -e ${hstatus}
1442 do_lnetctl discover $($LCTL list_nids | head -n 1) &&
1443 error "Should have failed"
1444 $LCTL net_drop_del *
1448 check_resends || return $?
1449 check_local_health || return $?
1452 for hstatus in ${LNET_LOCAL_NO_RESEND_STATUSES}; do
1453 reinit_dlc || return $?
1454 add_net "tcp" "eth0" || return $?
1455 add_net "tcp1" "eth0" || return $?
1457 echo "Simulate $hstatus"
1458 lnet_health_pre || return $?
1460 $LCTL net_drop_add -s *@tcp -d *@tcp -m GET -r 1 -e ${hstatus}
1461 $LCTL net_drop_add -s *@tcp1 -d *@tcp1 -m GET -r 1 -e ${hstatus}
1462 do_lnetctl discover $($LCTL list_nids | head -n 1) &&
1463 error "Should have failed"
1464 $LCTL net_drop_del *
1468 check_no_resends || return $?
1469 check_local_health || return $?
1474 run_test 205 "Check health and resends for multi-rail local failures"
1476 # See lnet/lnet/lib-msg.c:lnet_health_check()
1477 LNET_REMOTE_RESEND_STATUSES="remote_dropped"
1478 LNET_REMOTE_NO_RESEND_STATUSES="remote_error remote_timeout"
1480 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1481 reinit_dlc || return $?
1482 add_net "tcp" "eth0" || return $?
1484 do_lnetctl discover $($LCTL list_nids | head -n 1) ||
1485 error "failed to discover myself"
1487 lnet_health_pre || return $?
1490 for hstatus in ${LNET_REMOTE_RESEND_STATUSES} \
1491 ${LNET_REMOTE_NO_RESEND_STATUSES}; do
1492 echo "Simulate $hstatus"
1493 $LCTL net_drop_add -s *@tcp -d *@tcp -m GET -r 1 -e ${hstatus}
1494 do_lnetctl discover $($LCTL list_nids | head -n 1) &&
1495 error "Should have failed"
1496 $LCTL net_drop_del *
1501 check_no_resends || return $?
1502 check_no_local_health || return $?
1503 check_no_remote_health || return $?
1507 run_test 206 "Check no health or resends for single-rail remote failures"
1510 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1513 for hstatus in ${LNET_REMOTE_RESEND_STATUSES}; do
1514 reinit_dlc || return $?
1515 add_net "tcp" "eth0" || return $?
1516 add_net "tcp1" "eth0" || return $?
1518 do_lnetctl discover $($LCTL list_nids | head -n 1) ||
1519 error "failed to discover myself"
1521 echo "Simulate $hstatus"
1522 lnet_health_pre || return $?
1523 $LCTL net_drop_add -s *@tcp -d *@tcp -m GET -r 1 -e ${hstatus}
1524 $LCTL net_drop_add -s *@tcp1 -d *@tcp1 -m GET -r 1 -e ${hstatus}
1525 do_lnetctl discover $($LCTL list_nids | head -n 1) &&
1526 error "Should have failed"
1527 $LCTL net_drop_del *
1531 check_resends || return $?
1532 check_no_local_health || return $?
1533 check_remote_health || return $?
1535 for hstatus in ${LNET_REMOTE_NO_RESEND_STATUSES}; do
1536 reinit_dlc || return $?
1537 add_net "tcp" "eth0" || return $?
1538 add_net "tcp1" "eth0" || return $?
1540 do_lnetctl discover $($LCTL list_nids | head -n 1) ||
1541 error "failed to discover myself"
1543 echo "Simulate $hstatus"
1544 lnet_health_pre || return $?
1545 $LCTL net_drop_add -s *@tcp -d *@tcp -m GET -r 1 -e ${hstatus}
1546 $LCTL net_drop_add -s *@tcp1 -d *@tcp1 -m GET -r 1 -e ${hstatus}
1547 do_lnetctl discover $($LCTL list_nids | head -n 1) &&
1548 error "Should have failed"
1549 $LCTL net_drop_del *
1553 check_no_resends || return $?
1554 check_no_local_health || return $?
1555 check_remote_health || return $?
1560 run_test 207 "Check health and resends for multi-rail remote errors"
1562 test_208_load_and_check_lnet() {
1566 local num_expected=1
1568 load_lnet "networks=\"\" ip2nets=\"${ip2nets_str}\""
1571 error "Failed to load LNet with ip2nets \"${ip2nets_str}\""
1577 nids=( $($LCTL list_nids) )
1579 [[ ${#nids[@]} -ne ${num_expected} ]] &&
1580 error "Expect ${num_expected} NIDs found ${#nids[@]}"
1582 [[ ${nids[0]} == ${p_nid} ]] ||
1583 error "Expect NID \"${p_nid}\" found \"${nids[0]}\""
1585 [[ -n $s_nid ]] && [[ ${nids[1]} != ${s_nid} ]] &&
1586 error "Expect second NID \"${s_nid}\" found \"${nids[1]}\""
1588 $LCTL net down &>/dev/null
1593 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1595 cleanup_netns || error "Failed to cleanup netns before test execution"
1596 cleanup_lnet || error "Failed to unload modules before test execution"
1597 setup_fakeif || error "Failed to add fake IF"
1599 have_interface "$FAKE_IF" ||
1600 error "Expect $FAKE_IF configured but not found"
1602 local eth0_ip=$(ip --oneline addr show dev eth0 |
1603 awk '/inet /{print $4}' |
1605 local ip2nets_str="tcp(eth0) $eth0_ip"
1607 echo "Configure single NID \"$ip2nets_str\""
1608 test_208_load_and_check_lnet "${ip2nets_str}" "${eth0_ip}@tcp"
1610 ip2nets_str="tcp(eth0) $eth0_ip; tcp1($FAKE_IF) $FAKE_IP"
1611 echo "Configure two NIDs; two NETs \"$ip2nets_str\""
1612 test_208_load_and_check_lnet "${ip2nets_str}" "${eth0_ip}@tcp" \
1615 ip2nets_str="tcp(eth0) $eth0_ip; tcp($FAKE_IF) $FAKE_IP"
1616 echo "Configure two NIDs; one NET \"$ip2nets_str\""
1617 test_208_load_and_check_lnet "${ip2nets_str}" "${eth0_ip}@tcp" \
1619 local addr1=( ${eth0_ip//./ } )
1620 local addr2=( ${FAKE_IP//./ } )
1621 local range="[${addr1[0]},${addr2[0]}]"
1624 for i in $(seq 1 3); do
1625 range+=".[${addr1[$i]},${addr2[$i]}]"
1627 ip2nets_str="tcp(eth0,${FAKE_IF}) ${range}"
1629 echo "Configured two NIDs; one NET alt syntax \"$ip2nets_str\""
1630 test_208_load_and_check_lnet "${ip2nets_str}" "${eth0_ip}@tcp" \
1635 echo "alt syntax with missing IF \"$ip2nets_str\""
1636 load_lnet "networks=\"\" ip2nets=\"${ip2nets_str}\""
1638 echo "$LCTL net up should fail"
1640 error "LNet bringup should have failed"
1644 run_test 208 "Test various kernel ip2nets configurations"
1647 have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
1649 reinit_dlc || return $?
1650 add_net "tcp" "eth0" || return $?
1652 do_lnetctl discover $($LCTL list_nids | head -n 1) ||
1653 error "failed to discover myself"
1655 echo "Simulate network_timeout w/SR config"
1658 $LCTL net_drop_add -s *@tcp -d *@tcp -m GET -r 1 -e network_timeout
1659 do_lnetctl discover $($LCTL list_nids | head -n 1) &&
1660 error "Should have failed"
1661 $LCTL net_drop_del -a
1665 check_no_resends || return $?
1666 check_no_local_health || return $?
1667 check_no_remote_health || return $?
1669 reinit_dlc || return $?
1670 add_net "tcp" "eth0" || return $?
1671 add_net "tcp1" "eth0" || return $?
1673 do_lnetctl discover $($LCTL list_nids | head -n 1) ||
1674 error "failed to discover myself"
1676 echo "Simulate network_timeout w/MR config"
1679 $LCTL net_drop_add -s *@tcp -d *@tcp -m GET -r 1 -e network_timeout
1680 $LCTL net_drop_add -s *@tcp1 -d *@tcp1 -m GET -r 1 -e network_timeout
1681 do_lnetctl discover $($LCTL list_nids | head -n 1) &&
1682 error "Should have failed"
1683 $LCTL net_drop_del -a
1687 check_no_resends || return $?
1688 check_local_health || return $?
1689 check_remote_health || return $?
1693 run_test 209 "Check health, but not resends, for network timeout"
1698 local out=$TMP/$tfile
1699 local prefix=/usr/include/linux/lnet
1701 # We use a hard coded prefix so that this test will not fail
1704 if ! which $CC > /dev/null 2>&1; then
1705 skip_env "$CC is not installed"
1708 cleanup_lnet || exit 1
1711 if ! [[ -d $prefix ]]; then
1712 # Assume we're running in tree and fixup the include path.
1713 prefix=$LUSTRE/../lnet/include/uapi/linux/lnet
1716 for header in $prefix/*.h; do
1717 if ! [[ -f "$header" ]]; then
1721 $CC -Wall -Werror -std=c99 -include $header -c -x c /dev/null -o $out ||
1722 error "cannot compile '$header'"
1726 run_test 300 "packaged LNet UAPI headers can be compiled"