3 # Run select tests by setting ONLY, or as arguments to the script.
4 # Skip specific tests by setting EXCEPT.
11 # bug number for skipped test:
12 ALWAYS_EXCEPT="$SANITY_LNET_EXCEPT "
13 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
15 # skip the grant tests for ARM until they are fixed
16 if [[ $(uname -m) = aarch64 ]]; then
17 # bug number: LU-14067
21 [ "$SLOW" = "no" ] && EXCEPT_SLOW=""
23 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
25 . $LUSTRE/tests/test-framework.sh
29 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
34 [[ -z $LNETCTL ]] && skip "Need lnetctl"
38 if is_mounted $MOUNT || is_mounted $MOUNT2; then
39 cleanupall || error "Failed cleanup prior to test execution"
44 echo "Cleaning up LNet"
45 lsmod | grep -q lnet &&
46 $LNETCTL lnet unconfigure 2>/dev/null
51 if module_loaded lnet ; then
52 cleanup_lnet || error "Failed to unload modules before test execution"
58 # Cleanup any tmp files created by the sub tests
59 rm -f $TMP/sanity-lnet-*.yaml $LNET_PARAMS_FILE
62 if $restore_mounts; then
63 setupall || error "Failed to setup Lustre after test execution"
64 elif $restore_modules; then
66 error "Couldn't load modules after test execution"
75 echo "ip netns exec $TESTNS $*"
76 ip netns exec $TESTNS "$@"
84 netns_arg="netns $netns"
86 ip link add 'test1pl' type veth peer name $FAKE_IF $netns_arg
87 ip link set 'test1pl' up
88 if [[ -n $netns ]]; then
89 do_ns ip addr add "${FAKE_IP}/31" dev $FAKE_IF
90 do_ns ip link set $FAKE_IF up
92 ip addr add "${FAKE_IP}/31" dev $FAKE_IF
93 ip link set $FAKE_IF up
98 ip link show test1pl >& /dev/null && ip link del test1pl || return 0
109 (ip netns list | grep -q $TESTNS) && ip netns del $TESTNS
114 echo "Loading LNet and configuring DLC"
116 do_lnetctl lnet configure
119 GLOBAL_YAML_FILE=$TMP/sanity-lnet-global.yaml
120 define_global_yaml() {
121 $LNETCTL export --backup >${GLOBAL_YAML_FILE} ||
122 error "Failed to export global yaml $?"
126 if lsmod | grep -q lnet; then
127 do_lnetctl lnet unconfigure ||
128 error "lnetctl lnet unconfigure failed $?"
129 do_lnetctl lnet configure ||
130 error "lnetctl lnet configure failed $?"
132 configure_dlc || error "configure_dlc failed $?"
137 append_global_yaml() {
138 [[ ! -e ${GLOBAL_YAML_FILE} ]] &&
139 error "Missing global yaml at ${GLOBAL_YAML_FILE}"
141 cat ${GLOBAL_YAML_FILE} >> $TMP/sanity-lnet-$testnum-expected.yaml
144 create_base_yaml_file() {
148 compare_yaml_files() {
149 local expected="$TMP/sanity-lnet-$testnum-expected.yaml"
150 local actual="$TMP/sanity-lnet-$testnum-actual.yaml"
152 ! [[ -e $expected ]] && echo "$expected not found" && return 1
153 ! [[ -e $actual ]] && echo "$actual not found" && return 1
154 diff -upN ${actual} ${expected} || rc=$?
164 local net="${nid//*@/}"
165 local addr="${nid//@*/}"
167 local num_re='[0-9]\+'
168 local ip_re="[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"
170 if [[ $net =~ gni[0-9]* ]] || [[ $net =~ kfi[0-9]* ]]; then
171 [[ $addr =~ ${num_re} ]] && return 0
173 [[ $addr =~ ${ip_re} ]] && return 0
178 local yfile=$TMP/sanity-lnet-$testnum-actual.yaml
179 local primary_nids=$(awk '/- primary nid:/{print $NF}' $yfile | xargs echo)
180 local secondary_nids=$(awk '/- nid:/{print $NF}' $yfile | xargs echo)
181 local gateway_nids=$(awk '/gateway:/{print $NF}' $yfile | xargs echo)
184 for nid in $primary_nids $secondary_nids; do
185 validate_nid "$nid" || error "Bad NID \"${nid}\""
190 validate_peer_nids() {
192 local nids_per_peer="$2"
194 local expect_p="$num_peers"
195 # The primary nid also shows up in the list of secondary nids
196 local expect_s="$(($num_peers + $(($nids_per_peer*$num_peers))))"
198 local actual_p=$(grep -c -- '- primary nid:' $TMP/sanity-lnet-$testnum-actual.yaml)
199 local actual_s=$(grep -c -- '- nid:' $TMP/sanity-lnet-$testnum-actual.yaml)
200 if [[ $expect_p -ne $actual_p ]]; then
202 error "Expected $expect_p but found $actual_p primary nids"
203 elif [[ $expect_s -ne $actual_s ]]; then
205 error "Expected $expect_s but found $actual_s secondary nids"
210 validate_gateway_nids() {
211 local expect_gw=$(grep -c -- 'gateway:' $TMP/sanity-lnet-$testnum-expected.yaml)
212 local actual_gw=$(grep -c -- 'gateway:' $TMP/sanity-lnet-$testnum-actual.yaml)
213 if [[ $expect_gw -ne $actual_gw ]]; then
215 error "Expected $expect_gw gateways but found $actual_gw gateways"
221 setup_netns || error "setup_netns failed with $?"
223 # Determine the local interface(s) used for LNet
224 load_lnet "config_on_load=1" || error "Failed to load modules"
229 INTERFACES=( $(lnet_if_list) )
231 cleanup_lnet || error "Failed to cleanup LNet"
233 stack_trap 'cleanup_testsuite' EXIT
236 load_module ../lnet/lnet/lnet || error "Failed to load module rc = $?"
237 do_lnetctl lnet configure || error "lnet configure failed rc = $?"
239 reinit_dlc || return $?
240 do_lnetctl import < ${GLOBAL_YAML_FILE} || error "Import failed $?"
241 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
242 create_base_yaml_file
243 compare_yaml_files || error "Configuration changed after import"
245 run_test 0 "Export empty config, import the config, compare"
248 local prim_nid="${1:+--prim_nid $1}"
249 local nid="${2:+--nid $2}"
251 local actual="$TMP/sanity-lnet-$testnum-actual.yaml"
253 do_lnetctl peer add ${prim_nid} ${nid} || error "peer add failed $?"
254 $LNETCTL export --backup > $actual || error "export failed $?"
260 reinit_dlc || return $?
261 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
263 - primary nid: 1.1.1.1@tcp
269 compare_peer_add "1.1.1.1@tcp"
271 run_test 1 "Add peer with single nid (tcp)"
274 reinit_dlc || return $?
275 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
277 - primary nid: 2.2.2.2@o2ib
283 compare_peer_add "2.2.2.2@o2ib"
285 run_test 2 "Add peer with single nid (o2ib)"
288 reinit_dlc || return $?
289 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
291 - primary nid: 3.3.3.3@tcp
298 compare_peer_add "3.3.3.3@tcp" "3.3.3.3@o2ib"
300 run_test 3 "Add peer with tcp primary o2ib secondary"
303 reinit_dlc || return $?
304 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
306 - primary nid: 4.4.4.4@tcp
315 echo "Add peer with nidrange (tcp)"
316 compare_peer_add "4.4.4.4@tcp" "4.4.4.[1-3]@tcp"
318 echo "Add peer with nidrange that overlaps primary nid (tcp)"
319 compare_peer_add "4.4.4.4@tcp" "4.4.4.[1-4]@tcp"
321 run_test 4 "Add peer with nidrange (tcp)"
324 reinit_dlc || return $?
325 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
327 - primary nid: 5.5.5.5@o2ib
337 echo "Add peer with nidrange (o2ib)"
338 compare_peer_add "5.5.5.5@o2ib" "5.5.5.[1-4]@o2ib"
340 echo "Add peer with nidranage that overlaps primary nid (o2ib)"
341 compare_peer_add "5.5.5.5@o2ib" "5.5.5.[1-4]@o2ib"
343 run_test 5 "Add peer with nidrange (o2ib)"
346 reinit_dlc || return $?
347 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
349 - primary nid: 6.6.6.6@tcp
372 local nid_expr="6.6.[6-7].[0-4/2]@tcp"
373 nid_expr+=",6.6.[1-4/2].[0-6/3]@o2ib"
374 nid_expr+=",[6-12/4]@gni"
375 nid_expr+=",[6-12/4]@kfi"
377 compare_peer_add "6.6.6.6@tcp" "${nid_expr}"
379 run_test 6 "Add peer with multiple nidranges"
382 local prim_nid="${1:+--prim_nid $1}"
383 local nid="${2:+--nid $2}"
385 local actual="$TMP/sanity-lnet-$testnum-actual.yaml"
387 do_lnetctl peer del ${prim_nid} ${nid} || error "peer del failed $?"
388 $LNETCTL export --backup > $actual || error "export failed $?"
394 reinit_dlc || return $?
395 create_base_yaml_file
397 echo "Delete peer with single nid (tcp)"
398 do_lnetctl peer add --prim_nid 7.7.7.7@tcp || error "Peer add failed $?"
399 compare_peer_del "7.7.7.7@tcp"
401 echo "Delete peer with single nid (o2ib)"
402 do_lnetctl peer add --prim_nid 7.7.7.7@o2ib || error "Peer add failed $?"
403 compare_peer_del "7.7.7.7@o2ib"
405 echo "Delete peer that has multiple nids (tcp)"
406 do_lnetctl peer add --prim_nid 7.7.7.7@tcp --nid 7.7.7.[8-12]@tcp ||
407 error "Peer add failed $?"
408 compare_peer_del "7.7.7.7@tcp"
410 echo "Delete peer that has multiple nids (o2ib)"
411 do_lnetctl peer add --prim_nid 7.7.7.7@o2ib --nid 7.7.7.[8-12]@o2ib ||
412 error "Peer add failed $?"
413 compare_peer_del "7.7.7.7@o2ib"
415 echo "Delete peer that has both tcp and o2ib nids"
416 do_lnetctl peer add --prim_nid 7.7.7.7@tcp \
417 --nid 7.7.7.[9-12]@tcp,7.7.7.[13-15]@o2ib ||
418 error "Peer add failed $?"
419 compare_peer_del "7.7.7.7@tcp"
421 echo "Delete peer with single nid (gni)"
422 do_lnetctl peer add --prim_nid 7@gni || error "Peer add failed $?"
423 compare_peer_del "7@gni"
425 echo "Delete peer that has multiple nids (gni)"
426 do_lnetctl peer add --prim_nid 7@gni --nid [8-12]@gni ||
427 error "Peer add failed $?"
428 compare_peer_del "7@gni"
430 echo "Delete peer with single nid (kfi)"
431 do_lnetctl peer add --prim_nid 7@kfi || error "Peer add failed $?"
432 compare_peer_del "7@kfi"
434 echo "Delete peer that has multiple nids (kfi)"
435 do_lnetctl peer add --prim_nid 7@kfi --nid [8-12]@kfi ||
436 error "Peer add failed $?"
437 compare_peer_del "7@kfi"
439 echo "Delete peer that has tcp, o2ib, gni and kfi nids"
440 do_lnetctl peer add --prim_nid 7@gni \
441 --nid [8-12]@gni,7.7.7.[1-4]@tcp,7.7.7.[5-9]@o2ib,[1-5]@kfi ||
442 error "Peer add failed $?"
443 compare_peer_del "7@gni"
445 run_test 7 "Various peer delete tests"
448 reinit_dlc || return $?
450 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
452 - primary nid: 8.8.8.8@tcp
464 do_lnetctl peer add --prim_nid 8.8.8.8@tcp --nid 8.8.8.[10-15]@tcp ||
465 error "Peer add failed $?"
466 compare_peer_del "8.8.8.8@tcp" "8.8.8.13@tcp"
468 run_test 8 "Delete single secondary nid from peer (tcp)"
471 reinit_dlc || return $?
473 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
475 - primary nid: 9.9.9.9@tcp
482 do_lnetctl peer add --prim_nid 9.9.9.9@tcp \
483 --nid 9.9.9.[11-16]@tcp || error "Peer add failed $?"
484 compare_peer_del "9.9.9.9@tcp" "9.9.9.[11-16]@tcp"
486 run_test 9 "Delete all secondary nids from peer (tcp)"
489 reinit_dlc || return $?
491 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
493 - primary nid: 10.10.10.10@tcp
496 - nid: 10.10.10.10@tcp
497 - nid: 10.10.10.12@tcp
498 - nid: 10.10.10.13@tcp
499 - nid: 10.10.10.15@tcp
500 - nid: 10.10.10.16@tcp
503 do_lnetctl peer add --prim_nid 10.10.10.10@tcp \
504 --nid 10.10.10.[12-16]@tcp || error "Peer add failed $?"
505 compare_peer_del "10.10.10.10@tcp" "10.10.10.14@tcp"
507 run_test 10 "Delete single secondary nid from peer (o2ib)"
510 reinit_dlc || return $?
512 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
514 - primary nid: 11.11.11.11@tcp
517 - nid: 11.11.11.11@tcp
520 do_lnetctl peer add --prim_nid 11.11.11.11@tcp \
521 --nid 11.11.11.[13-17]@tcp || error "Peer add failed $?"
522 compare_peer_del "11.11.11.11@tcp" "11.11.11.[13-17]@tcp"
524 run_test 11 "Delete all secondary nids from peer (o2ib)"
527 reinit_dlc || return $?
529 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
531 - primary nid: 12.12.12.12@o2ib
534 - nid: 12.12.12.12@o2ib
535 - nid: 13.13.13.13@o2ib
536 - nid: 14.13.13.13@o2ib
537 - nid: 14.15.13.13@o2ib
539 - nid: 15.17.1.10@tcp
540 - nid: 15.17.1.20@tcp
543 do_lnetctl peer add --prim_nid 12.12.12.12@o2ib \
544 --nid [13-14/1].[13-15/2].13.13@o2ib,[15-16/3].[17-19/4].[1].[5-20/5]@tcp ||
545 error "Peer add failed $?"
546 compare_peer_del "12.12.12.12@o2ib" "13.15.13.13@o2ib,15.17.1.15@tcp"
548 run_test 12 "Delete a secondary nid from peer (tcp and o2ib)"
551 reinit_dlc || return $?
553 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
555 - primary nid: 13.13.13.13@o2ib
558 - nid: 13.13.13.13@o2ib
561 do_lnetctl peer add --prim_nid 13.13.13.13@o2ib \
562 --nid [14-15].[1-2/1].[1].[100-254/10]@tcp,14.14.[254].14@o2ib ||
563 error "Peer add failed $?"
564 compare_peer_del "13.13.13.13@o2ib" \
565 "[14-15].[1-2/1].[1].[100-254/10]@tcp,14.14.[254].14@o2ib"
567 run_test 13 "Delete all secondary nids from peer (tcp and o2ib)"
573 if [[ $net =~ gni* ]] || [[ $net =~ kfi* ]]; then
576 echo "${num}.${num}.${num}.${num}@${net}"
580 create_mr_peer_yaml() {
582 local secondary_nids="$2"
585 echo "Generating peer yaml for $num_peers peers with $secondary_nids secondary nids"
586 echo "peer:" >> $TMP/sanity-lnet-$testnum-expected.yaml
588 local total_nids=$((num_peers + $((num_peers * secondary_nids))))
591 while [[ $created -lt $num_peers ]]; do
592 local primary=$(create_nid ${nidnum} ${net})
593 cat <<EOF >> $TMP/sanity-lnet-$testnum-expected.yaml
594 - primary nid: $primary
600 local start=$((nidnum + 1))
601 local end=$((nidnum + $secondary_nids))
602 for j in $(seq ${start} ${end}); do
603 local nid=$(create_nid $j ${net})
604 echo " - nid: $nid" >> $TMP/sanity-lnet-$testnum-expected.yaml
612 reinit_dlc || return $?
614 echo "Create single peer, single nid, using import"
615 create_mr_peer_yaml 1 0 tcp
616 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
617 error "Import failed $?"
619 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
622 echo "Delete single peer using import --del"
623 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml ||
624 error "Import failed $?"
625 rm -f $TMP/sanity-lnet-$testnum-expected.yaml
626 create_base_yaml_file
627 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
630 run_test 14 "import peer create/delete with single nid"
633 reinit_dlc || return $?
635 echo "Create multiple peers, single nid per peer, using import"
636 create_mr_peer_yaml 5 0 o2ib
637 # The ordering of nids for this use-case is non-deterministic, so we
638 # we can't just diff the expected/actual output.
639 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
640 error "Import failed $?"
641 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
642 validate_peer_nids 5 0
644 echo "Delete multiple peers, single nid per peer, using import --del"
645 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml ||
646 error "Import failed $?"
647 rm -f $TMP/sanity-lnet-$testnum-expected.yaml
648 create_base_yaml_file
649 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
652 run_test 15 "import multi peer create/delete with single nid per peer"
655 reinit_dlc || return $?
657 echo "Create single peer, multiple nids, using import"
658 create_mr_peer_yaml 1 5 tcp
659 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
660 error "Import failed $?"
661 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
662 validate_peer_nids 1 5
664 echo "Delete single peer, multiple nids, using import --del"
665 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml ||
666 error "Import failed $?"
667 rm -f $TMP/sanity-lnet-$testnum-expected.yaml
668 create_base_yaml_file
669 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
672 run_test 16 "import peer create/delete with multiple nids"
675 reinit_dlc || return $?
677 echo "Create multiple peers, multiple nids per peer, using import"
678 create_mr_peer_yaml 5 7 o2ib
679 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
680 error "Import failed $?"
681 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
682 validate_peer_nids 5 7
684 echo "Delete multiple peers, multiple nids per peer, using import --del"
685 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml ||
686 error "Import failed $?"
687 rm -f $TMP/sanity-lnet-$testnum-expected.yaml
688 create_base_yaml_file
689 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
692 run_test 17 "import multi peer create/delete with multiple nids"
695 reinit_dlc || return $?
697 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
699 - primary nid: 1.1.1.1@tcp
708 echo "Import peer with 5 nids"
709 cat $TMP/sanity-lnet-$testnum-expected.yaml
710 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
711 error "Import failed $?"
712 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
714 - primary nid: 1.1.1.1@tcp
721 echo "Delete three of the nids"
722 cat $TMP/sanity-lnet-$testnum-expected.yaml
723 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml
724 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
726 - primary nid: 1.1.1.1@tcp
732 echo "Check peer has expected nids remaining"
733 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
737 run_test 18a "Delete a subset of nids from a single peer using import --del"
740 reinit_dlc || return $?
742 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
744 - primary nid: 1.1.1.1@tcp
752 - primary nid: 6.6.6.6@o2ib
761 echo "Import two peers with 5 nids each"
762 cat $TMP/sanity-lnet-$testnum-expected.yaml
763 do_lnetctl import < $TMP/sanity-lnet-$testnum-expected.yaml ||
764 error "Import failed $?"
765 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
767 - primary nid: 1.1.1.1@tcp
773 - primary nid: 6.6.6.6@o2ib
780 echo "Delete three of the nids from each peer"
781 cat $TMP/sanity-lnet-$testnum-expected.yaml
782 do_lnetctl import --del < $TMP/sanity-lnet-$testnum-expected.yaml
783 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
785 - primary nid: 6.6.6.6@o2ib
790 - primary nid: 1.1.1.1@tcp
797 echo "Check peers have expected nids remaining"
798 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
800 validate_peer_nids 2 1
802 run_test 18b "Delete multiple nids from multiple peers using import --del"
805 reinit_dlc || return $?
806 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
808 - primary nid: 19@gni
814 compare_peer_add "19@gni"
816 run_test 19 "Add peer with single nid (gni)"
819 reinit_dlc || return $?
820 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
822 - primary nid: 20@gni
826 - nid: 20.20.20.20@tcp
827 - nid: 20.20.20.20@o2ib
830 compare_peer_add "20@gni" "20.20.20.20@tcp,20.20.20.20@o2ib"
832 run_test 20 "Add peer with gni primary and tcp, o2ib secondary"
835 reinit_dlc || return $?
836 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
838 - primary nid: 21@gni
848 echo "Add peer with nidrange (gni)"
849 compare_peer_add "21@gni" "[22-25]@gni" || error
850 echo "Add peer with nidrange that overlaps primary nid (gni)"
851 compare_peer_add "21@gni" "[21-25]@gni"
853 run_test 21 "Add peer with nidrange (gni)"
856 reinit_dlc || return $?
857 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
859 - primary nid: 22@gni
870 do_lnetctl peer add --prim_nid 22@gni --nid [24-29]@gni ||
871 error "Peer add failed $?"
872 compare_peer_del "22@gni" "26@gni"
874 run_test 22 "Delete single secondary nid from peer (gni)"
877 reinit_dlc || return $?
878 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
880 - primary nid: 23@gni
887 do_lnetctl peer add --prim_nid 23@gni --nid [25-29]@gni ||
888 error "Peer add failed $?"
889 compare_peer_del "23@gni" "[25-29]@gni"
891 run_test 23 "Delete all secondary nids from peer (gni)"
894 reinit_dlc || return $?
895 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
897 - primary nid: 24@gni
902 - nid: 13.13.13.13@o2ib
903 - nid: 14.13.13.13@o2ib
904 - nid: 14.15.13.13@o2ib
906 - nid: 15.17.1.10@tcp
907 - nid: 15.17.1.20@tcp
910 do_lnetctl peer add --prim_nid 24@gni \
911 --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 ||
912 error "Peer add failed $?"
913 compare_peer_del "24@gni" "5@gni,13.15.13.13@o2ib,15.17.1.15@tcp"
915 run_test 24 "Delete a secondary nid from peer (tcp, o2ib and gni)"
918 reinit_dlc || return $?
919 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
921 - primary nid: 25@gni
927 do_lnetctl peer add --prim_nid 25@gni \
928 --nid [26-27].[4-10/3].26.26@tcp,26.26.26.26@o2ib,[30-35]@gni ||
929 error "Peer add failed $?"
930 compare_peer_del "25@gni" \
931 "[26-27].[4-10/3].26.26@tcp,26.26.26.26@o2ib,[30-35]@gni"
933 run_test 25 "Delete all secondary nids from peer (tcp, gni and o2ib)"
936 reinit_dlc || return $?
938 do_lnetctl peer add --prim_nid 1.1.1.1@tcp --lock_prim ||
939 error "Peer add with --lock_prim option failed $?"
940 local peer_state=$($LNETCTL peer show -v 4 --nid 1.1.1.1@tcp |
941 awk '/peer state/ {print $NF}')
942 # This relies on the following peer state definition:
943 # #define LNET_PEER_LOCK_PRIMARY BIT(20)
944 if ((!("$peer_state" & (1 << 20)))); then
945 error "Peer state does not have 'locked' bit set: $peer_state"
947 do_lnetctl peer del --prim_nid 1.1.1.1@tcp ||
948 error "Peer del failed $?"
949 $LNETCTL peer show --nid 1.1.1.1@tcp | grep -q 1.1.1.1@tcp ||
950 error "1.1.1.1@tcp is not listed"
951 do_lnetctl peer del --prim_nid 1.1.1.1@tcp --force ||
952 error "Peer del --force failed $?"
953 do_lnetctl peer show --nid 1.1.1.1@tcp &&
954 error "failed to delete 1.1.1.1@tcp"
958 run_test 26 "Delete peer with primary nid locked"
961 reinit_dlc || return $?
963 echo "Invalid prim_nid - peer add"
964 do_lnetctl peer add --prim_nid foobar &&
965 error "Command should have failed"
967 echo "Invalid prim_nid - peer del"
968 do_lnetctl peer del --prim_nid foobar &&
969 error "Command should have failed"
971 echo "Delete non-existing peer"
972 do_lnetctl peer del --prim_nid 1.1.1.1@o2ib &&
973 error "Command should have failed"
975 echo "Don't provide mandatory argument for peer del"
976 do_lnetctl peer del --nid 1.1.1.1@tcp &&
977 error "Command should have failed"
979 echo "Don't provide mandatory argument for peer add"
980 do_lnetctl peer add --nid 1.1.1.1@tcp &&
981 error "Command should have failed"
983 echo "Don't provide mandatory arguments peer add"
984 do_lnetctl peer add &&
985 error "Command should have failed"
987 echo "Invalid secondary nids"
988 do_lnetctl peer add --prim_nid 1.1.1.1@tcp --nid foobar &&
989 error "Command should have failed"
991 echo "Exceed max nids per peer"
992 do_lnetctl peer add --prim_nid 1.1.1.1@tcp --nid 1.1.1.[2-255]@tcp &&
993 error "Command should have failed"
995 echo "Invalid net type"
996 do_lnetctl peer add --prim_nid 1@foo &&
997 error "Command should have failed"
999 echo "Invalid nid format"
1000 local invalid_nids="1@tcp 1@o2ib 1.1.1.1@gni"
1003 for nid in ${invalid_nids}; do
1004 echo "Check invalid primary nid - '$nid'"
1005 do_lnetctl peer add --prim_nid $nid &&
1006 error "Command should have failed"
1009 local invalid_strs="[2-1]@gni [a-f/x]@gni 256.256.256.256@tcp"
1010 invalid_strs+=" 1.1.1.1.[2-5/f]@tcp 1.]2[.3.4@o2ib"
1011 invalid_strs+="1.[2-4,[5-6],7-8].1.1@tcp foobar"
1014 for nidstr in ${invalid_strs}; do
1015 echo "Check invalid nidstring - '$nidstr'"
1016 do_lnetctl peer add --prim_nid 1.1.1.1@tcp --nid $nidstr &&
1017 error "Command should have failed"
1020 echo "Add non-local gateway"
1021 do_lnetctl route add --net tcp --gateway 1@gni &&
1022 error "Command should have failed"
1026 run_test 99a "Check various invalid inputs to lnetctl peer"
1029 reinit_dlc || return $?
1031 create_base_yaml_file
1033 cat <<EOF > $TMP/sanity-lnet-$testnum-invalid.yaml
1035 - primary nid: 99.99.99.99@tcp
1038 - nid: 99.99.99.99@tcp
1040 do_lnetctl import < $TMP/sanity-lnet-$testnum-invalid.yaml &&
1041 error "import should have failed"
1042 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml
1045 run_test 99b "Invalid value for Multi-Rail in yaml import"
1049 local ip=$(ip addr show dev $if | awk '/ inet /{print $2}')
1057 if ! lsmod | grep -q ksocklnd ; then
1058 load_module ../lnet/klnds/socklnd/ksocklnd ||
1059 error "Can't load ksocklnd.ko"
1062 do_lnetctl net add --net ${net} --if ${if} ||
1063 error "Failed to add net ${net} on if ${if}"
1066 compare_route_add() {
1070 local actual="$TMP/sanity-lnet-$testnum-actual.yaml"
1072 do_lnetctl route add --net ${rnet} --gateway ${gw} ||
1073 error "route add failed $?"
1074 # CPT configuration is pruned from the exported yaml, since the default
1075 # can vary across test systems (unlike default values for things like
1076 # peer_credits, peer_timeout, etc.)
1077 $LNETCTL export --backup | grep -v CPT > $actual ||
1078 error "export failed $?"
1079 validate_gateway_nids
1084 reinit_dlc || return $?
1085 add_net "tcp" "${INTERFACES[0]}"
1086 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
1095 peer_buffer_credits: 0
1101 gateway: 7.7.7.7@tcp
1104 health_sensitivity: 1
1106 - primary nid: 7.7.7.7@tcp
1112 compare_route_add "tcp7" "7.7.7.7@tcp" || return $?
1115 run_test 100 "Add route with single gw (tcp)"
1118 reinit_dlc || return $?
1119 add_net "tcp" "${INTERFACES[0]}"
1120 cat <<EOF > $TMP/sanity-lnet-$testnum-expected.yaml
1129 peer_buffer_credits: 0
1135 gateway: 8.8.8.10@tcp
1138 health_sensitivity: 1
1140 gateway: 8.8.8.9@tcp
1143 health_sensitivity: 1
1145 gateway: 8.8.8.8@tcp
1148 health_sensitivity: 1
1150 - primary nid: 8.8.8.9@tcp
1154 - primary nid: 8.8.8.10@tcp
1158 - primary nid: 8.8.8.8@tcp
1164 compare_route_add "tcp8" "8.8.8.[8-10]@tcp"
1166 run_test 101 "Add route with multiple gw (tcp)"
1168 compare_route_del() {
1172 local actual="$TMP/sanity-lnet-$testnum-actual.yaml"
1174 do_lnetctl route del --net ${rnet} --gateway ${gw} ||
1175 error "route del failed $?"
1176 $LNETCTL export --backup > $actual ||
1177 error "export failed $?"
1178 validate_gateway_nids
1182 reinit_dlc || return $?
1183 add_net "tcp" "${INTERFACES[0]}"
1184 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-expected.yaml
1185 do_lnetctl route add --net tcp102 --gateway 102.102.102.102@tcp ||
1186 error "route add failed $?"
1187 compare_route_del "tcp102" "102.102.102.102@tcp"
1189 run_test 102 "Delete route with single gw (tcp)"
1192 reinit_dlc || return $?
1193 add_net "tcp" "${INTERFACES[0]}"
1194 $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-expected.yaml
1195 do_lnetctl route add --net tcp103 \
1196 --gateway 103.103.103.[103-120/4]@tcp ||
1197 error "route add failed $?"
1198 compare_route_del "tcp103" "103.103.103.[103-120/4]@tcp"
1200 run_test 103 "Delete route with multiple gw (tcp)"
1203 local tyaml="$TMP/sanity-lnet-$testnum-expected.yaml"
1205 reinit_dlc || return $?
1207 # Default value is '3'
1208 local val=$($LNETCTL global show | awk '/response_tracking/{print $NF}')
1210 error "Expect 3 found $val"
1212 echo "Set < 0; Should fail"
1213 do_lnetctl set response_tracking -1 &&
1214 error "should have failed $?"
1216 reinit_dlc || return $?
1219 response_tracking: -10
1221 do_lnetctl import < $tyaml &&
1222 error "should have failed $?"
1224 echo "Check valid values; Should succeed"
1226 for ((i = 0; i < 4; i++)); do
1227 reinit_dlc || return $?
1228 do_lnetctl set response_tracking $i ||
1229 error "should have succeeded $?"
1230 $LNETCTL global show | grep -q "response_tracking: $i" ||
1231 error "Failed to set response_tracking to $i"
1232 reinit_dlc || return $?
1235 response_tracking: $i
1237 do_lnetctl import < $tyaml ||
1238 error "should have succeeded $?"
1239 $LNETCTL global show | grep -q "response_tracking: $i" ||
1240 error "Failed to set response_tracking to $i"
1243 reinit_dlc || return $?
1244 echo "Set > 3; Should fail"
1245 do_lnetctl set response_tracking 4 &&
1246 error "should have failed $?"
1248 reinit_dlc || return $?
1251 response_tracking: 10
1253 do_lnetctl import < $tyaml &&
1254 error "should have failed $?"
1257 run_test 104 "Set/check response_tracking param"
1260 reinit_dlc || return $?
1261 add_net "tcp" "${INTERFACES[0]}"
1262 do_lnetctl route add --net tcp105 --gateway 105.105.105.105@tcp ||
1263 error "route add failed $?"
1264 do_lnetctl peer add --prim 105.105.105.105@tcp &&
1265 error "peer add should fail"
1269 run_test 105 "Adding duplicate GW peer should fail"
1272 reinit_dlc || return $?
1273 add_net "tcp" "${INTERFACES[0]}"
1274 do_lnetctl route add --net tcp106 --gateway 106.106.106.106@tcp ||
1275 error "route add failed $?"
1276 do_lnetctl peer del --prim 106.106.106.106@tcp &&
1277 error "peer del should fail"
1281 run_test 106 "Deleting GW peer should fail"
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 cleanup_lnet || exit 1
1293 load_lnet "networks=tcp($FAKE_IF)"
1294 do_ns $LNETCTL lnet configure --all || exit 1
1295 $LNETCTL net show --net tcp | grep -q "nid: ${FAKE_IP}@tcp$"
1297 run_test 201 "load lnet using networks module options in a non-default namespace"
1300 cleanup_lnet || exit 1
1301 load_lnet "networks=\"\" ip2nets=\"tcp0($FAKE_IF) ${FAKE_IP}\""
1302 do_ns $LNETCTL lnet configure --all || exit 1
1303 $LNETCTL net show | grep -q "nid: ${FAKE_IP}@tcp$"
1305 run_test 202 "load lnet using ip2nets in a non-default namespace"
1308 ### Add the interfaces in the target namespace
1311 cleanup_lnet || exit 1
1313 do_lnetctl lnet configure || exit 1
1314 do_ns $LNETCTL net add --net tcp0 --if $FAKE_IF
1316 run_test 203 "add a network using an interface in the non-default namespace"
1318 LNET_PARAMS_FILE="$TMP/$TESTSUITE.parameters"
1319 function save_lnet_params() {
1320 $LNETCTL global show | egrep -v '^global:$' |
1321 sed 's/://' > $LNET_PARAMS_FILE
1324 function restore_lnet_params() {
1326 while read param value; do
1327 [[ $param == max_intf ]] && continue
1328 [[ $param == lnd_timeout ]] && continue
1329 $LNETCTL set ${param} ${value} ||
1330 error "Failed to restore ${param} to ${value}"
1331 done < $LNET_PARAMS_FILE
1334 function lnet_health_pre() {
1337 # Lower transaction timeout to speed up test execution
1338 $LNETCTL set transaction_timeout 10 ||
1339 error "Failed to set transaction_timeout $?"
1341 RETRY_PARAM=$($LNETCTL global show | awk '/retry_count/{print $NF}')
1342 RSND_PRE=$($LNETCTL stats show | awk '/resend_count/{print $NF}')
1343 LO_HVAL_PRE=$($LNETCTL net show -v 2 | awk '/health value/{print $NF}' |
1344 xargs echo | sed 's/ /+/g' | bc -l)
1346 RMT_HVAL_PRE=$($LNETCTL peer show --nid ${RNIDS[0]} -v 2 2>/dev/null |
1347 awk '/health value/{print $NF}' | xargs echo |
1348 sed 's/ /+/g' | bc -l)
1350 # Might not have any peers so initialize to zero.
1351 RMT_HVAL_PRE=${RMT_HVAL_PRE:-0}
1356 function lnet_health_post() {
1357 RSND_POST=$($LNETCTL stats show | awk '/resend_count/{print $NF}')
1358 LO_HVAL_POST=$($LNETCTL net show -v 2 |
1359 awk '/health value/{print $NF}' |
1360 xargs echo | sed 's/ /+/g' | bc -l)
1362 RMT_HVAL_POST=$($LNETCTL peer show --nid ${RNIDS[0]} -v 2 2>/dev/null |
1363 awk '/health value/{print $NF}' | xargs echo |
1364 sed 's/ /+/g' | bc -l)
1366 # Might not have any peers so initialize to zero.
1367 RMT_HVAL_POST=${RMT_HVAL_POST:-0}
1370 echo "Pre resends: $RSND_PRE" &&
1371 echo "Post resends: $RSND_POST" &&
1372 echo "Resends delta: $((RSND_POST - RSND_PRE))" &&
1373 echo "Pre local health: $LO_HVAL_PRE" &&
1374 echo "Post local health: $LO_HVAL_POST" &&
1375 echo "Pre remote health: $RMT_HVAL_PRE" &&
1376 echo "Post remote health: $RMT_HVAL_POST"
1380 do_lnetctl peer set --health 1000 --all
1381 do_lnetctl net set --health 1000 --all
1386 function check_no_resends() {
1387 echo "Check that no resends took place"
1388 [[ $RSND_POST -ne $RSND_PRE ]] &&
1389 error "Found resends: $RSND_POST != $RSND_PRE"
1394 function check_resends() {
1395 local delta=$((RSND_POST - RSND_PRE))
1397 echo "Check that $RETRY_PARAM resends took place"
1398 [[ $delta -ne $RETRY_PARAM ]] &&
1399 error "Expected $RETRY_PARAM resends found $delta"
1404 function check_no_local_health() {
1405 echo "Check that local NI health is unchanged"
1406 [[ $LO_HVAL_POST -ne $LO_HVAL_PRE ]] &&
1407 error "Local health changed: $LO_HVAL_POST != $LO_HVAL_PRE"
1412 function check_local_health() {
1413 echo "Check that local NI health has been changed"
1414 [[ $LO_HVAL_POST -eq $LO_HVAL_PRE ]] &&
1415 error "Local health unchanged: $LO_HVAL_POST == $LO_HVAL_PRE"
1420 function check_no_remote_health() {
1421 echo "Check that remote NI health is unchanged"
1422 [[ $RMT_HVAL_POST -ne $RMT_HVAL_PRE ]] &&
1423 error "Remote health changed: $RMT_HVAL_POST != $RMT_HVAL_PRE"
1428 function check_remote_health() {
1429 echo "Check that remote NI health has been changed"
1430 [[ $RMT_HVAL_POST -eq $RMT_HVAL_PRE ]] &&
1431 error "Remote health unchanged: $RMT_HVAL_POST == $RMT_HVAL_PRE"
1441 setup_health_test() {
1445 local rnodes=$(remote_nodes_list)
1446 [[ -z $rnodes ]] && skip "Need at least 1 remote node"
1448 cleanup_lnet || error "Failed to cleanup before test execution"
1450 # Loading modules should configure LNet with the appropriate
1451 # test-framework configuration
1452 load_lnet "config_on_load=1" || error "Failed to load modules"
1454 LNIDS=( $($LCTL list_nids | xargs echo) )
1456 RNODE=$(awk '{print $1}' <<<$rnodes)
1457 RNIDS=( $(do_node $RNODE $LCTL list_nids | xargs echo) )
1459 if [[ -z ${RNIDS[@]} ]]; then
1460 do_rpc_nodes $RNODE load_lnet "config_on_load=1"
1462 RNIDS=( $(do_node $RNODE $LCTL list_nids | xargs echo) )
1465 [[ ${#LNIDS[@]} -lt 1 ]] &&
1466 error "No NIDs configured for local host $HOSTNAME"
1467 [[ ${#RNIDS[@]} -lt 1 ]] &&
1468 error "No NIDs configured for remote host $RNODE"
1470 do_lnetctl discover ${RNIDS[0]} ||
1471 error "Unable to discover ${RNIDS[0]}"
1473 local mr=$($LNETCTL peer show --nid ${RNIDS[0]} |
1474 awk '/Multi-Rail/{print $NF}')
1476 if ${need_mr} && [[ $mr == False ]]; then
1477 cleanup_health_test || return $?
1481 if ( ! ${need_mr} && [[ ${#RNIDS[@]} -gt 1 ]] ) ||
1482 ( ! ${need_mr} && [[ ${#LNIDS[@]} -gt 1 ]] ); then
1483 cleanup_health_test || return $?
1487 if ${need_mr} && [[ ${#RNIDS[@]} -lt 2 ]]; then
1488 # Add a second, reachable NID to rnode.
1489 local net=${RNIDS[0]}
1493 local if=$(do_rpc_nodes --quiet $RNODE lnet_if_list)
1495 error "Failed to determine interface for $RNODE"
1497 do_rpc_nodes $RNODE "$LNETCTL lnet configure"
1498 do_rpc_nodes $RNODE "$LNETCTL net add --net $net --if $if" ||
1500 if [[ $rc -ne 0 ]]; then
1501 error "Failed to add interface to $RNODE rc=$?"
1503 RNIDS[1]="${RNIDS[0]}1"
1504 NET_DEL_ARGS="--net $net --if $if"
1508 if ${need_mr} && [[ ${#LNIDS[@]} -lt 2 ]]; then
1509 local net=${LNIDS[0]}
1512 do_lnetctl lnet configure &&
1513 do_lnetctl net add --net $net --if ${INTERFACES[0]} ||
1515 if [[ $rc -ne 0 ]]; then
1516 error "Failed to add interface rc=$?"
1518 LNIDS[1]="${LNIDS[0]}1"
1524 $LNETCTL peer show -v 2 | egrep -e nid -e health
1526 $LCTL set_param debug=+net
1532 cleanup_health_test() {
1535 if [[ -n $NET_DEL_ARGS ]]; then
1536 do_rpc_nodes $RNODE \
1537 "$LNETCTL net del $NET_DEL_ARGS" ||
1542 unload_modules || rc=$?
1545 do_rpc_nodes $RNODE unload_modules_local ||
1551 error "Failed cleanup"
1556 add_health_test_drop_rules() {
1560 for lnid in "${LNIDS[@]}"; do
1561 for rnid in "${RNIDS[@]}"; do
1562 $LCTL net_drop_add -s $lnid -d $rnid -m GET -r 1 -e ${hstatus}
1567 # See lnet/lnet/lib-msg.c:lnet_health_check()
1568 LNET_LOCAL_RESEND_STATUSES="local_interrupt local_dropped local_aborted"
1569 LNET_LOCAL_RESEND_STATUSES+=" local_no_route local_timeout"
1570 LNET_LOCAL_NO_RESEND_STATUSES="local_error"
1572 setup_health_test false || return $?
1575 for hstatus in ${LNET_LOCAL_RESEND_STATUSES} \
1576 ${LNET_LOCAL_NO_RESEND_STATUSES}; do
1577 echo "Simulate $hstatus"
1578 lnet_health_pre || return $?
1580 add_health_test_drop_rules ${hstatus}
1581 do_lnetctl discover ${RNIDS[0]} &&
1582 error "Should have failed"
1583 $LCTL net_drop_del -a
1587 check_no_resends || return $?
1588 check_no_local_health || return $?
1591 cleanup_health_test || return $?
1595 run_test 204 "Check no health or resends for single-rail local failures"
1598 setup_health_test true || return $?
1601 for hstatus in ${LNET_LOCAL_RESEND_STATUSES}; do
1602 echo "Simulate $hstatus"
1603 lnet_health_pre || return $?
1605 add_health_test_drop_rules ${hstatus}
1606 do_lnetctl discover ${RNIDS[0]} &&
1607 error "Should have failed"
1608 $LCTL net_drop_del -a
1612 check_resends || return $?
1613 check_local_health || return $?
1616 for hstatus in ${LNET_LOCAL_NO_RESEND_STATUSES}; do
1617 echo "Simulate $hstatus"
1618 lnet_health_pre || return $?
1620 add_health_test_drop_rules ${hstatus}
1621 do_lnetctl discover ${RNIDS[0]} &&
1622 error "Should have failed"
1623 $LCTL net_drop_del -a
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 echo "Simulate $hstatus"
1647 lnet_health_pre || return $?
1649 add_health_test_drop_rules ${hstatus}
1650 do_lnetctl discover ${RNIDS[0]} &&
1651 error "Should have failed"
1652 $LCTL net_drop_del -a
1656 check_no_resends || return $?
1657 check_no_local_health || return $?
1658 check_no_remote_health || return $?
1661 cleanup_health_test || return $?
1665 run_test 206 "Check no health or resends for single-rail remote failures"
1668 setup_health_test true || return $?
1671 for hstatus in ${LNET_REMOTE_RESEND_STATUSES}; do
1672 echo "Simulate $hstatus"
1673 lnet_health_pre || return $?
1675 add_health_test_drop_rules ${hstatus}
1677 do_lnetctl discover ${RNIDS[0]} &&
1678 error "Should have failed"
1682 $LCTL net_drop_del -a
1684 check_resends || return $?
1685 check_no_local_health || return $?
1686 check_remote_health || return $?
1687 do_lnetctl peer set --health 1000 --all ||
1688 error "Unable to reset health rc=$?"
1690 for hstatus in ${LNET_REMOTE_NO_RESEND_STATUSES}; do
1691 echo "Simulate $hstatus"
1692 lnet_health_pre || return $?
1694 add_health_test_drop_rules ${hstatus}
1696 do_lnetctl discover ${RNIDS[0]} &&
1697 error "Should have failed"
1701 $LCTL net_drop_del -a
1703 check_no_resends || return $?
1704 check_no_local_health || return $?
1705 check_remote_health || return $?
1706 do_lnetctl peer set --health 1000 --all ||
1707 error "Unable to reset health rc=$?"
1710 cleanup_health_test || return $?
1714 run_test 207 "Check health and resends for multi-rail remote errors"
1716 test_208_load_and_check_lnet() {
1720 local num_expected=1
1722 load_lnet "networks=\"\" ip2nets=\"${ip2nets_str}\""
1725 error "Failed to load LNet with ip2nets \"${ip2nets_str}\""
1731 nids=( $($LCTL list_nids) )
1733 [[ ${#nids[@]} -ne ${num_expected} ]] &&
1734 error "Expect ${num_expected} NIDs found ${#nids[@]}"
1736 [[ ${nids[0]} == ${p_nid} ]] ||
1737 error "Expect NID \"${p_nid}\" found \"${nids[0]}\""
1739 [[ -n $s_nid ]] && [[ ${nids[1]} != ${s_nid} ]] &&
1740 error "Expect second NID \"${s_nid}\" found \"${nids[1]}\""
1742 $LCTL net down &>/dev/null
1747 cleanup_netns || error "Failed to cleanup netns before test execution"
1748 cleanup_lnet || error "Failed to unload modules before test execution"
1749 setup_fakeif || error "Failed to add fake IF"
1751 have_interface "$FAKE_IF" ||
1752 error "Expect $FAKE_IF configured but not found"
1754 local if0_ip=$(ip --oneline addr show dev ${INTERFACES[0]} |
1755 awk '/inet /{print $4}' |
1757 if0_ip=($(echo "${if0_ip[@]}" | tr ' ' '\n' | uniq | tr '\n' ' '))
1758 local ip2nets_str="tcp(${INTERFACES[0]}) $if0_ip"
1760 echo "Configure single NID \"$ip2nets_str\""
1761 test_208_load_and_check_lnet "${ip2nets_str}" "${if0_ip}@tcp"
1763 ip2nets_str="tcp(${INTERFACES[0]}) $if0_ip; tcp1($FAKE_IF) $FAKE_IP"
1764 echo "Configure two NIDs; two NETs \"$ip2nets_str\""
1765 test_208_load_and_check_lnet "${ip2nets_str}" "${if0_ip}@tcp" \
1768 ip2nets_str="tcp(${INTERFACES[0]}) $if0_ip; tcp($FAKE_IF) $FAKE_IP"
1769 echo "Configure two NIDs; one NET \"$ip2nets_str\""
1770 test_208_load_and_check_lnet "${ip2nets_str}" "${if0_ip}@tcp" \
1772 local addr1=( ${if0_ip//./ } )
1773 local addr2=( ${FAKE_IP//./ } )
1774 local range="[${addr1[0]},${addr2[0]}]"
1777 for i in $(seq 1 3); do
1778 range+=".[${addr1[$i]},${addr2[$i]}]"
1780 ip2nets_str="tcp(${INTERFACES[0]},${FAKE_IF}) ${range}"
1782 echo "Configured two NIDs; one NET alt syntax \"$ip2nets_str\""
1783 test_208_load_and_check_lnet "${ip2nets_str}" "${if0_ip}@tcp" \
1788 echo "alt syntax with missing IF \"$ip2nets_str\""
1789 load_lnet "networks=\"\" ip2nets=\"${ip2nets_str}\""
1791 echo "$LCTL net up should fail"
1793 error "LNet bringup should have failed"
1797 run_test 208 "Test various kernel ip2nets configurations"
1800 setup_health_test false || return $?
1802 echo "Simulate network_timeout w/SR config"
1805 add_health_test_drop_rules network_timeout
1807 do_lnetctl discover ${RNIDS[0]} &&
1808 error "Should have failed"
1809 $LCTL net_drop_del -a
1813 check_no_resends || return $?
1814 check_no_local_health || return $?
1815 check_no_remote_health || return $?
1817 cleanup_health_test || return $?
1819 setup_health_test true || return $?
1821 echo "Simulate network_timeout w/MR config"
1825 add_health_test_drop_rules network_timeout
1827 do_lnetctl discover ${RNIDS[0]} &&
1828 error "Should have failed"
1829 $LCTL net_drop_del -a
1833 check_no_resends || return $?
1834 check_local_health || return $?
1835 check_remote_health || return $?
1837 cleanup_health_test || return $?
1841 run_test 209 "Check health, but not resends, for network timeout"
1843 check_nid_in_recovq() {
1844 local recovq=$($LNETCTL debug recovery $1)
1846 local nids=$($LCTL list_nids | xargs echo)
1850 echo "Check \"$1\" recovery queue"
1852 if [[ $(grep -c 'nid-'<<<$recovq) -ne $expect ]]; then
1853 error "Expect $expect NIDs found: \"$recovq\""
1856 [[ $expect -eq 0 ]] && return 0
1858 for nid in ${nids}; do
1859 grep -q "nid-0: $nid"<<<$recovq &&
1864 error "Didn't find local NIDs in recovery queue: \"$recovq\""
1870 # First enqueue happens at time 0.
1871 # 2nd at 0 + 2^0 = 1
1872 # 3rd at 1 + 2^1 = 3
1873 # 4th at 3 + 2^2 = 7
1874 # 5th at 7 + 2^3 = 15
1875 # e.g. after 10 seconds we would expect to have seen the 4th enqueue,
1876 # (3 pings sent, 4th about to happen) and the 5th enqueue is yet to
1878 # If the recovery limit is 10 seconds, then when the 5th enqueue happens
1879 # we expect the peer NI to have aged out, so it will not actually be
1881 check_ping_count() {
1885 echo "Check ping counts:"
1887 if [[ $queue == "ni" ]]; then
1888 $LNETCTL net show -v 2 | egrep 'nid|health value|ping'
1889 ping_count=( $($LNETCTL net show -v 2 |
1890 awk '/ping_count/{print $NF}') )
1891 elif [[ $queue == "peer_ni" ]]; then
1892 $LNETCTL peer show -v 2 | egrep 'nid|health value|ping'
1893 ping_count=( $($LNETCTL peer show -v 2 |
1894 awk '/ping_count/{print $NF}') )
1896 error "Unrecognized queue \"$queue\""
1902 for count in "${ping_count[@]}"; do
1903 if [[ $count -eq $expect ]]; then
1904 if [[ $expect -ne 0 ]] && $found ; then
1905 error "Found more than one interface matching \"$expect\" ping count"
1908 echo "Expect ping count \"$expect\" found \"$count\""
1911 elif [[ $count -ne 0 ]]; then
1912 error "Found interface with ping count \"$count\" but expect \"$expect\""
1921 reinit_dlc || return $?
1922 add_net "tcp" "${INTERFACES[0]}" || return $?
1923 add_net "tcp1" "${INTERFACES[0]}" || return $?
1925 local prim_nid=$($LCTL list_nids | head -n 1)
1927 do_lnetctl discover $prim_nid ||
1928 error "failed to discover myself"
1930 # Set recovery limit to 10 seconds.
1931 do_lnetctl set recovery_limit 10 ||
1932 error "failed to set recovery_limit"
1934 $LCTL set_param debug=+net
1935 # Use local_error so LNet doesn't attempt to resend the discovery ping
1936 $LCTL net_drop_add -s *@tcp -d *@tcp -m GET -r 1 -e local_error
1937 $LCTL net_drop_add -s *@tcp1 -d *@tcp1 -m GET -r 1 -e local_error
1938 do_lnetctl discover $($LCTL list_nids | head -n 1) &&
1939 error "Expected discovery to fail"
1942 check_nid_in_recovq "-l" 1
1943 check_ping_count "ni" "2"
1947 check_nid_in_recovq "-l" 1
1948 check_ping_count "ni" "3"
1950 $LCTL net_drop_del -a
1954 run_test 210 "Local NI recovery checks"
1957 reinit_dlc || return $?
1958 add_net "tcp" "${INTERFACES[0]}" || return $?
1959 add_net "tcp1" "${INTERFACES[0]}" || return $?
1961 local prim_nid=$($LCTL list_nids | head -n 1)
1963 do_lnetctl discover $prim_nid ||
1964 error "failed to discover myself"
1966 # Set recovery limit to 10 seconds.
1967 do_lnetctl set recovery_limit 10 ||
1968 error "failed to set recovery_limit"
1970 $LCTL net_drop_add -s *@tcp -d *@tcp -m GET -r 1 -e remote_error
1971 $LCTL net_drop_add -s *@tcp1 -d *@tcp1 -m GET -r 1 -e remote_error
1973 # Set health to 0 on one interface. This forces it onto the recovery
1975 $LNETCTL peer set --nid $prim_nid --health 0
1977 # After 5 seconds, we expect the peer NI to still be in recovery
1979 check_nid_in_recovq "-p" 1
1980 check_ping_count "peer_ni" "2"
1982 # After 15 seconds, the peer NI should have been fully processed out of
1983 # the recovery queue. We'll allow a total of 17 seconds to account for
1984 # differences in sleeping for whole seconds vs. the more accurate time
1985 # keeping that is done in the recovery code.
1987 check_nid_in_recovq "-p" 0
1988 check_ping_count "peer_ni" "4"
1990 $LCTL net_drop_del -a
1992 # Set health to force it back onto the recovery queue. Set to 500 means
1993 # in 5 seconds it should be back at maximum value. We'll wait a couple
1994 # more seconds than that to be safe.
1995 # NB: we reset the recovery limit to 0 (indefinite) so the peer NI is
1997 do_lnetctl set recovery_limit 0 ||
1998 error "failed to set recovery_limit"
2000 $LNETCTL peer set --nid $prim_nid --health 500
2002 check_nid_in_recovq "-p" 1
2003 check_ping_count "peer_ni" "2"
2007 check_nid_in_recovq "-p" 0
2008 check_ping_count "peer_ni" "0"
2012 run_test 211 "Remote NI recovery checks"
2015 local rnodes=$(remote_nodes_list)
2016 [[ -z $rnodes ]] && skip "Need at least 1 remote node"
2018 cleanup_lnet || error "Failed to cleanup before test execution"
2020 # Loading modules should configure LNet with the appropriate
2021 # test-framework configuration
2022 load_lnet "config_on_load=1" || error "Failed to load modules"
2024 local my_nid=$($LCTL list_nids | head -n 1)
2026 error "Failed to get primary NID for local host $HOSTNAME"
2028 local rnode=$(awk '{print $1}' <<<$rnodes)
2029 local rnodenids=$(do_node $rnode $LCTL list_nids | xargs echo)
2032 if [[ -z $rnodenids ]]; then
2033 do_rpc_nodes $rnode load_lnet "config_on_load=1"
2035 rnodenids=$(do_node $rnode $LCTL list_nids | xargs echo)
2038 local rnodepnid=$(awk '{print $1}' <<< $rnodenids)
2040 [[ -z $rnodepnid ]] &&
2041 error "Failed to get primary NID for remote host $rnode"
2043 log "Initial discovery"
2044 do_lnetctl discover --force $rnodepnid ||
2045 error "Failed to discover $rnodepnid"
2047 do_node $rnode "$LNETCTL discover --force $my_nid" ||
2048 error "$rnode failed to discover $my_nid"
2050 log "Fail local discover ping to set LNET_PEER_REDISCOVER flag"
2051 $LCTL net_drop_add -s "*@$NETTYPE" -d "*@$NETTYPE" -r 1 -e local_error
2052 do_lnetctl discover --force $rnodepnid &&
2053 error "Discovery should have failed"
2054 $LCTL net_drop_del -a
2057 for nid in $rnodenids; do
2058 # We need GET (PING) delay just long enough so we can trigger
2059 # discovery on the remote peer
2060 $LCTL net_delay_add -s "*@$NETTYPE" -d $nid -r 1 -m GET -l 3
2061 $LCTL net_drop_add -s "*@$NETTYPE" -d $nid -r 1 -m GET -e local_error
2062 # We need PUT (PUSH) delay just long enough so we can process
2064 $LCTL net_delay_add -s "*@$NETTYPE" -d $nid -r 1 -m PUT -l 6
2067 log "Force $HOSTNAME to discover $rnodepnid (in background)"
2068 # We want to get a PING sent that we know will eventually fail.
2069 # The delay rules we added will ensure the ping is not sent until
2070 # the PUSH is also in flight (see below), and the drop rule ensures that
2071 # when the PING is eventually sent it will error out
2072 do_lnetctl discover --force $rnodepnid &
2075 # We want a discovery PUSH from rnode to put rnode back on our
2076 # discovery queue. This should cause us to try and send a PUSH to rnode
2077 # while the PING is still outstanding.
2078 log "Force $rnode to discover $my_nid"
2079 do_node $rnode $LNETCTL discover --force $my_nid
2081 # At this point we'll have both PING_SENT and PUSH_SENT set for the
2082 # rnode peer. Wait for the PING to error out which should terminate the
2083 # discovery process that we backgrounded.
2084 log "Wait for $pid1"
2086 log "Finished wait on $pid1"
2088 # The PING send failure clears the PING_SENT flag and puts the peer back
2089 # on the discovery queue. When discovery thread processes the peer it
2090 # will mistakenly clear the PUSH_SENT flag (and set PUSH_FAILED).
2091 # Discovery will then complete for this peer even though we have an
2093 # When PUSH is actually unlinked it will be forced back onto the
2094 # discovery queue, but we no longer have a ref on the peer. When
2095 # discovery completes again, we'll trip the ASSERT in
2096 # lnet_destroy_peer_locked()
2098 # Delete the delay rules to send the PUSH
2099 $LCTL net_delay_del -a
2100 # Delete the drop rules
2101 $LCTL net_drop_del -a
2104 error "Failed to unload modules"
2106 do_rpc_nodes $rnode unload_modules_local ||
2107 error "Failed to unload modules on $rnode"
2112 run_test 212 "Check discovery refcount loss bug (LU-14627)"
2115 cleanup_netns || error "Failed to cleanup netns before test execution"
2116 cleanup_lnet || error "Failed to unload modules before test execution"
2118 setup_fakeif || error "Failed to add fake IF"
2119 have_interface "$FAKE_IF" ||
2120 error "Expect $FAKE_IF configured but not found"
2122 reinit_dlc || return $?
2124 add_net "tcp" "${INTERFACES[0]}" || return $?
2125 add_net "tcp" "$FAKE_IF" || return $?
2127 local nid1=$(lctl list_nids | head -n 1)
2128 local nid2=$(lctl list_nids | tail --lines 1)
2130 [[ $(lctl which_nid $nid1 $nid2) == $nid1 ]] ||
2131 error "Expect nid1 \"$nid1\" to be preferred"
2133 [[ $(lctl which_nid $nid2 $nid1) == $nid2 ]] ||
2134 error "Expect nid2 \"$nid2\" to be preferred"
2138 run_test 213 "Check LNetDist calculation for multiple local NIDs"
2140 function check_ni_status() {
2144 local status=$($LNETCTL net show |
2146 awk '/status/{print $NF}')
2148 echo "NI ${nid} expect status \"${expect}\" found \"${status}\""
2149 if [[ $status != $expect ]]; then
2150 error "Error: Expect NI status \"$expect\" for NID \"$nid\" but found \"$status\""
2157 cleanup_netns || error "Failed to cleanup netns before test execution"
2158 cleanup_lnet || error "Failed to unload modules before test execution"
2160 setup_fakeif || error "Failed to add fake IF"
2161 have_interface "$FAKE_IF" ||
2162 error "Expect $FAKE_IF configured but not found"
2164 reinit_dlc || return $?
2166 add_net "tcp" "${INTERFACES[0]}" || return $?
2167 add_net "tcp" "$FAKE_IF" || return $?
2169 local nid1=$(lctl list_nids | head -n 1)
2170 local nid2=$(lctl list_nids | tail --lines 1)
2172 check_ni_status "0@lo" up
2173 check_ni_status "$nid1" up
2174 check_ni_status "$nid2" up
2176 echo "Set $FAKE_IF down"
2177 echo "ip link set dev $FAKE_IF down"
2178 ip link set dev $FAKE_IF down
2179 check_ni_status "0@lo" up
2180 check_ni_status "$nid1" up
2181 check_ni_status "$nid2" down
2183 run_test 214 "Check local NI status when link is downed"
2189 $LNETCTL net show -v 2 |
2190 egrep -e nid -e $stat |
2192 awk '/'$stat':/{print $NF}'
2197 for nidvar in nid1 nid2; do
2198 for stat in send_count recv_count; do
2199 s=$(get_ni_stat ${!nidvar} $stat)
2200 eval ${nidvar}_pre_${stat}=$s
2207 for nidvar in nid1 nid2; do
2208 for stat in send_count recv_count; do
2209 s=$(get_ni_stat ${!nidvar} $stat)
2210 eval ${nidvar}_post_${stat}=$s
2220 eval pre=\${${nidvar}_pre_${stat}}
2221 eval post=\${${nidvar}_post_${stat}}
2223 echo "${!nidvar} pre ${stat} $pre post ${stat} $post"
2225 [[ $pre -ne $post ]]
2229 cleanup_netns || error "Failed to cleanup netns before test execution"
2230 cleanup_lnet || error "Failed to unload modules before test execution"
2232 reinit_dlc || return $?
2234 add_net "tcp1" "${INTERFACES[0]}" || return $?
2235 add_net "tcp2" "${INTERFACES[0]}" || return $?
2237 local nid1=$($LCTL list_nids | head -n 1)
2238 local nid2=$($LCTL list_nids | tail --lines 1)
2240 do_lnetctl peer add --prim $nid1 --nid $nid2 ||
2241 error "Failed to add peer"
2245 for nidvarA in nid1 nid2; do
2248 for nidvarB in nid1 nid2; do
2249 [[ $nidvarA == $nidvarB ]] && continue
2253 echo "$LNETCTL ping $dst x $npings"
2254 for i in $(seq 1 $npings); do
2255 $LNETCTL ping $dst &>/dev/null ||
2256 error "$LNETCTL ping $dst failed"
2261 # No source specified, sends to either NID should cause
2262 # counts to increase across both NIs
2263 for nidvar in nid1 nid2; do
2264 for stat in send_count recv_count; do
2265 ni_stat_changed $nidvar $stat ||
2266 error "$stat unchanged for ${!nidvar}"
2272 echo "$LNETCTL ping --source $src $dst x $npings"
2273 for i in $(seq 1 $npings); do
2274 $LNETCTL ping --source $src $dst &>/dev/null ||
2275 error "$LNETCTL ping --source $src $dst failed"
2280 # src nid == dest nid means stats for the _other_ NI
2281 # should be unchanged
2282 for nidvar in nid1 nid2; do
2283 for stat in send_count recv_count; do
2284 if [[ ${!nidvar} == $src ]]; then
2285 ni_stat_changed $nidvar $stat ||
2286 error "$stat unchanged for ${!nidvar}"
2288 ni_stat_changed $nidvar $stat &&
2289 error "$stat changed for ${!nidvar}"
2294 # Double number of pings for next iteration because the net
2295 # sequence numbers will have diverged
2296 npings=$(($npings * 2))
2299 # Ping from nid1 to nid2 should fail
2300 do_lnetctl ping --source $nid1 $nid2 &&
2301 error "ping from $nid1 to $nid2 should fail"
2303 # Ping from nid2 to nid1 should fail
2304 do_lnetctl ping --source $nid2 $nid1 &&
2305 error "ping from $nid2 to $nid1 should fail"
2309 run_test 215 "Test lnetctl ping --source option"
2314 reinit_dlc || return $?
2316 add_net "tcp" "${INTERFACES[0]}" || return $?
2317 add_net "tcp1" "${INTERFACES[0]}" || return $?
2319 local nids=( $($LCTL list_nids | xargs echo) )
2321 do_lnetctl discover ${nids[0]} ||
2322 error "Initial discovery failed"
2324 do_lnetctl ping --source ${nids[0]} ${nids[0]} ||
2325 error "Initial ping failed $?"
2327 do_lnetctl ping --source ${nids[1]} ${nids[1]} ||
2328 error "Initial ping failed $?"
2331 for src in "${nids[@]}"; do
2332 for dst in "${nids[@]}"; do
2333 $LCTL net_drop_add -r 1 -s $src -d $dst -e network_timeout
2337 do_lnetctl ping ${nids[0]} || rc=$?
2339 $LCTL net_drop_del -a
2342 error "expected ping to fail"
2344 check_nid_in_recovq "-p" 0
2345 check_nid_in_recovq "-l" 1
2349 run_test 216 "Failed send to peer NI owned by local host should not trigger peer NI recovery"
2352 reinit_dlc || return $?
2354 [[ $($LNETCTL net show | grep -c nid) -ne 1 ]] &&
2355 error "Unexpected number of NIs after initalizing DLC"
2357 do_lnetctl discover 0@lo ||
2358 error "Failed to discover 0@lo"
2362 run_test 217 "Don't leak memory when discovering peer with nnis <= 1"
2365 reinit_dlc || return $?
2367 [[ ${#INTERFACES[@]} -lt 2 ]] &&
2368 skip "Need two LNet interfaces"
2370 add_net "tcp" "${INTERFACES[0]}" || return $?
2372 local nid1=$($LCTL list_nids | head -n 1)
2374 do_lnetctl ping $nid1 ||
2377 add_net "tcp" "${INTERFACES[1]}" || return $?
2379 local nid2=$($LCTL list_nids | tail --lines 1)
2381 do_lnetctl ping $nid2 ||
2384 $LCTL net_drop_add -s $nid1 -d $nid1 -e local_error -r 1
2386 do_lnetctl ping $nid1 &&
2387 error "ping should have failed"
2389 local health_recovered
2392 for i in $(seq 1 5); do
2393 health_recovered=$($LNETCTL net show -v 2 |
2394 grep -c 'health value: 1000')
2396 if [[ $health_recovered -ne 2 ]]; then
2397 echo "Wait 1 second for health to recover"
2404 health_recovered=$($LNETCTL net show -v 2 |
2405 grep -c 'health value: 1000')
2407 $LCTL net_drop_del -a
2409 [[ $health_recovered -ne 2 ]] &&
2410 do_lnetctl net show -v 2 | egrep -e nid -e health &&
2411 error "Health hasn't recovered"
2415 run_test 218 "Local recovery pings should exercise all available paths"
2418 reinit_dlc || return $?
2419 add_net "tcp" "${INTERFACES[0]}" || return $?
2420 add_net "tcp1" "${INTERFACES[0]}" || return $?
2422 local nid1=$(lctl list_nids | head -n 1)
2423 local nid2=$(lctl list_nids | tail --lines 1)
2425 do_lnetctl ping $nid1 ||
2426 error "Ping failed $?"
2427 do_lnetctl ping $nid2 ||
2428 error "Ping failed $?"
2430 do_lnetctl discover $nid2 ||
2431 error "Discovery failed"
2433 $LNETCTL peer show --nid $nid1 | grep -q $nid2 ||
2434 error "$nid2 is not listed under $nid1"
2436 run_test 219 "Consolidate peer entries"
2440 echo "Check valid values; Should succeed"
2444 for ((i = 4; i < 16; i+=1)); do
2445 reinit_dlc || return $?
2446 add_net "tcp" "${INTERFACES[0]}" || return $?
2447 do_lnetctl net set --all --conns-per-peer $i ||
2448 error "should have succeeded $?"
2449 $LNETCTL net show -v 1 | grep -q "conns_per_peer: $i" ||
2450 error "failed to set conns-per-peer to $i"
2451 lnid="$(lctl list_nids | head -n 1)"
2452 do_lnetctl ping "$lnid" ||
2453 error "failed to ping myself"
2455 # "lctl --net tcp conn_list" prints the list of active
2456 # connections. Since we're pinging ourselves, there should be
2457 # 2 Control connections plus 2*conns_per_peer connections
2458 # created (one Bulk Input, one Bulk Output in each pair).
2459 # Here's the sample output for conns_per_peer set to 1:
2460 # 12345-1.1.1.1@tcp I[0]host01->host01:988 2626560/1061296 nonagle
2461 # 12345-1.1.1.1@tcp O[0]host01->host01:1022 2626560/1061488 nonagle
2462 # 12345-1.1.1.1@tcp C[0]host01->host01:988 2626560/1061296 nonagle
2463 # 12345-1.1.1.1@tcp C[0]host01->host01:1023 2626560/1061488 nonagle
2464 cmd="printf 'network tcp\nconn_list\n' | lctl | grep -c '$lnid'"
2466 # Expect 2+conns_per_peer*2 connections. Wait no longer
2468 wait_update $HOSTNAME "$cmd" "$((2+i*2))" 2 ||
2469 error "expected number of tcp connections $((2+i*2))"
2472 reinit_dlc || return $?
2473 add_net "tcp" "${INTERFACES[0]}" || return $?
2474 echo "Set > 127; Should fail"
2475 do_lnetctl net set --all --conns-per-peer 128 &&
2476 error "should have failed $?"
2478 reinit_dlc || return $?
2479 add_net "tcp" "${INTERFACES[0]}" || return $?
2480 echo "Set < 0; Should be ignored"
2481 do_lnetctl net set --all --conns-per-peer -1 ||
2482 error "should have succeeded $?"
2483 $LNETCTL net show -v 1 | grep -q "conns_per_peer: 1" ||
2484 error "Did not stay at default"
2486 run_test 230 "Test setting conns-per-peer"
2488 ### Test that linux route is added for each ni
2490 reinit_dlc || return $?
2491 add_net "tcp" "${INTERFACES[0]}" || return $?
2492 ip route show table ${INTERFACES[0]} | grep -q "${INTERFACES[0]}"
2494 run_test 250 "test that linux routes are added"
2499 local out=$TMP/$tfile
2500 local prefix=/usr/include/linux/lnet
2502 # We use a hard coded prefix so that this test will not fail
2505 if ! which $CC > /dev/null 2>&1; then
2506 skip_env "$CC is not installed"
2509 cleanup_lnet || exit 1
2512 local cc_args="-Wall -Werror -std=c99 -c -x c /dev/null -o $out"
2513 if ! [[ -d $prefix ]]; then
2514 # Assume we're running in tree and fixup the include path.
2515 prefix=$LUSTRE/../lnet/include/uapi/linux/lnet
2516 cc_args+=" -I $LUSTRE/../lnet/include/uapi"
2519 for header in $prefix/*.h; do
2520 if ! [[ -f "$header" ]]; then
2524 echo "$CC $cc_args -include $header"
2525 $CC $cc_args -include $header ||
2526 error "cannot compile '$header'"
2530 run_test 300 "packaged LNet UAPI headers can be compiled"