set -e
ONLY=${ONLY:-"$*"}
+
# bug number for skipped test:
ALWAYS_EXCEPT="$SANITY_LNET_EXCEPT "
-[ "$SLOW" = "no" ] && EXCEPT_SLOW=""
# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
+# skip the grant tests for ARM until they are fixed
+if [[ $(uname -m) = aarch64 ]]; then
+ # bug number: LU-14067
+ ALWAYS_EXCEPT+=" 300"
+fi
+
+[ "$SLOW" = "no" ] && EXCEPT_SLOW=""
+
LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
. $LUSTRE/tests/test-framework.sh
cleanup_lnet() {
echo "Cleaning up LNet"
- $LNETCTL lnet unconfigure 2>/dev/null
+ lsmod | grep -q lnet &&
+ $LNETCTL lnet unconfigure 2>/dev/null
unload_modules
}
ip netns exec $TESTNS "$@"
}
+setup_fakeif() {
+ local netns="$1"
+
+ local netns_arg=""
+ [[ -n $netns ]] &&
+ netns_arg="netns $netns"
+
+ ip link add 'test1pl' type veth peer name $FAKE_IF $netns_arg
+ ip link set 'test1pl' up
+ if [[ -n $netns ]]; then
+ do_ns ip addr add "${FAKE_IP}/31" dev $FAKE_IF
+ do_ns ip link set $FAKE_IF up
+ else
+ ip addr add "${FAKE_IP}/31" dev $FAKE_IF
+ ip link set $FAKE_IF up
+ fi
+}
+
+cleanup_fakeif() {
+ ip link show test1pl >& /dev/null && ip link del test1pl || return 0
+}
+
setup_netns() {
cleanup_netns
ip netns add $TESTNS
- ip link add 'test1pl' type veth peer name $FAKE_IF netns $TESTNS
- ip link set 'test1pl' up
- do_ns ip addr add "${FAKE_IP}/31" dev $FAKE_IF
- do_ns ip link set $FAKE_IF up
+ setup_fakeif $TESTNS
}
cleanup_netns() {
(ip netns list | grep -q $TESTNS) && ip netns del $TESTNS
- ip link show test1pl >& /dev/null && ip link del test1pl || return 0
+ cleanup_fakeif
}
configure_dlc() {
- nid: 25@gni
EOF
append_global_yaml
- echo"Add peer with nidrange (gni)"
+ echo "Add peer with nidrange (gni)"
compare_peer_add "21@gni" "[22-25]@gni" || error
echo "Add peer with nidrange that overlaps primary nid (gni)"
compare_peer_add "21@gni" "[21-25]@gni"
do_lnetctl peer del --prim_nid 1.1.1.1@o2ib &&
error "Command should have failed"
- echo "Don't provide mandatory arguments peer del"
+ echo "Don't provide mandatory argument for peer del"
do_lnetctl peer del --nid 1.1.1.1@tcp &&
error "Command should have failed"
+ echo "Don't provide mandatory argument for peer add"
+ do_lnetctl peer add --nid 1.1.1.1@tcp &&
+ error "Command should have failed"
+
echo "Don't provide mandatory arguments peer add"
do_lnetctl peer add &&
error "Command should have failed"
local nidstr
for nidstr in ${invalid_strs}; do
echo "Check invalid nidstring - '$nidstr'"
- do_lnetctl peer add --nid $nidstr &&
+ do_lnetctl peer add --prim_nid 1.1.1.1@tcp --nid $nidstr &&
error "Command should have failed"
done
}
run_test 103 "Delete route with multiple gw (tcp)"
+test_104() {
+ local tyaml="$TMP/sanity-lnet-$testnum-expected.yaml"
+
+ reinit_dlc || return $?
+
+ # Default value is '3'
+ local val=$($LNETCTL global show | awk '/response_tracking/{print $NF}')
+ [[ $val -ne 3 ]] &&
+ error "Expect 3 found $val"
+
+ echo "Set < 0; Should fail"
+ do_lnetctl set response_tracking -1 &&
+ error "should have failed $?"
+
+ reinit_dlc || return $?
+ cat <<EOF > $tyaml
+global:
+ response_tracking: -10
+EOF
+ do_lnetctl import < $tyaml &&
+ error "should have failed $?"
+
+ echo "Check valid values; Should succeed"
+ local i
+ for ((i = 0; i < 4; i++)); do
+ reinit_dlc || return $?
+ do_lnetctl set response_tracking $i ||
+ error "should have succeeded $?"
+ $LNETCTL global show | grep -q "response_tracking: $i" ||
+ error "Failed to set response_tracking to $i"
+ reinit_dlc || return $?
+ cat <<EOF > $tyaml
+global:
+ response_tracking: $i
+EOF
+ do_lnetctl import < $tyaml ||
+ error "should have succeeded $?"
+ $LNETCTL global show | grep -q "response_tracking: $i" ||
+ error "Failed to set response_tracking to $i"
+ done
+
+ reinit_dlc || return $?
+ echo "Set > 3; Should fail"
+ do_lnetctl set response_tracking 4 &&
+ error "should have failed $?"
+
+ reinit_dlc || return $?
+ cat <<EOF > $tyaml
+global:
+ response_tracking: 10
+EOF
+ do_lnetctl import < $tyaml &&
+ error "should have failed $?"
+ return 0
+}
+run_test 104 "Set/check response_tracking param"
+
### load lnet in default namespace, configure in target namespace
test_200() {
# See lnet/lnet/lib-msg.c:lnet_health_check()
LNET_REMOTE_RESEND_STATUSES="remote_dropped"
-LNET_REMOTE_NO_RESEND_STATUSES="remote_error remote_timeout network_timeout"
+LNET_REMOTE_NO_RESEND_STATUSES="remote_error remote_timeout"
test_206() {
have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
reinit_dlc || return $?
}
run_test 207 "Check health and resends for multi-rail remote errors"
+test_208_load_and_check_lnet() {
+ local ip2nets="$1"
+ local p_nid="$2"
+ local s_nid="$3"
+ local num_expected=1
+
+ load_lnet "networks=\"\" ip2nets=\"${ip2nets_str}\""
+
+ $LCTL net up ||
+ error "Failed to load LNet with ip2nets \"${ip2nets_str}\""
+
+ [[ -n $s_nid ]] &&
+ num_expected=2
+
+ declare -a nids
+ nids=( $($LCTL list_nids) )
+
+ [[ ${#nids[@]} -ne ${num_expected} ]] &&
+ error "Expect ${num_expected} NIDs found ${#nids[@]}"
+
+ [[ ${nids[0]} == ${p_nid} ]] ||
+ error "Expect NID \"${p_nid}\" found \"${nids[0]}\""
+
+ [[ -n $s_nid ]] && [[ ${nids[1]} != ${s_nid} ]] &&
+ error "Expect second NID \"${s_nid}\" found \"${nids[1]}\""
+
+ $LCTL net down &>/dev/null
+ cleanup_lnet
+}
+
+test_208() {
+ have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
+
+ cleanup_netns || error "Failed to cleanup netns before test execution"
+ cleanup_lnet || error "Failed to unload modules before test execution"
+ setup_fakeif || error "Failed to add fake IF"
+
+ have_interface "$FAKE_IF" ||
+ error "Expect $FAKE_IF configured but not found"
+
+ local eth0_ip=$(ip --oneline addr show dev eth0 |
+ awk '/inet /{print $4}' |
+ sed 's:/.*::')
+ local ip2nets_str="tcp(eth0) $eth0_ip"
+
+ echo "Configure single NID \"$ip2nets_str\""
+ test_208_load_and_check_lnet "${ip2nets_str}" "${eth0_ip}@tcp"
+
+ ip2nets_str="tcp(eth0) $eth0_ip; tcp1($FAKE_IF) $FAKE_IP"
+ echo "Configure two NIDs; two NETs \"$ip2nets_str\""
+ test_208_load_and_check_lnet "${ip2nets_str}" "${eth0_ip}@tcp" \
+ "${FAKE_IP}@tcp1"
+
+ ip2nets_str="tcp(eth0) $eth0_ip; tcp($FAKE_IF) $FAKE_IP"
+ echo "Configure two NIDs; one NET \"$ip2nets_str\""
+ test_208_load_and_check_lnet "${ip2nets_str}" "${eth0_ip}@tcp" \
+ "${FAKE_IP}@tcp"
+ local addr1=( ${eth0_ip//./ } )
+ local addr2=( ${FAKE_IP//./ } )
+ local range="[${addr1[0]},${addr2[0]}]"
+
+ local i
+ for i in $(seq 1 3); do
+ range+=".[${addr1[$i]},${addr2[$i]}]"
+ done
+ ip2nets_str="tcp(eth0,${FAKE_IF}) ${range}"
+
+ echo "Configured two NIDs; one NET alt syntax \"$ip2nets_str\""
+ test_208_load_and_check_lnet "${ip2nets_str}" "${eth0_ip}@tcp" \
+ "${FAKE_IP}@tcp"
+
+ cleanup_fakeif
+
+ echo "alt syntax with missing IF \"$ip2nets_str\""
+ load_lnet "networks=\"\" ip2nets=\"${ip2nets_str}\""
+
+ echo "$LCTL net up should fail"
+ $LCTL net up &&
+ error "LNet bringup should have failed"
+
+ cleanup_lnet
+}
+run_test 208 "Test various kernel ip2nets configurations"
+
+test_209() {
+ have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
+
+ reinit_dlc || return $?
+ add_net "tcp" "eth0" || return $?
+
+ do_lnetctl discover $($LCTL list_nids | head -n 1) ||
+ error "failed to discover myself"
+
+ echo "Simulate network_timeout w/SR config"
+ lnet_health_pre
+
+ $LCTL net_drop_add -s *@tcp -d *@tcp -m GET -r 1 -e network_timeout
+ do_lnetctl discover $($LCTL list_nids | head -n 1) &&
+ error "Should have failed"
+ $LCTL net_drop_del -a
+
+ lnet_health_post
+
+ check_no_resends || return $?
+ check_no_local_health || return $?
+ check_no_remote_health || return $?
+
+ reinit_dlc || return $?
+ add_net "tcp" "eth0" || return $?
+ add_net "tcp1" "eth0" || return $?
+
+ do_lnetctl discover $($LCTL list_nids | head -n 1) ||
+ error "failed to discover myself"
+
+ echo "Simulate network_timeout w/MR config"
+ lnet_health_pre
+
+ $LCTL net_drop_add -s *@tcp -d *@tcp -m GET -r 1 -e network_timeout
+ $LCTL net_drop_add -s *@tcp1 -d *@tcp1 -m GET -r 1 -e network_timeout
+ do_lnetctl discover $($LCTL list_nids | head -n 1) &&
+ error "Should have failed"
+ $LCTL net_drop_del -a
+
+ lnet_health_post
+
+ check_no_resends || return $?
+ check_local_health || return $?
+ check_remote_health || return $?
+
+ return 0
+}
+run_test 209 "Check health, but not resends, for network timeout"
+
test_300() {
# LU-13274
local header