From f8e56a25cfc3e1f5af52e616bac950a5fb90ea40 Mon Sep 17 00:00:00 2001 From: Xinliang Liu Date: Fri, 7 Jan 2022 02:41:00 +0000 Subject: [PATCH] LU-15412 tests: Let init_clients_lists() export client vars init_clients_lists() counts the value of client related variables correctly. So let it define and export these variables. This patch can fix sanity test 807 stuck issue when running on multi-node Lustre cluster and CLIENTS is empty. Also cleanup client count checking. Now CLIENTS is always set. Change-Id: I9a5d4b9bde401e14e1d7f6f88b04c8d1c6aea11a Signed-off-by: Xinliang Liu Reviewed-on: https://review.whamcloud.com/45994 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Arshad Hussain Reviewed-by: Oleg Drokin --- lustre/tests/cfg/local.sh | 1 - lustre/tests/cfg/ncli.sh | 2 -- lustre/tests/large-lun.sh | 1 - lustre/tests/large-scale.sh | 1 - lustre/tests/recovery-double-scale.sh | 2 +- lustre/tests/recovery-mds-scale.sh | 2 +- lustre/tests/recovery-random-scale.sh | 2 +- lustre/tests/recovery-small.sh | 1 - lustre/tests/replay-dual.sh | 1 - lustre/tests/replay-single.sh | 4 ---- lustre/tests/replay-vbr.sh | 1 - lustre/tests/sanityn.sh | 3 --- lustre/tests/test-framework.sh | 11 +++++++---- 13 files changed, 10 insertions(+), 22 deletions(-) diff --git a/lustre/tests/cfg/local.sh b/lustre/tests/cfg/local.sh index e61bbb8..d408dec 100644 --- a/lustre/tests/cfg/local.sh +++ b/lustre/tests/cfg/local.sh @@ -6,7 +6,6 @@ mdsfailover_HOST=${mdsfailover_HOST} mgs_HOST=${mgs_HOST:-$mds_HOST} ost_HOST=${ost_HOST:-$(hostname)} ostfailover_HOST=${ostfailover_HOST} -CLIENTS="" # FILESET variable is used by sanity.sh to verify fileset # feature, tests should pass even under subdirectory namespace. FILESET=${FILESET:-""} diff --git a/lustre/tests/cfg/ncli.sh b/lustre/tests/cfg/ncli.sh index 59ee009..23c26a2 100644 --- a/lustre/tests/cfg/ncli.sh +++ b/lustre/tests/cfg/ncli.sh @@ -3,8 +3,6 @@ # For multiple clients testing, we need use the cfg/ncli.sh config file, and # only need specify the "RCLIENTS" variable. The "CLIENTS" and "CLIENTCOUNT" # variables are defined in init_clients_lists(), called from cfg/ncli.sh. -CLIENT1=${CLIENT1:-$(hostname)} -SINGLECLIENT=$CLIENT1 RCLIENTS=${RCLIENTS:-""} init_clients_lists diff --git a/lustre/tests/large-lun.sh b/lustre/tests/large-lun.sh index 153d0bb..d2e6244 100644 --- a/lustre/tests/large-lun.sh +++ b/lustre/tests/large-lun.sh @@ -265,7 +265,6 @@ test_2 () { run_test 2 "run llverfs on OST ldiskfs/zfs filesystem" test_3 () { - [ -z "$CLIENTS" ] && skip_env "CLIENTS not defined, skipping" [ -z "$MPIRUN" ] && skip_env "MIPRUN not defined, skipping" [ -z "$MDSRATE" ] && skip_env "MDSRATE not defined, skipping" [ ! -x $MDSRATE ] && skip_env "$MDSRATE not built, skipping" diff --git a/lustre/tests/large-scale.sh b/lustre/tests/large-scale.sh index 7973edb..ff913b7 100644 --- a/lustre/tests/large-scale.sh +++ b/lustre/tests/large-scale.sh @@ -17,7 +17,6 @@ build_test_filter remote_mds_nodsh && skip "remote MDS with nodsh" -[ -z "$CLIENTS" ] && skip_env "$TESTSUITE: Need two or more clients" [ $CLIENTCOUNT -lt 2 ] && skip_env "$TESTSUITE: Need 2+ clients, have only $CLIENTCOUNT" diff --git a/lustre/tests/recovery-double-scale.sh b/lustre/tests/recovery-double-scale.sh index 82dce37..6ab75f2 100644 --- a/lustre/tests/recovery-double-scale.sh +++ b/lustre/tests/recovery-double-scale.sh @@ -26,7 +26,7 @@ build_test_filter remote_mds_nodsh && skip_env "remote MDS with nodsh" remote_ost_nodsh && skip_env "remote OST with nodsh" -[ -z "$CLIENTS" -o $CLIENTCOUNT -lt 3 ] && +[$CLIENTCOUNT -lt 3 ] && skip_env "need three or more clients" if [ -z "$SHARED_DIRECTORY" ] || ! check_shared_dir $SHARED_DIRECTORY; then diff --git a/lustre/tests/recovery-mds-scale.sh b/lustre/tests/recovery-mds-scale.sh index cf1325b..34d9d51 100644 --- a/lustre/tests/recovery-mds-scale.sh +++ b/lustre/tests/recovery-mds-scale.sh @@ -23,7 +23,7 @@ build_test_filter remote_mds_nodsh && skip_env "remote MDS with nodsh" && exit 0 remote_ost_nodsh && skip_env "remote OST with nodsh" && exit 0 -[ -z "$CLIENTS" -o $CLIENTCOUNT -lt 3 ] && +[ $CLIENTCOUNT -lt 3 ] && skip_env "need three or more clients" && exit 0 if [ -z "$SHARED_DIRECTORY" ] || ! check_shared_dir $SHARED_DIRECTORY; then diff --git a/lustre/tests/recovery-random-scale.sh b/lustre/tests/recovery-random-scale.sh index c3b2d4e..f1116d6 100644 --- a/lustre/tests/recovery-random-scale.sh +++ b/lustre/tests/recovery-random-scale.sh @@ -27,7 +27,7 @@ build_test_filter remote_mds_nodsh && skip_env "remote MDS with nodsh" && exit 0 remote_ost_nodsh && skip_env "remote OST with nodsh" && exit 0 -[ -z "$CLIENTS" -o $CLIENTCOUNT -lt 3 ] && +[ $CLIENTCOUNT -lt 3 ] && skip_env "need three or more clients" && exit 0 if [ -z "$SHARED_DIRECTORY" ] || ! check_shared_dir $SHARED_DIRECTORY; then diff --git a/lustre/tests/recovery-small.sh b/lustre/tests/recovery-small.sh index dbaa788..8a0fefd 100755 --- a/lustre/tests/recovery-small.sh +++ b/lustre/tests/recovery-small.sh @@ -2793,7 +2793,6 @@ test_133() { run_test 133 "don't fail on flock resend" test_134() { - [ -z "$CLIENTS" ] && skip "Need two or more clients" && return [ $CLIENTCOUNT -lt 2 ] && { skip "Need 2+ clients, have $CLIENTCOUNT" && return; } diff --git a/lustre/tests/replay-dual.sh b/lustre/tests/replay-dual.sh index 6547a39..e6af26f 100755 --- a/lustre/tests/replay-dual.sh +++ b/lustre/tests/replay-dual.sh @@ -550,7 +550,6 @@ test_21b_sub () { } test_21b() { - [ -z "$CLIENTS" ] && skip "Need two or more clients" && return [ $CLIENTCOUNT -lt 2 ] && { skip "Need 2+ clients, have $CLIENTCOUNT" && return; } diff --git a/lustre/tests/replay-single.sh b/lustre/tests/replay-single.sh index db6eac3..a0ac037ea 100755 --- a/lustre/tests/replay-single.sh +++ b/lustre/tests/replay-single.sh @@ -2042,8 +2042,6 @@ at_cleanup # start multi-client tests test_70a () { - [ -z "$CLIENTS" ] && - { skip "Need two or more clients." && return; } [ $CLIENTCOUNT -lt 2 ] && { skip "Need two or more clients, have $CLIENTCOUNT" && return; } @@ -2406,8 +2404,6 @@ test_70f_cleanup() { test_70f() { # [ x$ost1failover_HOST = x$ost_HOST ] && # { skip "Failover host not defined" && return; } -# [ -z "$CLIENTS" ] && -# { skip "CLIENTS are not specified." && return; } # [ $CLIENTCOUNT -lt 2 ] && # { skip "Need 2 or more clients, have $CLIENTCOUNT" && return; } diff --git a/lustre/tests/replay-vbr.sh b/lustre/tests/replay-vbr.sh index 7955f4c..4c0f697 100755 --- a/lustre/tests/replay-vbr.sh +++ b/lustre/tests/replay-vbr.sh @@ -1009,7 +1009,6 @@ test_10b() { # former test_2b local post local var=${SINGLEMDS}_svc - [ -n "$CLIENTS" ] || { skip "Need two or more clients" && exit 0; } [ $CLIENTCOUNT -ge 2 ] || \ { skip "Need two or more clients, have $CLIENTCOUNT" && \ exit 0; } diff --git a/lustre/tests/sanityn.sh b/lustre/tests/sanityn.sh index 197ac87..160a234 100755 --- a/lustre/tests/sanityn.sh +++ b/lustre/tests/sanityn.sh @@ -993,7 +993,6 @@ print_jbd_stat () { test_33a() { remote_mds_nodsh && skip "remote MDS with nodsh" && return - [ -z "$CLIENTS" ] && skip "Need two or more clients, have $CLIENTS" [ $CLIENTCOUNT -lt 2 ] && skip "Need two or more clients, have $CLIENTCOUNT" @@ -1044,7 +1043,6 @@ run_test 33a "commit on sharing, cross crete/delete, 2 clients, benchmark" test_33b() { remote_mds_nodsh && skip "remote MDS with nodsh" && return - [ -n "$CLIENTS" ] || { skip "Need two or more clients" && return 0; } [ $CLIENTCOUNT -ge 2 ] || { skip "Need two or more clients, have $CLIENTCOUNT" && return 0; } @@ -1200,7 +1198,6 @@ test_33d() { run_test 33d "DNE distributed operation should trigger COS" test_33e() { - [ -n "$CLIENTS" ] || skip "Need two or more clients" [ $CLIENTCOUNT -ge 2 ] || skip "Need two or more clients, have $CLIENTCOUNT" [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 2776488..1f7c6a3 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -7203,20 +7203,23 @@ init_clients_lists () { # Sanity check: exclude the dup entries RCLIENTS=$(for i in ${rclients//,/ }; do echo $i; done | sort -u) - clients="$SINGLECLIENT $HOSTNAME $RCLIENTS" + export CLIENT1=${CLIENT1:-$HOSTNAME} + export SINGLECLIENT=$CLIENT1 + + clients="$SINGLECLIENT $HOSTNAME $RCLIENTS" # Sanity check: exclude the dup entries from CLIENTS # for those configs which has SINGLCLIENT set to local client clients=$(for i in $clients; do echo $i; done | sort -u) - CLIENTS=$(comma_list $clients) + export CLIENTS=$(comma_list $clients) local -a remoteclients=($RCLIENTS) for ((i=0; $i<${#remoteclients[@]}; i++)); do varname=CLIENT$((i + 2)) - eval $varname=${remoteclients[i]} + eval export $varname=${remoteclients[i]} done - CLIENTCOUNT=$((${#remoteclients[@]} + 1)) + export CLIENTCOUNT=$((${#remoteclients[@]} + 1)) } get_random_entry () { -- 1.8.3.1