From a50eaae974ee04364c9fbbb4625dd3d581a8c986 Mon Sep 17 00:00:00 2001 From: Serguei Smirnov Date: Fri, 12 Nov 2021 09:08:53 -0800 Subject: [PATCH] LU-15210 tests: fix sanity-lnet to handle duplicate IP 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 Change-Id: I70c2df5f14c88362ea5af6f06410823c56535dee Reviewed-on: https://review.whamcloud.com/45551 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/tests/sanity-lnet.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lustre/tests/sanity-lnet.sh b/lustre/tests/sanity-lnet.sh index a11e680..ce4c27a 100755 --- a/lustre/tests/sanity-lnet.sh +++ b/lustre/tests/sanity-lnet.sh @@ -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\"" -- 1.8.3.1