Whamcloud - gitweb
LU-15210 tests: fix sanity-lnet to handle duplicate IP 51/45551/5
authorSerguei Smirnov <ssmirnov@whamcloud.com>
Fri, 12 Nov 2021 17:08:53 +0000 (09:08 -0800)
committerAndreas Dilger <adilger@whamcloud.com>
Sun, 14 Nov 2021 02:56:54 +0000 (02:56 +0000)
The same IP may be added on the same interface with different netmasks
specified.
sanity-lnet is not expecting this and fails. Fix it.

Test-parameters: trivial testlist=sanity-lnet

Signed-off-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Change-Id: I70c2df5f14c88362ea5af6f06410823c56535dee
Reviewed-on: https://review.whamcloud.com/45551
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/tests/sanity-lnet.sh

index a11e680..ce4c27a 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
@@ -1613,6 +1617,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\""