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 [ "$SLOW" = "no" ] && EXCEPT_SLOW=""
17 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
19 . $LUSTRE/tests/test-framework.sh
23 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
28 [[ -z $LNETCTL ]] && skip "Need lnetctl"
32 if is_mounted $MOUNT || is_mounted $MOUNT2; then
33 cleanupall || error "Failed cleanup prior to test execution"
38 echo "Cleaning up LNet"
39 lsmod | grep -q lnet &&
40 $LNETCTL lnet unconfigure 2>/dev/null
45 if module_loaded lnet ; then
46 cleanup_lnet || error "Failed to unload modules before test execution"
52 # Cleanup any tmp files created by the sub tests
53 rm -f $TMP/sanity-lnet-*.yaml $LNET_PARAMS_FILE
56 if $restore_mounts; then
57 setupall || error "Failed to setup Lustre after test execution"
58 elif $restore_modules; then
60 error "Couldn't load modules after test execution"
69 echo "ip netns exec $TESTNS $*"
70 ip netns exec $TESTNS "$@"
78 netns_arg="netns $netns"
80 ip link add 'test1pl' type veth peer name $FAKE_IF $netns_arg
81 ip link set 'test1pl' up
82 if [[ -n $netns ]]; then
83 do_ns ip addr add "${FAKE_IP}/31" dev $FAKE_IF
84 do_ns ip link set $FAKE_IF up
86 ip addr add "${FAKE_IP}/31" dev $FAKE_IF
87 ip link set $FAKE_IF up
92 ip link show test1pl >& /dev/null && ip link del test1pl || return 0
103 (ip netns list | grep -q $TESTNS) && ip netns del $TESTNS
108 echo "Loading LNet and configuring DLC"
109 load_lnet || return $?
110 do_lnetctl lnet configure
113 GLOBAL_YAML_FILE=$TMP/sanity-lnet-global.yaml
114 define_global_yaml() {
115 $LNETCTL export --backup >${GLOBAL_YAML_FILE} ||
116 error "Failed to export global yaml $?"
120 if lsmod | grep -q lnet; then
121 do_lnetctl lnet unconfigure ||
122 error "lnetctl lnet unconfigure failed $?"
123 do_lnetctl lnet configure ||
124 error "lnetctl lnet configure failed $?"
126 configure_dlc || error "configure_dlc failed $?"
131 append_global_yaml() {
132 [[ ! -e ${GLOBAL_YAML_FILE} ]] &&
133 error "Missing global yaml at ${GLOBAL_YAML_FILE}"
135 cat ${GLOBAL_YAML_FILE} >> $TMP/sanity-lnet-$testnum-expected.yaml
138 create_base_yaml_file() {
142 compare_yaml_files() {
143 local expected="$TMP/sanity-lnet-$testnum-expected.yaml"
144 local actual="$TMP/sanity-lnet-$testnum-actual.yaml"
146 ! [[ -e $expected ]] && echo "$expected not found" && return 1
147 ! [[ -e $actual ]] && echo "$actual not found" && return 1
148 diff -upN ${actual} ${expected} || rc=$?
158 local net="${nid//*@/}"
159 local addr="${nid//@*/}"
161 local num_re='[0-9]+'
162 local ip_re="[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"
164 if [[ $net =~ (gni|kfi)[0-9]* ]]; then
165 [[ $addr =~ ${num_re} ]] && return 0
167 [[ $addr =~ ${ip_re} ]] && return 0
172 local yfile=$TMP/sanity-lnet-$testnum-actual.yaml
173 local primary_nids=$(awk '/- primary nid:/{print $NF}' $yfile | xargs echo)
174 local secondary_nids=$(awk '/- nid:/{print $NF}' $yfile | xargs echo)
175 local gateway_nids=$(awk '/gateway:/{print $NF}' $yfile | xargs echo)
178 for nid in $primary_nids $secondary_nids; do
179 validate_nid "$nid" || error "Bad NID \"${nid}\""
184 validate_peer_nids() {
186 local nids_per_peer="$2"
188 local expect_p="$num_peers"
189 # The primary nid also shows up in the list of secondary nids
190 local expect_s="$(($num_peers + $(($nids_per_peer*$num_peers))))"
192 local actual_p=$(grep -c -- '- primary nid:' $TMP/sanity-lnet-$testnum-actual.yaml)
193 local actual_s=$(grep -c -- '- nid:' $TMP/sanity-lnet-$testnum-actual.yaml)
194 if [[ $expect_p -ne $actual_p ]]; then
196 error "Expected $expect_p but found $actual_p primary nids"
197 elif [[ $expect_s -ne $actual_s ]]; then
199 error "Expected $expect_s but found $actual_s secondary nids"
204 validate_gateway_nids() {
205 local expect_gw=$(grep -c -- 'gateway:' $TMP/sanity-lnet-$testnum-expected.yaml)
206 local actual_gw=$(grep -c -- 'gateway:' $TMP/sanity-lnet-$testnum-actual.yaml)
207 if [[ $expect_gw -ne $actual_gw ]]; then
209 error "Expected $expect_gw gateways but found $actual_gw gateways"
215 setup_netns || error "setup_netns failed with $?"
217 # Determine the local interface(s) used for LNet
218 load_lnet "config_on_load=1" || error "Failed to load modules"
223 INTERFACES=( $(lnet_if_list) )
225 cleanup_lnet || error "Failed to cleanup LNet"
227 stack_trap 'cleanup_testsuite' EXIT
230 configure_dlc || error "Failed to configure DLC rc = $?"
232 reinit_dlc || return $?
233 do_lnetctl import < ${GLOBAL_YAML_FILE} || error "Import failed $?"
234 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
235 create_base_yaml_file
236 compare_yaml_files || error "Configuration changed after import"
238 run_test 0 "Export empty config, import the config, compare"
241 local prim_nid="${1:+--prim_nid $1}"
242 local nid="${2:+--nid $2}"
244 local actual="$TMP/sanity-lnet-$testnum-actual.yaml"
246 do_lnetctl peer add ${prim_nid} ${nid} || error "peer add failed $?"
247 $LNETCTL export --backup > $actual || error "export failed $?"
253 reinit_dlc || return $?
254 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
256 - primary nid: 1.1.1.1@tcp
262 compare_peer_add "1.1.1.1@tcp"
264 run_test 1 "Add peer with single nid (tcp)"
267 reinit_dlc || return $?
268 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
270 - primary nid: 2.2.2.2@o2ib
276 compare_peer_add "2.2.2.2@o2ib"
278 run_test 2 "Add peer with single nid (o2ib)"
281 reinit_dlc || return $?
282 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
284 - primary nid: 3.3.3.3@tcp
291 compare_peer_add "3.3.3.3@tcp" "3.3.3.3@o2ib"
293 run_test 3 "Add peer with tcp primary o2ib secondary"
296 reinit_dlc || return $?
297 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
299 - primary nid: 4.4.4.4@tcp
308 echo "Add peer with nidrange (tcp)"
309 compare_peer_add "4.4.4.4@tcp" "4.4.4.[1-3]@tcp"
311 echo "Add peer with nidrange that overlaps primary nid (tcp)"
312 compare_peer_add "4.4.4.4@tcp" "4.4.4.[1-4]@tcp"
314 run_test 4 "Add peer with nidrange (tcp)"
317 reinit_dlc || return $?
318 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
320 - primary nid: 5.5.5.5@o2ib
330 echo "Add peer with nidrange (o2ib)"
331 compare_peer_add "5.5.5.5@o2ib" "5.5.5.[1-4]@o2ib"
333 echo "Add peer with nidranage that overlaps primary nid (o2ib)"
334 compare_peer_add "5.5.5.5@o2ib" "5.5.5.[1-4]@o2ib"
336 run_test 5 "Add peer with nidrange (o2ib)"
339 reinit_dlc || return $?
340 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
342 - primary nid: 6.6.6.6@tcp
365 local nid_expr="6.6.[6-7].[0-4/2]@tcp"
366 nid_expr+=",6.6.[1-4/2].[0-6/3]@o2ib"
367 nid_expr+=",[6-12/4]@gni"
368 nid_expr+=",[6-12/4]@kfi"
370 compare_peer_add "6.6.6.6@tcp" "${nid_expr}"
372 run_test 6 "Add peer with multiple nidranges"
375 local prim_nid="${1:+--prim_nid $1}"
376 local nid="${2:+--nid $2}"
378 local actual="$TMP/sanity-lnet-$testnum-actual.yaml"
380 do_lnetctl peer del ${prim_nid} ${nid} || error "peer del failed $?"
381 $LNETCTL export --backup > $actual || error "export failed $?"
387 reinit_dlc || return $?
388 create_base_yaml_file
390 echo "Delete peer with single nid (tcp)"
391 do_lnetctl peer add --prim_nid 7.7.7.7@tcp || error "Peer add failed $?"
392 compare_peer_del "7.7.7.7@tcp"
394 echo "Delete peer with single nid (o2ib)"
395 do_lnetctl peer add --prim_nid 7.7.7.7@o2ib || error "Peer add failed $?"
396 compare_peer_del "7.7.7.7@o2ib"
398 echo "Delete peer that has multiple nids (tcp)"
399 do_lnetctl peer add --prim_nid 7.7.7.7@tcp --nid 7.7.7.[8-12]@tcp ||
400 error "Peer add failed $?"
401 compare_peer_del "7.7.7.7@tcp"
403 echo "Delete peer that has multiple nids (o2ib)"
404 do_lnetctl peer add --prim_nid 7.7.7.7@o2ib --nid 7.7.7.[8-12]@o2ib ||
405 error "Peer add failed $?"
406 compare_peer_del "7.7.7.7@o2ib"
408 echo "Delete peer that has both tcp and o2ib nids"
409 do_lnetctl peer add --prim_nid 7.7.7.7@tcp \
410 --nid 7.7.7.[9-12]@tcp,7.7.7.[13-15]@o2ib ||
411 error "Peer add failed $?"
412 compare_peer_del "7.7.7.7@tcp"
414 echo "Delete peer with single nid (gni)"
415 do_lnetctl peer add --prim_nid 7@gni || error "Peer add failed $?"
416 compare_peer_del "7@gni"
418 echo "Delete peer that has multiple nids (gni)"
419 do_lnetctl peer add --prim_nid 7@gni --nid [8-12]@gni ||
420 error "Peer add failed $?"
421 compare_peer_del "7@gni"
423 echo "Delete peer with single nid (kfi)"
424 do_lnetctl peer add --prim_nid 7@kfi || error "Peer add failed $?"
425 compare_peer_del "7@kfi"
427 echo "Delete peer that has multiple nids (kfi)"
428 do_lnetctl peer add --prim_nid 7@kfi --nid [8-12]@kfi ||
429 error "Peer add failed $?"
430 compare_peer_del "7@kfi"
432 echo "Delete peer that has tcp, o2ib, gni and kfi nids"
433 do_lnetctl peer add --prim_nid 7@gni \
434 --nid [8-12]@gni,7.7.7.[1-4]@tcp,7.7.7.[5-9]@o2ib,[1-5]@kfi ||
435 error "Peer add failed $?"
436 compare_peer_del "7@gni"
438 run_test 7 "Various peer delete tests"
441 reinit_dlc || return $?
443 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
445 - primary nid: 8.8.8.8@tcp
457 do_lnetctl peer add --prim_nid 8.8.8.8@tcp --nid 8.8.8.[10-15]@tcp ||
458 error "Peer add failed $?"
459 compare_peer_del "8.8.8.8@tcp" "8.8.8.13@tcp"
461 run_test 8 "Delete single secondary nid from peer (tcp)"
464 reinit_dlc || return $?
466 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
468 - primary nid: 9.9.9.9@tcp
475 do_lnetctl peer add --prim_nid 9.9.9.9@tcp \
476 --nid 9.9.9.[11-16]@tcp || error "Peer add failed $?"
477 compare_peer_del "9.9.9.9@tcp" "9.9.9.[11-16]@tcp"
479 run_test 9 "Delete all secondary nids from peer (tcp)"
482 reinit_dlc || return $?
484 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
486 - primary nid: 10.10.10.10@tcp
489 - nid: 10.10.10.10@tcp
490 - nid: 10.10.10.12@tcp
491 - nid: 10.10.10.13@tcp
492 - nid: 10.10.10.15@tcp
493 - nid: 10.10.10.16@tcp
496 do_lnetctl peer add --prim_nid 10.10.10.10@tcp \
497 --nid 10.10.10.[12-16]@tcp || error "Peer add failed $?"
498 compare_peer_del "10.10.10.10@tcp" "10.10.10.14@tcp"
500 run_test 10 "Delete single secondary nid from peer (o2ib)"
503 reinit_dlc || return $?
505 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
507 - primary nid: 11.11.11.11@tcp
510 - nid: 11.11.11.11@tcp
513 do_lnetctl peer add --prim_nid 11.11.11.11@tcp \
514 --nid 11.11.11.[13-17]@tcp || error "Peer add failed $?"
515 compare_peer_del "11.11.11.11@tcp" "11.11.11.[13-17]@tcp"
517 run_test 11 "Delete all secondary nids from peer (o2ib)"
520 reinit_dlc || return $?
522 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
524 - primary nid: 12.12.12.12@o2ib
527 - nid: 12.12.12.12@o2ib
528 - nid: 13.13.13.13@o2ib
529 - nid: 14.13.13.13@o2ib
530 - nid: 14.15.13.13@o2ib
532 - nid: 15.17.1.10@tcp
533 - nid: 15.17.1.20@tcp
536 do_lnetctl peer add --prim_nid 12.12.12.12@o2ib \
537 --nid [13-14/1].[13-15/2].13.13@o2ib,[15-16/3].[17-19/4].[1].[5-20/5]@tcp ||
538 error "Peer add failed $?"
539 compare_peer_del "12.12.12.12@o2ib" "13.15.13.13@o2ib,15.17.1.15@tcp"
541 run_test 12 "Delete a secondary nid from peer (tcp and o2ib)"
544 reinit_dlc || return $?
546 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
548 - primary nid: 13.13.13.13@o2ib
551 - nid: 13.13.13.13@o2ib
554 do_lnetctl peer add --prim_nid 13.13.13.13@o2ib \
555 --nid [14-15].[1-2/1].[1].[100-254/10]@tcp,14.14.[254].14@o2ib ||
556 error "Peer add failed $?"
557 compare_peer_del "13.13.13.13@o2ib" \
558 "[14-15].[1-2/1].[1].[100-254/10]@tcp,14.14.[254].14@o2ib"
560 run_test 13 "Delete all secondary nids from peer (tcp and o2ib)"
566 if [[ $net =~ gni* ]] || [[ $net =~ kfi* ]]; then
569 echo "${num}.${num}.${num}.${num}@${net}"
573 create_mr_peer_yaml() {
575 local secondary_nids="$2"
578 echo "Generating peer yaml for $num_peers peers with $secondary_nids secondary nids"
579 echo "peer:" >> $TMP/sanity-lnet-$testnum-expected.yaml
581 local total_nids=$((num_peers + $((num_peers * secondary_nids))))
584 while [[ $created -lt $num_peers ]]; do
585 local primary=$(create_nid ${nidnum} ${net})
586 cat <<EOF >> $TMP/sanity-lnet-$testnum-expected.yaml
587 - primary nid: $primary
593 local start=$((nidnum + 1))
594 local end=$((nidnum + $secondary_nids))
595 for j in $(seq ${start} ${end}); do
596 local nid=$(create_nid $j ${net})
597 echo " - nid: $nid" >> $TMP/sanity-lnet-$testnum-expected.yaml
605 reinit_dlc || return $?
607 echo "Create single peer, single nid, using import"
608 create_mr_peer_yaml 1 0 tcp
609 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
610 error "Import failed $?"
612 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
615 echo "Delete single peer using import --del"
616 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml ||
617 error "Import failed $?"
618 rm -f $TMP/sanity-lnet-$testnum-expected.yaml
619 create_base_yaml_file
620 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
623 run_test 14 "import peer create/delete with single nid"
626 reinit_dlc || return $?
628 echo "Create multiple peers, single nid per peer, using import"
629 create_mr_peer_yaml 5 0 o2ib
630 # The ordering of nids for this use-case is non-deterministic, so we
631 # we can't just diff the expected/actual output.
632 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
633 error "Import failed $?"
634 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
635 validate_peer_nids 5 0
637 echo "Delete multiple peers, single nid per peer, using import --del"
638 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml ||
639 error "Import failed $?"
640 rm -f $TMP/sanity-lnet-$testnum-expected.yaml
641 create_base_yaml_file
642 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
645 run_test 15 "import multi peer create/delete with single nid per peer"
648 reinit_dlc || return $?
650 echo "Create single peer, multiple nids, using import"
651 create_mr_peer_yaml 1 5 tcp
652 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
653 error "Import failed $?"
654 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
655 validate_peer_nids 1 5
657 echo "Delete single peer, multiple nids, using import --del"
658 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml ||
659 error "Import failed $?"
660 rm -f $TMP/sanity-lnet-$testnum-expected.yaml
661 create_base_yaml_file
662 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
665 run_test 16 "import peer create/delete with multiple nids"
668 reinit_dlc || return $?
670 echo "Create multiple peers, multiple nids per peer, using import"
671 create_mr_peer_yaml 5 7 o2ib
672 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
673 error "Import failed $?"
674 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
675 validate_peer_nids 5 7
677 echo "Delete multiple peers, multiple nids per peer, using import --del"
678 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml ||
679 error "Import failed $?"
680 rm -f $TMP/sanity-lnet-$testnum-expected.yaml
681 create_base_yaml_file
682 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
685 run_test 17 "import multi peer create/delete with multiple nids"
688 reinit_dlc || return $?
690 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
692 - primary nid: 1.1.1.1@tcp
701 echo "Import peer with 5 nids"
702 cat $TMP/sanity-lnet-$testnum-expected.yaml
703 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
704 error "Import failed $?"
705 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
707 - primary nid: 1.1.1.1@tcp
714 echo "Delete three of the nids"
715 cat $TMP/sanity-lnet-$testnum-expected.yaml
716 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml
717 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
719 - primary nid: 1.1.1.1@tcp
725 echo "Check peer has expected nids remaining"
726 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
730 run_test 18a "Delete a subset of nids from a single peer using import --del"
733 reinit_dlc || return $?
735 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
737 - primary nid: 1.1.1.1@tcp
745 - primary nid: 6.6.6.6@o2ib
754 echo "Import two peers with 5 nids each"
755 cat $TMP/sanity-lnet-$testnum-expected.yaml
756 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
757 error "Import failed $?"
758 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
760 - primary nid: 1.1.1.1@tcp
766 - primary nid: 6.6.6.6@o2ib
773 echo "Delete three of the nids from each peer"
774 cat $TMP/sanity-lnet-$testnum-expected.yaml
775 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml
776 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
778 - primary nid: 6.6.6.6@o2ib
783 - primary nid: 1.1.1.1@tcp
790 echo "Check peers have expected nids remaining"
791 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
793 validate_peer_nids 2 1
795 run_test 18b "Delete multiple nids from multiple peers using import --del"
798 reinit_dlc || return $?
799 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
801 - primary nid: 19@gni
807 compare_peer_add "19@gni"
809 run_test 19 "Add peer with single nid (gni)"
812 reinit_dlc || return $?
813 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
815 - primary nid: 20@gni
819 - nid: 20.20.20.20@tcp
820 - nid: 20.20.20.20@o2ib
823 compare_peer_add "20@gni" "20.20.20.20@tcp,20.20.20.20@o2ib"
825 run_test 20 "Add peer with gni primary and tcp, o2ib secondary"
828 reinit_dlc || return $?
829 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
831 - primary nid: 21@gni
841 echo "Add peer with nidrange (gni)"
842 compare_peer_add "21@gni" "[22-25]@gni" || error
843 echo "Add peer with nidrange that overlaps primary nid (gni)"
844 compare_peer_add "21@gni" "[21-25]@gni"
846 run_test 21 "Add peer with nidrange (gni)"
849 reinit_dlc || return $?
850 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
852 - primary nid: 22@gni
863 do_lnetctl peer add --prim_nid 22@gni --nid [24-29]@gni ||
864 error "Peer add failed $?"
865 compare_peer_del "22@gni" "26@gni"
867 run_test 22 "Delete single secondary nid from peer (gni)"
870 reinit_dlc || return $?
871 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
873 - primary nid: 23@gni
880 do_lnetctl peer add --prim_nid 23@gni --nid [25-29]@gni ||
881 error "Peer add failed $?"
882 compare_peer_del "23@gni" "[25-29]@gni"
884 run_test 23 "Delete all secondary nids from peer (gni)"
887 reinit_dlc || return $?
888 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
890 - primary nid: 24@gni
895 - nid: 13.13.13.13@o2ib
896 - nid: 14.13.13.13@o2ib
897 - nid: 14.15.13.13@o2ib
899 - nid: 15.17.1.10@tcp
900 - nid: 15.17.1.20@tcp
903 do_lnetctl peer add --prim_nid 24@gni \
904 --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 ||
905 error "Peer add failed $?"
906 compare_peer_del "24@gni" "5@gni,13.15.13.13@o2ib,15.17.1.15@tcp"
908 run_test 24 "Delete a secondary nid from peer (tcp, o2ib and gni)"
911 reinit_dlc || return $?
912 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
914 - primary nid: 25@gni
920 do_lnetctl peer add --prim_nid 25@gni \
921 --nid [26-27].[4-10/3].26.26@tcp,26.26.26.26@o2ib,[30-35]@gni ||
922 error "Peer add failed $?"
923 compare_peer_del "25@gni" \
924 "[26-27].[4-10/3].26.26@tcp,26.26.26.26@o2ib,[30-35]@gni"
926 run_test 25 "Delete all secondary nids from peer (tcp, gni and o2ib)"
929 reinit_dlc || return $?
931 echo "Invalid prim_nid - peer add"
932 do_lnetctl peer add --prim_nid foobar &&
933 error "Command should have failed"
935 echo "Invalid prim_nid - peer del"
936 do_lnetctl peer del --prim_nid foobar &&
937 error "Command should have failed"
939 echo "Delete non-existing peer"
940 do_lnetctl peer del --prim_nid 1.1.1.1@o2ib &&
941 error "Command should have failed"
943 echo "Don't provide mandatory argument for peer del"
944 do_lnetctl peer del --nid 1.1.1.1@tcp &&
945 error "Command should have failed"
947 echo "Don't provide mandatory argument for peer add"
948 do_lnetctl peer add --nid 1.1.1.1@tcp &&
949 error "Command should have failed"
951 echo "Don't provide mandatory arguments peer add"
952 do_lnetctl peer add &&
953 error "Command should have failed"
955 echo "Invalid secondary nids"
956 do_lnetctl peer add --prim_nid 1.1.1.1@tcp --nid foobar &&
957 error "Command should have failed"
959 echo "Exceed max nids per peer"
960 do_lnetctl peer add --prim_nid 1.1.1.1@tcp --nid 1.1.1.[2-255]@tcp &&
961 error "Command should have failed"
963 echo "Invalid net type"
964 do_lnetctl peer add --prim_nid 1@foo &&
965 error "Command should have failed"
967 echo "Invalid nid format"
968 local invalid_nids="1@tcp 1@o2ib 1.1.1.1@gni"
971 for nid in ${invalid_nids}; do
972 echo "Check invalid primary nid - '$nid'"
973 do_lnetctl peer add --prim_nid $nid &&
974 error "Command should have failed"
977 local invalid_strs="[2-1]@gni [a-f/x]@gni 256.256.256.256@tcp"
978 invalid_strs+=" 1.1.1.1.[2-5/f]@tcp 1.]2[.3.4@o2ib"
979 invalid_strs+="1.[2-4,[5-6],7-8].1.1@tcp foobar"
982 for nidstr in ${invalid_strs}; do
983 echo "Check invalid nidstring - '$nidstr'"
984 do_lnetctl peer add --prim_nid 1.1.1.1@tcp --nid $nidstr &&
985 error "Command should have failed"
988 echo "Add non-local gateway"
989 do_lnetctl route add --net tcp --gateway 1@gni &&
990 error "Command should have failed"
994 run_test 99a "Check various invalid inputs to lnetctl peer"
997 reinit_dlc || return $?
999 create_base_yaml_file
1001 cat <<EOF > $TMP/sanity-lnet-$testnum-invalid.yaml
1003 - primary nid: 99.99.99.99@tcp
1006 - nid: 99.99.99.99@tcp
1008 do_lnetctl import < $TMP/sanity-lnet-$testnum-invalid.yaml &&
1009 error "import should have failed"
1010 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
1013 run_test 99b "Invalid value for Multi-Rail in yaml import"
1017 local ip=$(ip addr show dev $if | awk '/ inet /{print $2}')
1025 do_lnetctl net add --net ${net} --if ${if} ||
1026 error "Failed to add net ${net} on if ${if}"
1029 compare_route_add() {
1033 local actual="$TMP/sanity-lnet-$testnum-actual.yaml"
1035 do_lnetctl route add --net ${rnet} --gateway ${gw} ||
1036 error "route add failed $?"
1037 $LNETCTL export --backup > $actual ||
1038 error "export failed $?"
1039 validate_gateway_nids
1043 append_net_tunables() {
1046 $LNETCTL net show -v --net ${net} | grep -v 'dev cpt' |
1047 awk '/^\s+tunables:$/,/^\s+CPT:/' >> $TMP/sanity-lnet-$testnum-expected.yaml
1051 [[ ${NETTYPE} == tcp* ]] ||
1052 skip "Need tcp NETTYPE"
1053 reinit_dlc || return $?
1054 add_net "tcp" "${INTERFACES[0]}"
1055 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
1062 append_net_tunables tcp
1063 cat <<EOF >> $TMP/sanity-lnet-$testnum-expected.yaml
1066 gateway: 7.7.7.7@tcp
1069 health_sensitivity: 1
1071 - primary nid: 7.7.7.7@tcp
1077 compare_route_add "tcp7" "7.7.7.7@tcp" || return $?
1080 run_test 100 "Add route with single gw (tcp)"
1083 [[ ${NETTYPE} == tcp* ]] ||
1084 skip "Need tcp NETTYPE"
1085 reinit_dlc || return $?
1086 add_net "tcp" "${INTERFACES[0]}"
1087 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
1096 peer_buffer_credits: 0
1102 gateway: 8.8.8.10@tcp
1105 health_sensitivity: 1
1107 gateway: 8.8.8.9@tcp
1110 health_sensitivity: 1
1112 gateway: 8.8.8.8@tcp
1115 health_sensitivity: 1
1117 - primary nid: 8.8.8.9@tcp
1121 - primary nid: 8.8.8.10@tcp
1125 - primary nid: 8.8.8.8@tcp
1131 compare_route_add "tcp8" "8.8.8.[8-10]@tcp"
1133 run_test 101 "Add route with multiple gw (tcp)"
1135 compare_route_del() {
1139 local actual="$TMP/sanity-lnet-$testnum-actual.yaml"
1141 do_lnetctl route del --net ${rnet} --gateway ${gw} ||
1142 error "route del failed $?"
1143 $LNETCTL export --backup > $actual ||
1144 error "export failed $?"
1145 validate_gateway_nids
1150 local nid=$((${testnum} % 255))
1152 if [[ ${net} =~ (tcp|o2ib)[0-9]* ]]; then
1153 echo "${nid}.${nid}.${nid}.${nid}@${net}"
1155 echo "${nid}@${net}"
1160 reinit_dlc || return $?
1161 add_net "${NETTYPE}" "${INTERFACES[0]}"
1162 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-expected.yaml
1164 local gwnid=$(generate_nid ${NETTYPE})
1166 do_lnetctl route add --net ${NETTYPE}2 --gateway ${gwnid} ||
1167 error "route add failed $?"
1168 compare_route_del "${NETTYPE}2" "${gwnid}"
1170 run_test 102 "Delete route with single gw"
1172 IP_NID_EXPR='103.103.103.[103-120/4]'
1173 NUM_NID_EXPR='[103-120/4]'
1175 reinit_dlc || return $?
1176 add_net "${NETTYPE}" "${INTERFACES[0]}"
1177 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-expected.yaml
1181 if [[ $NETTYPE =~ (tcp|o2ib)[0-9]* ]]; then
1182 nid_expr="${IP_NID_EXPR}"
1184 nid_expr="${NUM_NID_EXPR}"
1187 do_lnetctl route add --net ${NETTYPE}103 \
1188 --gateway ${nid_expr}@${NETTYPE} ||
1189 error "route add failed $?"
1190 compare_route_del "${NETTYPE}103" "${nid_expr}@${NETTYPE}"
1192 run_test 103 "Delete route with multiple gw"
1195 local tyaml="$TMP/sanity-lnet-$testnum-expected.yaml"
1197 reinit_dlc || return $?
1199 # Default value is '3'
1200 local val=$($LNETCTL global show | awk '/response_tracking/{print $NF}')
1202 error "Expect 3 found $val"
1204 echo "Set < 0; Should fail"
1205 do_lnetctl set response_tracking -1 &&
1206 error "should have failed $?"
1208 reinit_dlc || return $?
1211 response_tracking: -10
1213 do_lnetctl import < $tyaml &&
1214 error "should have failed $?"
1216 echo "Check valid values; Should succeed"
1218 for ((i = 0; i < 4; i++)); do
1219 reinit_dlc || return $?
1220 do_lnetctl set response_tracking $i ||
1221 error "should have succeeded $?"
1222 $LNETCTL global show | grep -q "response_tracking: $i" ||
1223 error "Failed to set response_tracking to $i"
1224 reinit_dlc || return $?
1227 response_tracking: $i
1229 do_lnetctl import < $tyaml ||
1230 error "should have succeeded $?"
1231 $LNETCTL global show | grep -q "response_tracking: $i" ||
1232 error "Failed to set response_tracking to $i"
1235 reinit_dlc || return $?
1236 echo "Set > 3; Should fail"
1237 do_lnetctl set response_tracking 4 &&
1238 error "should have failed $?"
1240 reinit_dlc || return $?
1243 response_tracking: 10
1245 do_lnetctl import < $tyaml &&
1246 error "should have failed $?"
1249 run_test 104 "Set/check response_tracking param"
1252 reinit_dlc || return $?
1253 add_net "${NETTYPE}" "${INTERFACES[0]}"
1255 local gwnid=$(generate_nid ${NETTYPE})
1257 do_lnetctl route add --net ${NETTYPE}105 --gateway ${gwnid} ||
1258 error "route add failed $?"
1259 do_lnetctl peer add --prim ${gwnid} &&
1260 error "peer add should fail"
1264 run_test 105 "Adding duplicate GW peer should fail"
1267 reinit_dlc || return $?
1268 add_net "${NETTYPE}" "${INTERFACES[0]}"
1270 local gwnid=$(generate_nid ${NETTYPE})
1272 do_lnetctl route add --net ${NETTYPE}106 --gateway ${gwnid} ||
1273 error "route add failed $?"
1274 do_lnetctl peer del --prim ${gwnid} &&
1275 error "peer del should fail"
1279 run_test 106 "Deleting GW peer should fail"
1282 [[ ${NETTYPE} == tcp* ]] ||
1283 skip "Need tcp NETTYPE"
1284 cleanup_lnet || exit 1
1285 load_lnet "networks=\"\""
1286 do_ns $LNETCTL lnet configure --all || exit 1
1287 $LNETCTL net show --net tcp | grep -q "nid: ${FAKE_IP}@tcp$"
1289 run_test 200 "load lnet w/o module option, configure in a non-default namespace"
1292 [[ ${NETTYPE} == tcp* ]] ||
1293 skip "Need tcp NETTYPE"
1294 cleanup_lnet || exit 1
1295 load_lnet "networks=tcp($FAKE_IF)"
1296 do_ns $LNETCTL lnet configure --all || exit 1
1297 $LNETCTL net show --net tcp | grep -q "nid: ${FAKE_IP}@tcp$"
1299 run_test 201 "load lnet using networks module options in a non-default namespace"
1302 [[ ${NETTYPE} == tcp* ]] ||
1303 skip "Need tcp NETTYPE"
1304 cleanup_lnet || exit 1
1305 load_lnet "networks=\"\" ip2nets=\"tcp0($FAKE_IF) ${FAKE_IP}\""
1306 do_ns $LNETCTL lnet configure --all || exit 1
1307 $LNETCTL net show | grep -q "nid: ${FAKE_IP}@tcp$"
1309 run_test 202 "load lnet using ip2nets in a non-default namespace"
1312 ### Add the interfaces in the target namespace
1315 [[ ${NETTYPE} == tcp* ]] ||
1316 skip "Need tcp NETTYPE"
1317 cleanup_lnet || exit 1
1319 do_lnetctl lnet configure || exit 1
1320 do_ns $LNETCTL net add --net tcp0 --if $FAKE_IF
1322 run_test 203 "add a network using an interface in the non-default namespace"
1324 LNET_PARAMS_FILE="$TMP/$TESTSUITE.parameters"
1325 function save_lnet_params() {
1326 $LNETCTL global show | egrep -v '^global:$' |
1327 sed 's/://' > $LNET_PARAMS_FILE
1330 function restore_lnet_params() {
1332 while read param value; do
1333 [[ $param == max_intf ]] && continue
1334 [[ $param == lnd_timeout ]] && continue
1335 $LNETCTL set ${param} ${value} ||
1336 error "Failed to restore ${param} to ${value}"
1337 done < $LNET_PARAMS_FILE
1340 function lnet_health_pre() {
1343 # Lower transaction timeout to speed up test execution
1344 $LNETCTL set transaction_timeout 10 ||
1345 error "Failed to set transaction_timeout $?"
1347 RETRY_PARAM=$($LNETCTL global show | awk '/retry_count/{print $NF}')
1348 RSND_PRE=$($LNETCTL stats show | awk '/resend_count/{print $NF}')
1349 LO_HVAL_PRE=$($LNETCTL net show -v 2 | awk '/health value/{print $NF}' |
1350 xargs echo | sed 's/ /+/g' | bc -l)
1352 RMT_HVAL_PRE=$($LNETCTL peer show --nid ${RNIDS[0]} -v 2 2>/dev/null |
1353 awk '/health value/{print $NF}' | xargs echo |
1354 sed 's/ /+/g' | bc -l)
1356 # Might not have any peers so initialize to zero.
1357 RMT_HVAL_PRE=${RMT_HVAL_PRE:-0}
1362 function lnet_health_post() {
1363 RSND_POST=$($LNETCTL stats show | awk '/resend_count/{print $NF}')
1364 LO_HVAL_POST=$($LNETCTL net show -v 2 |
1365 awk '/health value/{print $NF}' |
1366 xargs echo | sed 's/ /+/g' | bc -l)
1368 RMT_HVAL_POST=$($LNETCTL peer show --nid ${RNIDS[0]} -v 2 2>/dev/null |
1369 awk '/health value/{print $NF}' | xargs echo |
1370 sed 's/ /+/g' | bc -l)
1372 # Might not have any peers so initialize to zero.
1373 RMT_HVAL_POST=${RMT_HVAL_POST:-0}
1376 echo "Pre resends: $RSND_PRE" &&
1377 echo "Post resends: $RSND_POST" &&
1378 echo "Resends delta: $((RSND_POST - RSND_PRE))" &&
1379 echo "Pre local health: $LO_HVAL_PRE" &&
1380 echo "Post local health: $LO_HVAL_POST" &&
1381 echo "Pre remote health: $RMT_HVAL_PRE" &&
1382 echo "Post remote health: $RMT_HVAL_POST"
1386 do_lnetctl peer set --health 1000 --all
1387 do_lnetctl net set --health 1000 --all
1392 function check_no_resends() {
1393 echo "Check that no resends took place"
1394 [[ $RSND_POST -ne $RSND_PRE ]] &&
1395 error "Found resends: $RSND_POST != $RSND_PRE"
1400 function check_resends() {
1401 local delta=$((RSND_POST - RSND_PRE))
1403 echo "Check that $RETRY_PARAM resends took place"
1404 [[ $delta -ne $RETRY_PARAM ]] &&
1405 error "Expected $RETRY_PARAM resends found $delta"
1410 function check_no_local_health() {
1411 echo "Check that local NI health is unchanged"
1412 [[ $LO_HVAL_POST -ne $LO_HVAL_PRE ]] &&
1413 error "Local health changed: $LO_HVAL_POST != $LO_HVAL_PRE"
1418 function check_local_health() {
1419 echo "Check that local NI health has been changed"
1420 [[ $LO_HVAL_POST -eq $LO_HVAL_PRE ]] &&
1421 error "Local health unchanged: $LO_HVAL_POST == $LO_HVAL_PRE"
1426 function check_no_remote_health() {
1427 echo "Check that remote NI health is unchanged"
1428 [[ $RMT_HVAL_POST -ne $RMT_HVAL_PRE ]] &&
1429 error "Remote health changed: $RMT_HVAL_POST != $RMT_HVAL_PRE"
1434 function check_remote_health() {
1435 echo "Check that remote NI health has been changed"
1436 [[ $RMT_HVAL_POST -eq $RMT_HVAL_PRE ]] &&
1437 error "Remote health unchanged: $RMT_HVAL_POST == $RMT_HVAL_PRE"
1447 setup_health_test() {
1451 [[ ${NETTYPE} == kfi* ]] && skip "kfi doesn't support drop rules"
1453 local rnodes=$(remote_nodes_list)
1454 [[ -z $rnodes ]] && skip "Need at least 1 remote node"
1456 cleanup_lnet || error "Failed to cleanup before test execution"
1458 # Loading modules should configure LNet with the appropriate
1459 # test-framework configuration
1460 load_lnet "config_on_load=1" || error "Failed to load modules"
1462 LNIDS=( $($LCTL list_nids | xargs echo) )
1464 RNODE=$(awk '{print $1}' <<<$rnodes)
1465 RNIDS=( $(do_node $RNODE $LCTL list_nids | xargs echo) )
1467 if [[ -z ${RNIDS[@]} ]]; then
1468 do_rpc_nodes $RNODE load_lnet "config_on_load=1"
1470 RNIDS=( $(do_node $RNODE $LCTL list_nids | xargs echo) )
1473 [[ ${#LNIDS[@]} -lt 1 ]] &&
1474 error "No NIDs configured for local host $HOSTNAME"
1475 [[ ${#RNIDS[@]} -lt 1 ]] &&
1476 error "No NIDs configured for remote host $RNODE"
1478 do_lnetctl discover ${RNIDS[0]} ||
1479 error "Unable to discover ${RNIDS[0]}"
1481 local mr=$($LNETCTL peer show --nid ${RNIDS[0]} |
1482 awk '/Multi-Rail/{print $NF}')
1484 if ${need_mr} && [[ $mr == False ]]; then
1485 cleanup_health_test || return $?
1489 if ( ! ${need_mr} && [[ ${#RNIDS[@]} -gt 1 ]] ) ||
1490 ( ! ${need_mr} && [[ ${#LNIDS[@]} -gt 1 ]] ); then
1491 cleanup_health_test || return $?
1495 if ${need_mr} && [[ ${#RNIDS[@]} -lt 2 ]]; then
1496 # Add a second, reachable NID to rnode.
1497 local net=${RNIDS[0]}
1501 local if=$(do_rpc_nodes --quiet $RNODE lnet_if_list)
1503 error "Failed to determine interface for $RNODE"
1505 do_rpc_nodes $RNODE "$LNETCTL lnet configure"
1506 do_rpc_nodes $RNODE "$LNETCTL net add --net $net --if $if" ||
1508 if [[ $rc -ne 0 ]]; then
1509 error "Failed to add interface to $RNODE rc=$?"
1511 RNIDS[1]="${RNIDS[0]}1"
1512 NET_DEL_ARGS="--net $net --if $if"
1516 if ${need_mr} && [[ ${#LNIDS[@]} -lt 2 ]]; then
1517 local net=${LNIDS[0]}
1520 do_lnetctl lnet configure &&
1521 do_lnetctl net add --net $net --if ${INTERFACES[0]} ||
1523 if [[ $rc -ne 0 ]]; then
1524 error "Failed to add interface rc=$?"
1526 LNIDS[1]="${LNIDS[0]}1"
1532 $LNETCTL peer show -v 2 | egrep -e nid -e health
1534 $LCTL set_param debug=+net
1540 cleanup_health_test() {
1543 if [[ -n $NET_DEL_ARGS ]]; then
1544 do_rpc_nodes $RNODE \
1545 "$LNETCTL net del $NET_DEL_ARGS" ||
1550 unload_modules || rc=$?
1553 do_rpc_nodes $RNODE unload_modules_local ||
1559 error "Failed cleanup"
1564 add_health_test_drop_rules() {
1565 local args="-m GET -r 1 -e ${1}"
1568 for src in "${LNIDS[@]}"; do
1569 for dst in "${RNIDS[@]}" "${LNIDS[@]}"; do
1570 $LCTL net_drop_add -s $src -d $dst ${args} ||
1571 error "Failed to add drop rule $src $dst $args"
1576 do_lnet_health_ping_test() {
1579 echo "Simulate $hstatus"
1581 lnet_health_pre || return $?
1583 add_health_test_drop_rules ${hstatus}
1584 do_lnetctl ping ${RNIDS[0]} &&
1585 error "Should have failed"
1589 $LCTL net_drop_del -a
1594 # See lnet/lnet/lib-msg.c:lnet_health_check()
1595 LNET_LOCAL_RESEND_STATUSES="local_interrupt local_dropped local_aborted"
1596 LNET_LOCAL_RESEND_STATUSES+=" local_no_route local_timeout"
1597 LNET_LOCAL_NO_RESEND_STATUSES="local_error"
1599 setup_health_test false || return $?
1602 for hstatus in ${LNET_LOCAL_RESEND_STATUSES} \
1603 ${LNET_LOCAL_NO_RESEND_STATUSES}; do
1604 do_lnet_health_ping_test "${hstatus}" || return $?
1605 check_no_resends || return $?
1606 check_no_local_health || return $?
1609 cleanup_health_test || return $?
1613 run_test 204 "Check no health or resends for single-rail local failures"
1616 setup_health_test true || return $?
1619 for hstatus in ${LNET_LOCAL_RESEND_STATUSES}; do
1620 do_lnet_health_ping_test "${hstatus}" || return $?
1621 check_resends || return $?
1622 check_local_health || return $?
1625 for hstatus in ${LNET_LOCAL_NO_RESEND_STATUSES}; do
1626 do_lnet_health_ping_test "${hstatus}" || return $?
1627 check_no_resends || return $?
1628 check_local_health || return $?
1631 cleanup_health_test || return $?
1635 run_test 205 "Check health and resends for multi-rail local failures"
1637 # See lnet/lnet/lib-msg.c:lnet_health_check()
1638 LNET_REMOTE_RESEND_STATUSES="remote_dropped"
1639 LNET_REMOTE_NO_RESEND_STATUSES="remote_error remote_timeout"
1641 setup_health_test false || return $?
1644 for hstatus in ${LNET_REMOTE_RESEND_STATUSES} \
1645 ${LNET_REMOTE_NO_RESEND_STATUSES}; do
1646 do_lnet_health_ping_test "${hstatus}" || return $?
1647 check_no_resends || return $?
1648 check_no_local_health || return $?
1649 check_no_remote_health || return $?
1652 cleanup_health_test || return $?
1656 run_test 206 "Check no health or resends for single-rail remote failures"
1659 setup_health_test true || return $?
1662 for hstatus in ${LNET_REMOTE_RESEND_STATUSES}; do
1663 do_lnet_health_ping_test "${hstatus}" || return $?
1664 check_resends || return $?
1665 check_no_local_health || return $?
1666 check_remote_health || return $?
1667 do_lnetctl peer set --health 1000 --all ||
1668 error "Unable to reset health rc=$?"
1670 for hstatus in ${LNET_REMOTE_NO_RESEND_STATUSES}; do
1671 do_lnet_health_ping_test "${hstatus}" || return $?
1672 check_no_resends || return $?
1673 check_no_local_health || return $?
1674 check_remote_health || return $?
1675 do_lnetctl peer set --health 1000 --all ||
1676 error "Unable to reset health rc=$?"
1679 cleanup_health_test || return $?
1683 run_test 207 "Check health and resends for multi-rail remote errors"
1685 test_208_load_and_check_lnet() {
1689 local num_expected=1
1691 load_lnet "networks=\"\" ip2nets=\"${ip2nets_str}\""
1694 error "Failed to load LNet with ip2nets \"${ip2nets_str}\""
1700 nids=( $($LCTL list_nids) )
1702 [[ ${#nids[@]} -ne ${num_expected} ]] &&
1703 error "Expect ${num_expected} NIDs found ${#nids[@]}"
1705 [[ ${nids[0]} == ${p_nid} ]] ||
1706 error "Expect NID \"${p_nid}\" found \"${nids[0]}\""
1708 [[ -n $s_nid ]] && [[ ${nids[1]} != ${s_nid} ]] &&
1709 error "Expect second NID \"${s_nid}\" found \"${nids[1]}\""
1711 $LCTL net down &>/dev/null
1716 [[ ${NETTYPE} == tcp* ]] ||
1717 skip "Need tcp NETTYPE"
1719 cleanup_netns || error "Failed to cleanup netns before test execution"
1720 cleanup_lnet || error "Failed to unload modules before test execution"
1721 setup_fakeif || error "Failed to add fake IF"
1723 have_interface "$FAKE_IF" ||
1724 error "Expect $FAKE_IF configured but not found"
1726 local if0_ip=$(ip --oneline addr show dev ${INTERFACES[0]} |
1727 awk '/inet /{print $4}' |
1729 if0_ip=($(echo "${if0_ip[@]}" | tr ' ' '\n' | uniq | tr '\n' ' '))
1730 local ip2nets_str="tcp(${INTERFACES[0]}) $if0_ip"
1732 echo "Configure single NID \"$ip2nets_str\""
1733 test_208_load_and_check_lnet "${ip2nets_str}" "${if0_ip}@tcp"
1735 ip2nets_str="tcp(${INTERFACES[0]}) $if0_ip; tcp1($FAKE_IF) $FAKE_IP"
1736 echo "Configure two NIDs; two NETs \"$ip2nets_str\""
1737 test_208_load_and_check_lnet "${ip2nets_str}" "${if0_ip}@tcp" \
1740 ip2nets_str="tcp(${INTERFACES[0]}) $if0_ip; tcp($FAKE_IF) $FAKE_IP"
1741 echo "Configure two NIDs; one NET \"$ip2nets_str\""
1742 test_208_load_and_check_lnet "${ip2nets_str}" "${if0_ip}@tcp" \
1744 local addr1=( ${if0_ip//./ } )
1745 local addr2=( ${FAKE_IP//./ } )
1746 local range="[${addr1[0]},${addr2[0]}]"
1749 for i in $(seq 1 3); do
1750 range+=".[${addr1[$i]},${addr2[$i]}]"
1752 ip2nets_str="tcp(${INTERFACES[0]},${FAKE_IF}) ${range}"
1754 echo "Configured two NIDs; one NET alt syntax \"$ip2nets_str\""
1755 test_208_load_and_check_lnet "${ip2nets_str}" "${if0_ip}@tcp" \
1760 echo "alt syntax with missing IF \"$ip2nets_str\""
1761 load_lnet "networks=\"\" ip2nets=\"${ip2nets_str}\""
1763 echo "$LCTL net up should fail"
1765 error "LNet bring up should have failed"
1769 run_test 208 "Test various kernel ip2nets configurations"
1772 setup_health_test false || return $?
1774 echo "Simulate network_timeout w/SR config"
1777 add_health_test_drop_rules network_timeout
1779 do_lnetctl discover ${RNIDS[0]} &&
1780 error "Should have failed"
1784 check_no_resends || return $?
1785 check_no_local_health || return $?
1786 check_no_remote_health || return $?
1788 cleanup_health_test || return $?
1790 setup_health_test true || return $?
1792 echo "Simulate network_timeout w/MR config"
1796 add_health_test_drop_rules network_timeout
1798 do_lnetctl discover ${RNIDS[0]} &&
1799 error "Should have failed"
1803 check_no_resends || return $?
1804 check_local_health || return $?
1805 check_remote_health || return $?
1807 cleanup_health_test || return $?
1811 run_test 209 "Check health, but not resends, for network timeout"
1813 check_nid_in_recovq() {
1814 local recovq=$($LNETCTL debug recovery $1)
1816 local nids=$($LCTL list_nids | xargs echo)
1820 echo "Check \"$1\" recovery queue"
1822 if [[ $(grep -c 'nid-'<<<$recovq) -ne $expect ]]; then
1823 error "Expect $expect NIDs found: \"$recovq\""
1826 [[ $expect -eq 0 ]] && return 0
1828 for nid in ${nids}; do
1829 grep -q "nid-0: $nid"<<<$recovq &&
1834 error "Didn't find local NIDs in recovery queue: \"$recovq\""
1840 # First enqueue happens at time 0.
1841 # 2nd at 0 + 2^0 = 1
1842 # 3rd at 1 + 2^1 = 3
1843 # 4th at 3 + 2^2 = 7
1844 # 5th at 7 + 2^3 = 15
1845 # e.g. after 10 seconds we would expect to have seen the 4th enqueue,
1846 # (3 pings sent, 4th about to happen) and the 5th enqueue is yet to
1848 # If the recovery limit is 10 seconds, then when the 5th enqueue happens
1849 # we expect the peer NI to have aged out, so it will not actually be
1851 # If max_recovery_ping_interval is set to 4 then:
1852 # First enqueue happens at time 0.
1853 # 2nd at 0 + min(2^0, 4) = 1
1854 # 3rd at 1 + min(2^1, 4) = 3
1855 # 4th at 3 + min(2^2, 4) = 7
1856 # 5th at 7 + min(2^3, 4) = 11
1857 # 6th at 11 + min(2^4, 4) = 15
1858 # 7th at 15 + min(2^5, 4) = 19
1859 # e.g. after 4 seconds we would expect to have seen the 3rd enqueue,
1860 # (2 pings sent, 3rd about to happen), and the 4th enqueue is yet to happen
1861 # e.g. after 13 seconds we would expect to have seen the 5th enqueue,
1862 # (4 pings sent, 5th about to happen), and the 6th enqueue is yet to happen
1863 check_ping_count() {
1867 echo "Check ping counts:"
1869 if [[ $queue == "ni" ]]; then
1870 $LNETCTL net show -v 2 | egrep 'nid|health value|ping'
1871 ping_count=( $($LNETCTL net show -v 2 |
1872 awk '/ping_count/{print $NF}') )
1873 elif [[ $queue == "peer_ni" ]]; then
1874 $LNETCTL peer show -v 2 | egrep 'nid|health value|ping'
1875 ping_count=( $($LNETCTL peer show -v 2 |
1876 awk '/ping_count/{print $NF}') )
1878 error "Unrecognized queue \"$queue\""
1884 for count in "${ping_count[@]}"; do
1885 if [[ $count -eq $expect ]]; then
1886 if [[ $expect -ne 0 ]] && $found ; then
1887 error "Found more than one interface matching \"$expect\" ping count"
1890 echo "Expect ping count \"$expect\" found \"$count\""
1893 elif [[ $count -ne 0 ]]; then
1894 error "Found interface with ping count \"$count\" but expect \"$expect\""
1903 [[ ${NETTYPE} == kfi* ]] && skip "kfi doesn't support drop rules"
1905 reinit_dlc || return $?
1906 add_net "${NETTYPE}" "${INTERFACES[0]}" || return $?
1907 add_net "${NETTYPE}1" "${INTERFACES[0]}" || return $?
1909 local prim_nid=$($LCTL list_nids | head -n 1)
1911 do_lnetctl discover $prim_nid ||
1912 error "failed to discover myself"
1914 local default=$($LNETCTL global show |
1915 awk '/recovery_limit/{print $NF}')
1916 # Set recovery limit to 10 seconds.
1917 do_lnetctl set recovery_limit 10 ||
1918 error "failed to set recovery_limit"
1920 $LCTL set_param debug=+net
1921 # Use local_error so LNet doesn't attempt to resend the discovery ping
1922 $LCTL net_drop_add -s *@${NETTYPE} -d *@${NETTYPE} -m GET -r 1 -e local_error
1923 $LCTL net_drop_add -s *@${NETTYPE}1 -d *@${NETTYPE}1 -m GET -r 1 -e local_error
1924 do_lnetctl discover $prim_nid &&
1925 error "Expected discovery to fail"
1927 # See comment for check_ping_count()
1929 check_nid_in_recovq "-l" "1"
1930 check_ping_count "ni" "2"
1934 check_nid_in_recovq "-l" "1"
1935 check_ping_count "ni" "3"
1937 $LCTL net_drop_del -a
1939 reinit_dlc || return $?
1940 add_net "${NETTYPE}" "${INTERFACES[0]}" || return $?
1941 add_net "${NETTYPE}1" "${INTERFACES[0]}" || return $?
1943 local prim_nid=$($LCTL list_nids | head -n 1)
1945 do_lnetctl discover $prim_nid ||
1946 error "failed to discover myself"
1948 do_lnetctl set recovery_limit $default ||
1949 error "failed to set recovery_limit"
1951 default=$($LNETCTL global show |
1952 awk '/max_recovery_ping_interval/{print $NF}')
1953 do_lnetctl set max_recovery_ping_interval 4 ||
1954 error "failed to set max_recovery_ping_interval"
1956 $LCTL set_param debug=+net
1957 # Use local_error so LNet doesn't attempt to resend the discovery ping
1958 $LCTL net_drop_add -s *@${NETTYPE} -d *@${NETTYPE} -m GET -r 1 -e local_error
1959 $LCTL net_drop_add -s *@${NETTYPE}1 -d *@${NETTYPE}1 -m GET -r 1 -e local_error
1960 do_lnetctl discover $prim_nid &&
1961 error "Expected discovery to fail"
1963 # See comment for check_ping_count()
1965 check_nid_in_recovq "-l" "1"
1966 check_ping_count "ni" "2"
1969 check_nid_in_recovq "-l" "1"
1970 check_ping_count "ni" "4"
1972 $LCTL net_drop_del -a
1974 do_lnetctl set max_recovery_ping_interval $default ||
1975 error "failed to set max_recovery_ping_interval"
1979 run_test 210 "Local NI recovery checks"
1982 [[ ${NETTYPE} == kfi* ]] && skip "kfi doesn't support drop rules"
1984 reinit_dlc || return $?
1985 add_net "${NETTYPE}" "${INTERFACES[0]}" || return $?
1986 add_net "${NETTYPE}1" "${INTERFACES[0]}" || return $?
1988 local prim_nid=$($LCTL list_nids | head -n 1)
1990 do_lnetctl discover $prim_nid ||
1991 error "failed to discover myself"
1993 local default=$($LNETCTL global show |
1994 awk '/recovery_limit/{print $NF}')
1995 # Set recovery limit to 10 seconds.
1996 do_lnetctl set recovery_limit 10 ||
1997 error "failed to set recovery_limit"
1999 $LCTL net_drop_add -s *@${NETTYPE} -d *@${NETTYPE} -m GET -r 1 -e remote_error
2000 $LCTL net_drop_add -s *@${NETTYPE}1 -d *@${NETTYPE}1 -m GET -r 1 -e remote_error
2002 # Set health to 0 on one interface. This forces it onto the recovery
2004 $LNETCTL peer set --nid $prim_nid --health 0
2006 # After 5 seconds, we expect the peer NI to still be in recovery
2008 check_nid_in_recovq "-p" 1
2009 check_ping_count "peer_ni" "2"
2011 # After 15 seconds, the peer NI should have been fully processed out of
2012 # the recovery queue. We'll allow a total of 17 seconds to account for
2013 # differences in sleeping for whole seconds vs. the more accurate time
2014 # keeping that is done in the recovery code.
2016 check_nid_in_recovq "-p" 0
2017 check_ping_count "peer_ni" "4"
2019 $LCTL net_drop_del -a
2021 # Set health to force it back onto the recovery queue. Set to 500 means
2022 # in 5 seconds it should be back at maximum value. We'll wait a couple
2023 # more seconds than that to be safe.
2024 # NB: we reset the recovery limit to 0 (indefinite) so the peer NI is
2026 do_lnetctl set recovery_limit 0 ||
2027 error "failed to set recovery_limit"
2029 $LNETCTL peer set --nid $prim_nid --health 500
2031 check_nid_in_recovq "-p" 1
2032 check_ping_count "peer_ni" "2"
2036 check_nid_in_recovq "-p" 0
2037 check_ping_count "peer_ni" "0"
2039 reinit_dlc || return $?
2040 add_net "${NETTYPE}" "${INTERFACES[0]}" || return $?
2041 add_net "${NETTYPE}1" "${INTERFACES[0]}" || return $?
2043 local prim_nid=$($LCTL list_nids | head -n 1)
2045 do_lnetctl discover $prim_nid ||
2046 error "failed to discover myself"
2048 do_lnetctl set recovery_limit $default ||
2049 error "failed to set recovery_limit"
2051 default=$($LNETCTL global show |
2052 awk '/max_recovery_ping_interval/{print $NF}')
2053 do_lnetctl set max_recovery_ping_interval 4 ||
2054 error "failed to set max_recovery_ping_interval"
2056 $LCTL net_drop_add -s *@${NETTYPE} -d *@${NETTYPE} -m GET -r 1 -e remote_error
2057 $LCTL net_drop_add -s *@${NETTYPE}1 -d *@${NETTYPE}1 -m GET -r 1 -e remote_error
2059 # Set health to 0 on one interface. This forces it onto the recovery
2061 $LNETCTL peer set --nid $prim_nid --health 0
2063 # See comment for check_ping_count()
2065 check_nid_in_recovq "-p" "1"
2066 check_ping_count "peer_ni" "2"
2069 check_nid_in_recovq "-p" "1"
2070 check_ping_count "peer_ni" "4"
2072 $LCTL net_drop_del -a
2074 do_lnetctl set max_recovery_ping_interval $default ||
2075 error "failed to set max_recovery_ping_interval"
2079 run_test 211 "Remote NI recovery checks"
2082 [[ ${NETTYPE} == kfi* ]] && skip "kfi doesn't support drop rules"
2084 local rnodes=$(remote_nodes_list)
2085 [[ -z $rnodes ]] && skip "Need at least 1 remote node"
2087 cleanup_lnet || error "Failed to cleanup before test execution"
2089 # Loading modules should configure LNet with the appropriate
2090 # test-framework configuration
2091 load_lnet "config_on_load=1" || error "Failed to load modules"
2093 local my_nid=$($LCTL list_nids | head -n 1)
2095 error "Failed to get primary NID for local host $HOSTNAME"
2097 local rnode=$(awk '{print $1}' <<<$rnodes)
2098 local rnodenids=$(do_node $rnode $LCTL list_nids | xargs echo)
2101 if [[ -z $rnodenids ]]; then
2102 do_rpc_nodes $rnode load_lnet "config_on_load=1"
2104 rnodenids=$(do_node $rnode $LCTL list_nids | xargs echo)
2107 local rnodepnid=$(awk '{print $1}' <<< $rnodenids)
2109 [[ -z $rnodepnid ]] &&
2110 error "Failed to get primary NID for remote host $rnode"
2112 log "Initial discovery"
2113 do_lnetctl discover --force $rnodepnid ||
2114 error "Failed to discover $rnodepnid"
2116 do_node $rnode "$LNETCTL discover --force $my_nid" ||
2117 error "$rnode failed to discover $my_nid"
2119 log "Fail local discover ping to set LNET_PEER_REDISCOVER flag"
2120 $LCTL net_drop_add -s "*@$NETTYPE" -d "*@$NETTYPE" -r 1 -e local_error
2121 do_lnetctl discover --force $rnodepnid &&
2122 error "Discovery should have failed"
2123 $LCTL net_drop_del -a
2126 for nid in $rnodenids; do
2127 # We need GET (PING) delay just long enough so we can trigger
2128 # discovery on the remote peer
2129 $LCTL net_delay_add -s "*@$NETTYPE" -d $nid -r 1 -m GET -l 3
2130 $LCTL net_drop_add -s "*@$NETTYPE" -d $nid -r 1 -m GET -e local_error
2131 # We need PUT (PUSH) delay just long enough so we can process
2133 $LCTL net_delay_add -s "*@$NETTYPE" -d $nid -r 1 -m PUT -l 6
2136 log "Force $HOSTNAME to discover $rnodepnid (in background)"
2137 # We want to get a PING sent that we know will eventually fail.
2138 # The delay rules we added will ensure the ping is not sent until
2139 # the PUSH is also in flight (see below), and the drop rule ensures that
2140 # when the PING is eventually sent it will error out
2141 do_lnetctl discover --force $rnodepnid &
2144 # We want a discovery PUSH from rnode to put rnode back on our
2145 # discovery queue. This should cause us to try and send a PUSH to rnode
2146 # while the PING is still outstanding.
2147 log "Force $rnode to discover $my_nid"
2148 do_node $rnode $LNETCTL discover --force $my_nid
2150 # At this point we'll have both PING_SENT and PUSH_SENT set for the
2151 # rnode peer. Wait for the PING to error out which should terminate the
2152 # discovery process that we backgrounded.
2153 log "Wait for $pid1"
2155 log "Finished wait on $pid1"
2157 # The PING send failure clears the PING_SENT flag and puts the peer back
2158 # on the discovery queue. When discovery thread processes the peer it
2159 # will mistakenly clear the PUSH_SENT flag (and set PUSH_FAILED).
2160 # Discovery will then complete for this peer even though we have an
2162 # When PUSH is actually unlinked it will be forced back onto the
2163 # discovery queue, but we no longer have a ref on the peer. When
2164 # discovery completes again, we'll trip the ASSERT in
2165 # lnet_destroy_peer_locked()
2167 # Delete the delay rules to send the PUSH
2168 $LCTL net_delay_del -a
2169 # Delete the drop rules
2170 $LCTL net_drop_del -a
2173 error "Failed to unload modules"
2175 do_rpc_nodes $rnode unload_modules_local ||
2176 error "Failed to unload modules on $rnode"
2181 run_test 212 "Check discovery refcount loss bug (LU-14627)"
2184 [[ ${NETTYPE} == tcp* ]] || skip "Need tcp NETTYPE"
2186 cleanup_netns || error "Failed to cleanup netns before test execution"
2187 cleanup_lnet || error "Failed to unload modules before test execution"
2189 setup_fakeif || error "Failed to add fake IF"
2190 have_interface "$FAKE_IF" ||
2191 error "Expect $FAKE_IF configured but not found"
2193 reinit_dlc || return $?
2195 add_net "tcp" "${INTERFACES[0]}" || return $?
2196 add_net "tcp" "$FAKE_IF" || return $?
2198 local nid1=$(lctl list_nids | head -n 1)
2199 local nid2=$(lctl list_nids | tail --lines 1)
2201 [[ $(lctl which_nid $nid1 $nid2) == $nid1 ]] ||
2202 error "Expect nid1 \"$nid1\" to be preferred"
2204 [[ $(lctl which_nid $nid2 $nid1) == $nid2 ]] ||
2205 error "Expect nid2 \"$nid2\" to be preferred"
2209 run_test 213 "Check LNetDist calculation for multiple local NIDs"
2211 function check_ni_status() {
2215 local status=$($LNETCTL net show |
2217 awk '/status/{print $NF}')
2219 echo "NI ${nid} expect status \"${expect}\" found \"${status}\""
2220 if [[ $status != $expect ]]; then
2221 error "Error: Expect NI status \"$expect\" for NID \"$nid\" but found \"$status\""
2228 [[ ${NETTYPE} == tcp* ]] || skip "Need tcp NETTYPE"
2230 cleanup_netns || error "Failed to cleanup netns before test execution"
2231 cleanup_lnet || error "Failed to unload modules before test execution"
2233 setup_fakeif || error "Failed to add fake IF"
2234 have_interface "$FAKE_IF" ||
2235 error "Expect $FAKE_IF configured but not found"
2237 reinit_dlc || return $?
2239 add_net "tcp" "${INTERFACES[0]}" || return $?
2240 add_net "tcp" "$FAKE_IF" || return $?
2242 local nid1=$(lctl list_nids | head -n 1)
2243 local nid2=$(lctl list_nids | tail --lines 1)
2245 check_ni_status "0@lo" up
2246 check_ni_status "$nid1" up
2247 check_ni_status "$nid2" up
2249 echo "Set $FAKE_IF down"
2250 echo "ip link set dev $FAKE_IF down"
2251 ip link set dev $FAKE_IF down
2252 check_ni_status "0@lo" up
2253 check_ni_status "$nid1" up
2254 check_ni_status "$nid2" down
2256 run_test 214 "Check local NI status when link is downed"
2262 $LNETCTL net show -v 2 |
2263 egrep -e nid -e $stat |
2265 awk '/'$stat':/{print $NF}'
2270 for nidvar in nid1 nid2; do
2271 for stat in send_count recv_count; do
2272 s=$(get_ni_stat ${!nidvar} $stat)
2273 eval ${nidvar}_pre_${stat}=$s
2280 for nidvar in nid1 nid2; do
2281 for stat in send_count recv_count; do
2282 s=$(get_ni_stat ${!nidvar} $stat)
2283 eval ${nidvar}_post_${stat}=$s
2293 eval pre=\${${nidvar}_pre_${stat}}
2294 eval post=\${${nidvar}_post_${stat}}
2296 echo "${!nidvar} pre ${stat} $pre post ${stat} $post"
2298 [[ $pre -ne $post ]]
2302 cleanup_netns || error "Failed to cleanup netns before test execution"
2303 cleanup_lnet || error "Failed to unload modules before test execution"
2305 reinit_dlc || return $?
2307 add_net "${NETTYPE}1" "${INTERFACES[0]}" || return $?
2308 add_net "${NETTYPE}2" "${INTERFACES[0]}" || return $?
2310 local nid1=$($LCTL list_nids | head -n 1)
2311 local nid2=$($LCTL list_nids | tail --lines 1)
2313 do_lnetctl peer add --prim $nid1 --nid $nid2 ||
2314 error "Failed to add peer"
2318 for nidvarA in nid1 nid2; do
2321 for nidvarB in nid1 nid2; do
2322 [[ $nidvarA == $nidvarB ]] && continue
2326 echo "$LNETCTL ping $dst x $npings"
2327 for i in $(seq 1 $npings); do
2328 $LNETCTL ping $dst &>/dev/null ||
2329 error "$LNETCTL ping $dst failed"
2334 # No source specified, sends to either NID should cause
2335 # counts to increase across both NIs
2336 for nidvar in nid1 nid2; do
2337 for stat in send_count recv_count; do
2338 ni_stat_changed $nidvar $stat ||
2339 error "$stat unchanged for ${!nidvar}"
2345 echo "$LNETCTL ping --source $src $dst x $npings"
2346 for i in $(seq 1 $npings); do
2347 $LNETCTL ping --source $src $dst &>/dev/null ||
2348 error "$LNETCTL ping --source $src $dst failed"
2353 # src nid == dest nid means stats for the _other_ NI
2354 # should be unchanged
2355 for nidvar in nid1 nid2; do
2356 for stat in send_count recv_count; do
2357 if [[ ${!nidvar} == $src ]]; then
2358 ni_stat_changed $nidvar $stat ||
2359 error "$stat unchanged for ${!nidvar}"
2361 ni_stat_changed $nidvar $stat &&
2362 error "$stat changed for ${!nidvar}"
2367 # Double number of pings for next iteration because the net
2368 # sequence numbers will have diverged
2369 npings=$(($npings * 2))
2372 # Ping from nid1 to nid2 should fail
2373 do_lnetctl ping --source $nid1 $nid2 &&
2374 error "ping from $nid1 to $nid2 should fail"
2376 # Ping from nid2 to nid1 should fail
2377 do_lnetctl ping --source $nid2 $nid1 &&
2378 error "ping from $nid2 to $nid1 should fail"
2382 run_test 215 "Test lnetctl ping --source option"
2385 [[ ${NETTYPE} == kfi* ]] && skip "kfi doesn't support drop rules"
2389 reinit_dlc || return $?
2391 add_net "${NETTYPE}" "${INTERFACES[0]}" || return $?
2392 add_net "${NETTYPE}1" "${INTERFACES[0]}" || return $?
2394 local nids=( $($LCTL list_nids | xargs echo) )
2396 do_lnetctl discover ${nids[0]} ||
2397 error "Initial discovery failed"
2399 do_lnetctl ping --source ${nids[0]} ${nids[0]} ||
2400 error "Initial ping failed $?"
2402 do_lnetctl ping --source ${nids[1]} ${nids[1]} ||
2403 error "Initial ping failed $?"
2406 for src in "${nids[@]}"; do
2407 for dst in "${nids[@]}"; do
2408 $LCTL net_drop_add -r 1 -s $src -d $dst -e network_timeout
2412 do_lnetctl ping ${nids[0]} || rc=$?
2414 $LCTL net_drop_del -a
2417 error "expected ping to fail"
2419 check_nid_in_recovq "-p" 0
2420 check_nid_in_recovq "-l" 1
2424 run_test 216 "Failed send to peer NI owned by local host should not trigger peer NI recovery"
2427 reinit_dlc || return $?
2429 [[ $($LNETCTL net show | grep -c nid) -ne 1 ]] &&
2430 error "Unexpected number of NIs after initalizing DLC"
2432 do_lnetctl discover 0@lo ||
2433 error "Failed to discover 0@lo"
2437 run_test 217 "Don't leak memory when discovering peer with nnis <= 1"
2440 [[ ${NETTYPE} == kfi* ]] && skip "kfi doesn't support drop rules"
2442 reinit_dlc || return $?
2444 [[ ${#INTERFACES[@]} -lt 2 ]] &&
2445 skip "Need two LNet interfaces"
2447 add_net "${NETTYPE}" "${INTERFACES[0]}" || return $?
2449 local nid1=$($LCTL list_nids | head -n 1)
2451 do_lnetctl ping $nid1 ||
2454 add_net "${NETTYPE}" "${INTERFACES[1]}" || return $?
2456 local nid2=$($LCTL list_nids | tail --lines 1)
2458 do_lnetctl ping $nid2 ||
2461 $LCTL net_drop_add -s $nid1 -d $nid1 -e local_error -r 1
2463 do_lnetctl ping --source $nid1 $nid1 &&
2464 error "ping should have failed"
2466 local health_recovered
2469 for i in $(seq 1 5); do
2470 health_recovered=$($LNETCTL net show -v 2 |
2471 grep -c 'health value: 1000')
2473 if [[ $health_recovered -ne 2 ]]; then
2474 echo "Wait 1 second for health to recover"
2481 health_recovered=$($LNETCTL net show -v 2 |
2482 grep -c 'health value: 1000')
2484 $LCTL net_drop_del -a
2486 [[ $health_recovered -ne 2 ]] &&
2487 do_lnetctl net show -v 2 | egrep -e nid -e health &&
2488 error "Health hasn't recovered"
2492 run_test 218 "Local recovery pings should exercise all available paths"
2495 reinit_dlc || return $?
2496 add_net "${NETTYPE}" "${INTERFACES[0]}" || return $?
2497 add_net "${NETTYPE}1" "${INTERFACES[0]}" || return $?
2499 local nid1=$(lctl list_nids | head -n 1)
2500 local nid2=$(lctl list_nids | tail --lines 1)
2502 do_lnetctl ping $nid1 ||
2503 error "Ping failed $?"
2504 do_lnetctl ping $nid2 ||
2505 error "Ping failed $?"
2507 do_lnetctl discover $nid2 ||
2508 error "Discovery failed"
2510 $LNETCTL peer show --nid $nid1 | grep -q $nid2 ||
2511 error "$nid2 is not listed under $nid1"
2513 run_test 219 "Consolidate peer entries"
2521 do_rpc_nodes $node "$LNETCTL net add --net $net --if $if $opts" ||
2522 error "add $net on interface $if on node $node failed rc=$?"
2530 do_node $node "$LNETCTL route add --net $net --gateway $gw" ||
2531 error "route add to $net via $gw failed rc=$?"
2535 ROUTER_INTERFACES=()
2538 init_router_test_vars() {
2539 local rnodes=$(remote_nodes_list)
2540 [[ -z $rnodes || $(wc -w <<<$rnodes) -lt 2 ]] &&
2541 skip "Need at least 2 remote nodes found \"$rnodes\""
2543 ROUTER=$(awk '{print $1}' <<<$rnodes)
2544 RPEER=$(awk '{print $2}' <<<$rnodes)
2546 rnodes=$(comma_list $ROUTER $RPEER)
2547 local all_nodes=$(comma_list $rnodes $HOSTNAME)
2549 do_nodes $rnodes $LUSTRE_RMMOD ||
2550 error "failed to unload modules"
2552 do_rpc_nodes $rnodes "load_lnet config_on_load=1" ||
2553 error "Failed to load and configure LNet"
2555 ROUTER_INTERFACES=( $(do_rpc_nodes --quiet $ROUTER lnet_if_list) )
2557 RPEER_INTERFACES=( $(do_rpc_nodes --quiet $RPEER lnet_if_list) )
2559 do_nodes $all_nodes $LUSTRE_RMMOD ||
2560 error "Failed to unload modules"
2562 [[ ${#INTERFACES[@]} -eq 0 ]] &&
2563 error "No interfaces configured for local host $HOSTNAME"
2564 [[ ${#ROUTER_INTERFACES[@]} -eq 0 ]] &&
2565 error "No interfaces configured for router $ROUTER"
2566 [[ ${#RPEER_INTERFACES[@]} -eq 0 ]] &&
2567 error "No interfaces configured for remote peer $RPEER"
2575 LOCAL_NET=${NETTYPE}1
2576 REMOTE_NET=${NETTYPE}2
2577 setup_router_test() {
2579 local rtr_net_opts="$2"
2581 (( $MDS1_VERSION >= $(version_code 2.15.0) )) ||
2582 skip "need at least 2.15.0 for load_lnet"
2584 if [[ ${#RPEER_INTERFACES[@]} -eq 0 ]]; then
2585 init_router_test_vars ||
2589 local all_nodes=$(comma_list $ROUTER $RPEER $HOSTNAME)
2591 do_nodes $all_nodes $LUSTRE_RMMOD ||
2592 error "failed to unload modules"
2594 mod_opts+=" alive_router_check_interval=5"
2595 mod_opts+=" router_ping_timeout=5"
2596 mod_opts+=" large_router_buffers=4"
2597 mod_opts+=" small_router_buffers=8"
2598 mod_opts+=" tiny_router_buffers=16"
2599 do_rpc_nodes $all_nodes load_lnet "${mod_opts}" ||
2600 error "Failed to load lnet"
2602 do_nodes $all_nodes "$LNETCTL lnet configure" ||
2603 error "Failed to initialize DLC"
2605 do_net_add $ROUTER $LOCAL_NET ${ROUTER_INTERFACES[0]} $rtr_net_opts ||
2608 do_net_add $ROUTER $REMOTE_NET ${ROUTER_INTERFACES[0]} ||
2611 do_net_add $RPEER $REMOTE_NET ${RPEER_INTERFACES[0]} ||
2614 add_net $LOCAL_NET ${INTERFACES[0]} ||
2617 ROUTER_NIDS=( $(do_node $ROUTER $LCTL list_nids 2>/dev/null |
2619 RPEER_NIDS=( $(do_node $RPEER $LCTL list_nids 2>/dev/null |
2621 LNIDS=( $($LCTL list_nids 2>/dev/null | xargs echo) )
2629 do_nodesv $node "if $LNETCTL route show --net $net --gateway $gw; then \
2630 $LNETCTL route del --net $net --gateway $gw; \
2636 cleanup_router_test() {
2637 local all_nodes=$(comma_list $HOSTNAME $ROUTER $RPEER)
2639 do_route_del $HOSTNAME $REMOTE_NET ${ROUTER_NIDS[0]} ||
2640 error "Failed to delete $REMOTE_NET route"
2642 do_route_del $RPEER $LOCAL_NET ${ROUTER_NIDS[1]} ||
2643 error "Failed to delete $LOCAL_NET route"
2645 do_nodes $all_nodes $LUSTRE_RMMOD ||
2646 error "failed to unload modules"
2651 check_route_aliveness() {
2656 local lnetctl_actual
2660 chk_intvl=$(cat /sys/module/lnet/parameters/alive_router_check_interval)
2662 lctl_actual=$(do_node $node $LCTL show_route | awk '{print $7}')
2663 lnetctl_actual=$(do_node $node $LNETCTL route show -v |
2664 awk '/state/{print $NF}')
2666 for ((i = 0; i < $chk_intvl; i++)); do
2667 if [[ $lctl_actual == $expected ]] &&
2668 [[ $lnetctl_actual == $expected ]]; then
2672 echo "wait 1s for route state change"
2675 lctl_actual=$(do_node $node $LCTL show_route | awk '{print $7}')
2676 lnetctl_actual=$(do_node $node $LNETCTL route show -v |
2677 awk '/state/{print $NF}')
2680 [[ $lctl_actual != $expected ]] &&
2681 error "Wanted \"$expected\" lctl found \"$lctl_actual\""
2683 [[ $lnetctl_actual != $expected ]] &&
2684 error "Wanted \"$expected\" lnetctl found \"$lnetctl_actual\""
2689 check_router_ni_status() {
2690 local expected_local="$1"
2691 local expected_remote="$2"
2699 chk_intvl=$(cat /sys/module/lnet/parameters/alive_router_check_interval)
2700 timeout=$(cat /sys/module/lnet/parameters/router_ping_timeout)
2702 actual_local=$(do_node $ROUTER "$LNETCTL net show --net $LOCAL_NET" |
2703 awk '/status/{print $NF}')
2704 actual_remote=$(do_node $ROUTER "$LNETCTL net show --net $REMOTE_NET" |
2705 awk '/status/{print $NF}')
2707 for ((i = 0; i < $((chk_intvl + timeout)); i++)); do
2708 if [[ $actual_local == $expected_local ]] &&
2709 [[ $actual_remote == $expected_remote ]]; then
2713 echo "wait 1s for NI state change"
2716 actual_local=$(do_node $ROUTER \
2717 "$LNETCTL net show --net $LOCAL_NET" |
2718 awk '/status/{print $NF}')
2719 actual_remote=$(do_node $ROUTER \
2720 "$LNETCTL net show --net $REMOTE_NET" |
2721 awk '/status/{print $NF}')
2724 [[ $actual_local == $expected_local ]] ||
2725 error "$LOCAL_NET should be $expected_local"
2727 [[ $actual_remote == $expected_remote ]] ||
2728 error "$REMOTE_NET should be $expected_remote"
2733 do_basic_rtr_test() {
2734 do_node $ROUTER "$LNETCTL set routing 1" ||
2735 error "Unable to enable routing on $ROUTER"
2737 do_route_add $HOSTNAME $REMOTE_NET ${ROUTER_NIDS[0]} ||
2740 do_route_add $RPEER $LOCAL_NET ${ROUTER_NIDS[1]} ||
2743 check_route_aliveness "$HOSTNAME" "up" ||
2746 check_route_aliveness "$RPEER" "up" ||
2749 do_lnetctl ping ${RPEER_NIDS[0]} ||
2750 error "Failed to ping ${RPEER_NIDS[0]}"
2752 do_node $RPEER "$LNETCTL ping ${LNIDS[0]}" ||
2753 error "$RPEER failed to ping ${LNIDS[0]}"
2759 setup_router_test || return $?
2761 do_basic_rtr_test || return $?
2763 cleanup_router_test || return $?
2765 run_test 220 "Add routes w/default options - check aliveness"
2768 setup_router_test lnet_peer_discovery_disabled=1 || return $?
2770 do_basic_rtr_test || return $?
2772 cleanup_router_test || return $?
2774 run_test 221 "Add routes w/DD disabled - check aliveness"
2776 do_aarf_enabled_test() {
2777 do_node $ROUTER "$LNETCTL set routing 1" ||
2778 error "Unable to enable routing on $ROUTER"
2780 check_router_ni_status "down" "down"
2782 do_lnetctl ping ${RPEER_NIDS[0]} &&
2783 error "Ping should fail"
2785 do_node $RPEER "$LNETCTL ping ${LNIDS[0]}" &&
2786 error "$RPEER ping should fail"
2788 # Adding a route should cause the router's NI on LOCAL_NET to get up
2789 do_route_add $HOSTNAME $REMOTE_NET ${ROUTER_NIDS[0]} ||
2792 check_router_ni_status "up" "down" ||
2795 # But route should still be down because of avoid_asym_router_failure
2796 check_route_aliveness "$HOSTNAME" "down" ||
2799 do_lnetctl ping ${RPEER_NIDS[0]} &&
2800 error "Ping should fail"
2802 do_node $RPEER "$LNETCTL ping ${LNIDS[0]}" &&
2803 error "$RPEER ping should fail"
2805 # Adding the symmetric route should cause the remote NI to go up and
2807 do_route_add $RPEER $LOCAL_NET ${ROUTER_NIDS[1]} ||
2810 check_router_ni_status "up" "up" ||
2813 check_route_aliveness "$HOSTNAME" "up" ||
2816 check_route_aliveness "$RPEER" "up" ||
2819 do_lnetctl ping ${RPEER_NIDS[0]} ||
2820 error "Failed to ping ${RPEER_NIDS[0]}"
2822 do_node $RPEER "$LNETCTL ping ${LNIDS[0]}" ||
2823 error "$RPEER failed to ping ${LNIDS[0]}"
2825 # Stop LNet on local host
2826 do_lnetctl lnet unconfigure ||
2827 error "Failed to stop LNet rc=$?"
2829 check_router_ni_status "down" "up" ||
2832 check_route_aliveness "$RPEER" "down" ||
2835 do_lnetctl ping ${RPEER_NIDS[0]} &&
2836 error "Ping should fail"
2838 do_node $RPEER "$LNETCTL ping ${LNIDS[0]}" &&
2839 error "$RPEER ping should fail"
2845 setup_router_test avoid_asym_router_failure=1 || return $?
2847 do_aarf_enabled_test || return $?
2849 cleanup_router_test || return $?
2851 run_test 222 "Check avoid_asym_router_failure=1"
2854 local opts="avoid_asym_router_failure=1 lnet_peer_discovery_disabled=1"
2856 setup_router_test "$opts" || return $?
2858 do_aarf_enabled_test || return $?
2860 cleanup_router_test || return $?
2862 run_test 223 "Check avoid_asym_router_failure=1 w/DD disabled"
2864 do_aarf_disabled_test() {
2865 do_node $ROUTER "$LNETCTL set routing 1" ||
2866 error "Unable to enable routing on $ROUTER"
2868 check_router_ni_status "down" "down"
2870 do_route_add $HOSTNAME $REMOTE_NET ${ROUTER_NIDS[0]} ||
2873 check_router_ni_status "up" "down" ||
2876 check_route_aliveness "$HOSTNAME" "up" ||
2879 do_route_add $RPEER $LOCAL_NET ${ROUTER_NIDS[1]} ||
2882 check_router_ni_status "up" "up" ||
2885 check_route_aliveness "$HOSTNAME" "up" ||
2888 check_route_aliveness "$RPEER" "up" ||
2891 do_lnetctl ping ${RPEER_NIDS[0]} ||
2892 error "Failed to ping ${RPEER_NIDS[0]}"
2894 do_node $RPEER "$LNETCTL ping ${LNIDS[0]}" ||
2895 error "$RPEER failed to ping ${LNIDS[0]}"
2897 # Stop LNet on local host
2898 do_lnetctl lnet unconfigure ||
2899 error "Failed to stop LNet rc=$?"
2901 check_router_ni_status "down" "up" ||
2904 check_route_aliveness "$RPEER" "up" ||
2911 setup_router_test avoid_asym_router_failure=0 ||
2914 do_aarf_disabled_test ||
2917 cleanup_router_test ||
2920 run_test 224 "Check avoid_asym_router_failure=0"
2923 local opts="avoid_asym_router_failure=0 lnet_peer_discovery_disabled=1"
2925 setup_router_test "$opts" || return $?
2927 do_aarf_disabled_test || return $?
2929 cleanup_router_test ||
2932 run_test 225 "Check avoid_asym_router_failure=0 w/DD disabled"
2934 do_rtr_peer_health_test() {
2937 do_node $ROUTER "$LNETCTL set routing 1" ||
2938 error "Unable to enable routing on $ROUTER"
2940 do_route_add $HOSTNAME $REMOTE_NET ${ROUTER_NIDS[0]} ||
2943 do_route_add $RPEER $LOCAL_NET ${ROUTER_NIDS[1]} ||
2946 check_router_ni_status "up" "up" ||
2949 check_route_aliveness "$HOSTNAME" "up" ||
2952 check_route_aliveness "$RPEER" "up" ||
2955 do_lnetctl ping ${RPEER_NIDS[0]} ||
2956 error "Failed to ping ${RPEER_NIDS[0]}"
2958 do_node $RPEER "$LNETCTL ping ${LNIDS[0]}" ||
2959 error "$RPEER failed to ping ${LNIDS[0]}"
2961 # Stop LNet on local host
2962 do_lnetctl lnet unconfigure ||
2963 error "Failed to stop LNet rc=$?"
2965 check_router_ni_status "down" "up" ||
2968 check_route_aliveness "$RPEER" "up" ||
2971 # The NI used to send the message to the destination will be the
2972 # router's NI on LOCAL_NET, so that's the drop count that will be
2974 local d1=$(do_node $ROUTER $LNETCTL net show -v --net $LOCAL_NET | \
2975 awk '/drop_count:/{print $NF}')
2977 # Ping from RPEER to local host should be dropped by the router
2978 do_node $RPEER "$LCTL ping ${LNIDS[0]}" &&
2979 error "$RPEER expected ping to fail"
2981 local d2=$(do_node $ROUTER $LNETCTL net show -v --net $LOCAL_NET | \
2982 awk '/drop_count:/{print $NF}')
2984 [[ $((d2 - d1)) -ne $expected ]] &&
2985 error "Expected drop count change by $expected: $d1 -> $d2"
2991 setup_router_test avoid_asym_router_failure=0 --peer-timeout=10 ||
2994 do_rtr_peer_health_test 1 ||
2997 cleanup_router_test ||
3000 run_test 226 "Check router peer health enabled"
3003 setup_router_test avoid_asym_router_failure=0 --peer-timeout=0 ||
3006 do_rtr_peer_health_test 0 ||
3009 cleanup_router_test ||
3012 run_test 227 "Check router peer health disabled"
3015 [[ ${NETTYPE} == tcp* ]] ||
3016 skip "Need tcp NETTYPE"
3018 echo "Check valid values; Should succeed"
3022 for ((i = 4; i < 16; i+=1)); do
3023 reinit_dlc || return $?
3024 add_net "tcp" "${INTERFACES[0]}" || return $?
3025 do_lnetctl net set --all --conns-per-peer $i ||
3026 error "should have succeeded $?"
3027 $LNETCTL net show -v 1 | grep -q "conns_per_peer: $i" ||
3028 error "failed to set conns-per-peer to $i"
3029 lnid="$(lctl list_nids | head -n 1)"
3030 do_lnetctl ping "$lnid" ||
3031 error "failed to ping myself"
3033 # "lctl --net tcp conn_list" prints the list of active
3034 # connections. Since we're pinging ourselves, there should be
3035 # 2 Control connections plus 2*conns_per_peer connections
3036 # created (one Bulk Input, one Bulk Output in each pair).
3037 # Here's the sample output for conns_per_peer set to 1:
3038 # 12345-1.1.1.1@tcp I[0]host01->host01:988 2626560/1061296 nonagle
3039 # 12345-1.1.1.1@tcp O[0]host01->host01:1022 2626560/1061488 nonagle
3040 # 12345-1.1.1.1@tcp C[0]host01->host01:988 2626560/1061296 nonagle
3041 # 12345-1.1.1.1@tcp C[0]host01->host01:1023 2626560/1061488 nonagle
3042 cmd="printf 'network tcp\nconn_list\n' | lctl | grep -c '$lnid'"
3044 # Expect 2+conns_per_peer*2 connections. Wait no longer
3046 wait_update $HOSTNAME "$cmd" "$((2+i*2))" 2 ||
3047 error "expected number of tcp connections $((2+i*2))"
3050 reinit_dlc || return $?
3051 add_net "tcp" "${INTERFACES[0]}" || return $?
3052 echo "Set > 127; Should fail"
3053 do_lnetctl net set --all --conns-per-peer 128 &&
3054 error "should have failed $?"
3056 reinit_dlc || return $?
3057 add_net "tcp" "${INTERFACES[0]}" || return $?
3059 local default=$($LNETCTL net show -v 1 |
3060 awk '/conns_per_peer/{print $NF}')
3062 echo "Set < 0; Should be ignored"
3063 do_lnetctl net set --all --conns-per-peer -1 ||
3064 error "should have succeeded $?"
3065 $LNETCTL net show -v 1 | grep -q "conns_per_peer: ${default}" ||
3066 error "Did not stay at default"
3068 run_test 230 "Test setting conns-per-peer"
3071 reinit_dlc || return $?
3073 do_lnetctl net add --net ${NETTYPE} --if ${INTERFACES[0]} ||
3074 error "Failed to add net"
3076 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-expected.yaml
3077 sed -i 's/peer_timeout: .*$/peer_timeout: 0/' \
3078 $TMP/sanity-lnet-$testnum-expected.yaml
3080 reinit_dlc || return $?
3082 do_lnetctl import $TMP/sanity-lnet-$testnum-expected.yaml ||
3083 error "Failed to import configuration"
3085 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
3087 compare_yaml_files || error "Wrong config after import"
3089 do_lnetctl net del --net ${NETTYPE} --if ${INTERFACES[0]} ||
3090 error "Failed to delete net ${NETTYPE}"
3092 do_lnetctl net add --net ${NETTYPE} --if ${INTERFACES[0]} --peer-timeout=0 ||
3093 error "Failed to add net with peer-timeout=0"
3095 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
3097 compare_yaml_files || error "Wrong config after lnetctl net add"
3099 reinit_dlc || return $?
3101 # lnet/include/lnet/lib-lnet.h defines DEFAULT_PEER_TIMEOUT 180
3102 sed -i 's/peer_timeout: .*$/peer_timeout: 180/' \
3103 $TMP/sanity-lnet-$testnum-expected.yaml
3105 sed -i '/^.*peer_timeout:.*$/d' $TMP/sanity-lnet-$testnum-actual.yaml
3107 do_lnetctl import $TMP/sanity-lnet-$testnum-actual.yaml ||
3108 error "Failed to import config without peer_timeout"
3110 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
3114 run_test 231 "Check DLC handling of peer_timeout parameter"
3116 ### Test that linux route is added for each ni
3120 [[ ${NETTYPE} == tcp* ]] ||
3121 skip "Need tcp NETTYPE"
3122 reinit_dlc || return $?
3123 add_net "tcp" "${INTERFACES[0]}" || return $?
3125 skip_param=$(cat /sys/module/ksocklnd/parameters/skip_mr_route_setup)
3126 [[ ${skip_param:-0} -ne 0 ]] &&
3127 skip "Need skip_mr_route_setup=0 found $skip_param"
3129 ip route show table ${INTERFACES[0]} | grep -q "${INTERFACES[0]}"
3131 run_test 250 "test that linux routes are added"
3134 [[ ${NETTYPE} =~ kfi* ]] ||
3135 skip "Need kfi NETTYPE"
3137 reinit_dlc || return $?
3138 add_net "kfi" "${INTERFACES[0]}" || return $?
3139 add_net "kfi1" "${INTERFACES[0]}" || return $?
3140 add_net "kfi10" "${INTERFACES[0]}" || return $?
3143 run_test 251 "Define multiple kfi networks on single interface"
3146 setup_health_test false || return $?
3150 do_rpc_nodes $RNODE unload_modules_local || rc=$?
3152 if [[ $rc -ne 0 ]]; then
3153 cleanup_health_test || return $?
3155 error "Failed to unload modules on $RNODE rc=$rc"
3160 local ts1=$(date +%s)
3162 do_lnetctl ping --timeout 15 ${RNIDS[0]} &&
3163 error "Expected ping ${RNIDS[0]} to fail"
3165 local ts2=$(date +%s)
3167 local delta=$(echo "$ts2 - $ts1" | bc)
3169 [[ $delta -lt 15 ]] ||
3170 error "Ping took longer than expected to fail: $delta"
3174 run_test 252 "Ping to down peer should unlink quickly"
3179 local out=$TMP/$tfile
3180 local prefix=/usr/include/linux/lnet
3182 # We use a hard coded prefix so that this test will not fail
3185 if ! which $CC > /dev/null 2>&1; then
3186 skip_env "$CC is not installed"
3189 cleanup_lnet || exit 1
3192 local cc_args="-Wall -Werror -std=c99 -c -x c /dev/null -o $out"
3193 if ! [[ -d $prefix ]]; then
3194 # Assume we're running in tree and fixup the include path.
3195 prefix=$LUSTRE/../lnet/include/uapi/linux/lnet
3196 cc_args+=" -I $LUSTRE/../lnet/include/uapi"
3199 for header in $prefix/*.h; do
3200 if ! [[ -f "$header" ]]; then
3204 echo "$CC $cc_args -include $header"
3205 $CC $cc_args -include $header ||
3206 error "cannot compile '$header'"
3210 run_test 300 "packaged LNet UAPI headers can be compiled"
3212 # LU-16081 lnet: Memory leak on adding existing interface
3215 reinit_dlc || return $?
3216 do_lnetctl net add --net ${NETTYPE} --if ${INTERFACES[0]} ||
3217 error "Failed to add net"
3218 do_lnetctl net add --net ${NETTYPE} --if ${INTERFACES[0]} &&
3219 error "add net should have failed"
3220 do_lnetctl net del --net ${NETTYPE} --if ${INTERFACES[0]} ||
3221 error "Failed to del net"
3224 run_test 301 "Check for dynamic adds of same/wrong interface (memory leak)"
3227 ! [[ $NETTYPE =~ (tcp|o2ib) ]] && skip "Need tcp or o2ib NETTYPE"
3228 reinit_dlc || return $?
3230 add_net "${NETTYPE}" "${INTERFACES[0]}" || return $?
3232 local nid=$($LCTL list_nids)
3234 do_lnetctl ping ${nid} ||
3235 error "pinging self failed $?"
3236 do_lnetctl debug peer --nid ${nid} ||
3237 error "failed to dump peer debug info $?"
3239 run_test 302 "Check that peer debug info can be dumped"