Whamcloud - gitweb
LU-14971 test: align mirror_io resync implementation
[fs/lustre-release.git] / lustre / tests / sanity-lnet.sh
index a11e680..f64fcec 100755 (executable)
@@ -255,11 +255,15 @@ if [[ -z ${NIDS[@]} ]]; then
        error "No NID configured after module load"
 fi
 
+do_lnetctl net show
+ip a
+
 declare -a INTERFACES
 for ((i = 0; i < ${#NIDS[@]}; i++)); do
        ip=$(sed 's/^\(.*\)@.*$/\1/'<<<${NIDS[i]})
        INTERFACES[i]=$(ip -o a s |
                        awk '$4 ~ /^'$ip'\//{print $2}')
+       INTERFACES=($(echo "${INTERFACES[@]}" | tr ' ' '\n' | uniq | tr '\n' ' '))
        if [[ -z ${INTERFACES[i]} ]]; then
                error "Can't determine interface name for NID ${NIDS[i]}"
        elif [[ 1 -ne $(wc -w <<<${INTERFACES[i]}) ]]; then
@@ -1254,7 +1258,29 @@ EOF
 }
 run_test 104 "Set/check response_tracking param"
 
-### load lnet in default namespace, configure in target namespace
+test_105() {
+       reinit_dlc || return $?
+       add_net "tcp" "${INTERFACES[0]}"
+       do_lnetctl route add --net tcp105 --gateway 105.105.105.105@tcp ||
+               error "route add failed $?"
+       do_lnetctl peer add --prim 105.105.105.105@tcp &&
+               error "peer add should fail"
+
+       return 0
+}
+run_test 105 "Adding duplicate GW peer should fail"
+
+test_106() {
+       reinit_dlc || return $?
+       add_net "tcp" "${INTERFACES[0]}"
+       do_lnetctl route add --net tcp106 --gateway 106.106.106.106@tcp ||
+               error "route add failed $?"
+       do_lnetctl peer del --prim 106.106.106.106@tcp &&
+               error "peer del should fail"
+
+       return 0
+}
+run_test 106 "Deleting GW peer should fail"
 
 test_200() {
        cleanup_lnet || exit 1
@@ -1613,6 +1639,7 @@ test_208() {
        local if0_ip=$(ip --oneline addr show dev ${INTERFACES[0]} |
                       awk '/inet /{print $4}' |
                       sed 's:/.*::')
+       if0_ip=($(echo "${if0_ip[@]}" | tr ' ' '\n' | uniq | tr '\n' ' '))
        local ip2nets_str="tcp(${INTERFACES[0]}) $if0_ip"
 
        echo "Configure single NID \"$ip2nets_str\""
@@ -2061,6 +2088,7 @@ test_230() {
                lnid="$(lctl list_nids | head -n 1)"
                do_lnetctl ping "$lnid" ||
                        error "failed to ping myself"
+
                # "lctl --net tcp conn_list" prints the list of active
                # connections. Since we're pinging ourselves, there should be
                # 2 Control connections plus 2*conns_per_peer connections
@@ -2094,6 +2122,15 @@ test_230() {
 }
 run_test 230 "Test setting conns-per-peer"
 
+### Test that linux route is added for each ni
+test_250() {
+       have_interface "eth0" || skip "Need eth0 interface with ipv4 configured"
+       reinit_dlc || return $?
+       add_net "tcp" "eth0" || return $?
+       ip route show table eth0 | grep -q "eth0"
+}
+run_test 250 "test that linux routes are added"
+
 test_300() {
        # LU-13274
        local header