Whamcloud - gitweb
LU-12597 tests: remove comma_list for OSTs part 2 85/56885/4
authorAndreas Dilger <adilger@whamcloud.com>
Sat, 9 Mar 2024 21:41:41 +0000 (14:41 -0700)
committerOleg Drokin <green@whamcloud.com>
Thu, 2 Jan 2025 20:49:52 +0000 (20:49 +0000)
Most places that use $(osts_nodes) also call $(comma_list ...) at the
same time.  Rather than returning a space-separated list of nodes from
those functions, instead return a comma-separated list suitable for
use by do_nodes() and similar functions calling pdsh internally.

This avoids the repeated calls to comma_list() and makes the tests
easier to read.  Also, since comma_list() internally deduplicates the
node list, it isn't necessary to do that in the callers.  A few tests
need to convert comma-separated osts_nodes into space-separated nodes.

Test-Parameters: trivial
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I02509872350987564ca560ad93fdaba0423ebbe5
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56885
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/recovery-scale-lib.sh
lustre/tests/recovery-small.sh
lustre/tests/replay-single.sh
lustre/tests/sanity-flr.sh
lustre/tests/sanity-lfsck.sh
lustre/tests/sanity-quota.sh
lustre/tests/test-framework.sh

index dea4680..eca8ecf 100644 (file)
@@ -97,7 +97,7 @@ summary_and_cleanup () {
 
        # stop vmstat on OSS nodes
        if [[ -n "$VMSTAT" ]]; then
-               stop_process $(comma_list $(osts_nodes)) "$VMSTAT_PID_FILE"
+               stop_process $(osts_nodes) "$VMSTAT_PID_FILE"
        fi
 
        # stop the client loads
@@ -129,7 +129,7 @@ failover_target() {
 
        # start vmstat on OSS nodes
        if [[ -n "$VMSTAT" ]]; then
-               start_vmstat $(comma_list $(osts_nodes)) "$VMSTAT_PID_FILE"
+               start_vmstat $(osts_nodes) "$VMSTAT_PID_FILE"
        fi
 
        # start client loads
index 2ef1681..9d5a551 100755 (executable)
@@ -667,8 +667,8 @@ test_18c() {
 run_test 18c "Dropped connect reply after eviction handing (14755)"
 
 test_19a() {
-       local BEFORE=`date +%s`
-       local EVICT
+       local before=$(date +%s)
+       local evict
 
        mount_client $DIR2 || error "failed to mount $DIR2"
 
@@ -684,19 +684,19 @@ test_19a() {
 
        # let the client reconnect
        client_reconnect
-       EVICT=$(do_facet client $LCTL get_param mdc.$FSNAME-MDT*.state |
+       evict=$(do_facet client $LCTL get_param mdc.$FSNAME-MDT*.state |
                awk -F"[ [,]" '/EVICTED ]$/ \
                        { if (mx<$5) {mx=$5;} } END { print mx }')
 
-       [ ! -z "$EVICT" ] && [[ $EVICT -gt $BEFORE ]] ||
+       [[ -n "$evict" ]] && (( $evict >= $before )) ||
                (do_facet client $LCTL get_param mdc.$FSNAME-MDT*.state;
-                   error "no eviction: $EVICT before:$BEFORE")
+                   error "no eviction: $evict < before: $before")
 }
 run_test 19a "test expired_lock_main on mds (2867)"
 
 test_19b() {
-       local BEFORE=`date +%s`
-       local EVICT
+       local before=$(date +%s)
+       local evict
 
        mount_client $DIR2 || error "failed to mount $DIR2: $?"
 
@@ -714,13 +714,13 @@ test_19b() {
 
        # let the client reconnect
        client_reconnect
-       EVICT=$(do_facet client $LCTL get_param osc.$FSNAME-OST*.state |
+       evict=$(do_facet client $LCTL get_param osc.$FSNAME-OST*.state |
                awk -F"[ [,]" '/EVICTED ]$/ \
                        { if (mx < $5) {mx = $5;} } END { print mx }')
 
-       [ ! -z "$EVICT" ] && [[ $EVICT -gt $BEFORE ]] ||
+       [[ -n "$evict" ]] && (( $evict >= $before )) ||
                (do_facet client $LCTL get_param osc.$FSNAME-OST*.state;
-                   error "no eviction: $EVICT before:$BEFORE")
+                   error "no eviction: $evict < before: $before")
 }
 run_test 19b "test expired_lock_main on ost (2867)"
 
@@ -1598,7 +1598,7 @@ test_66()
        [[ "$MDS1_VERSION" -ge $(version_code 2.7.51) ]] ||
                skip "Need MDS version at least 2.7.51"
 
-       local list=$(comma_list $(osts_nodes))
+       local list=$(osts_nodes)
 
        # modify dir so that next revalidate would not obtain UPDATE lock
        touch $DIR
index d0c1668..0263011 100755 (executable)
@@ -1640,6 +1640,7 @@ run_test 60 "test llog post recovery init vs llog unlink"
 #test race  llog recovery thread vs llog cleanup
 test_61a() {   # was test_61
        remote_ost_nodsh && skip "remote OST with nodsh" && return 0
+       local osts=$(osts_nodes)
 
        mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
        createmany -o $DIR/$tdir/$tfile-%d 800 ||
@@ -1647,12 +1648,12 @@ test_61a() {    # was test_61
        replay_barrier ost1
        unlinkmany $DIR/$tdir/$tfile-%d 800
        #   OBD_FAIL_OST_LLOG_RECOVERY_TIMEOUT 0x221
-       set_nodes_failloc "$(osts_nodes)" 0x80000221
+       set_nodes_failloc $osts 0x80000221
        facet_failover ost1
        sleep 10
        fail ost1
        sleep 30
-       set_nodes_failloc "$(osts_nodes)" 0x0
+       set_nodes_failloc $osts 0x0
 
        $CHECKSTAT -t file $DIR/$tdir/$tfile-* &&
                error "$CHECKSTAT $DIR/$tdir/$tfile attribute check should fail"
@@ -1675,14 +1676,15 @@ run_test 61b "test race mds llog sync vs llog cleanup"
 #test race  cancel cookie cb vs llog cleanup
 test_61c() {
        remote_ost_nodsh && skip "remote OST with nodsh" && return 0
+       local osts=$(osts_nodes)
 
        #   OBD_FAIL_OST_CANCEL_COOKIE_TIMEOUT 0x222
        touch $DIR/$tfile || error "touch $DIR/$tfile failed"
-       set_nodes_failloc "$(osts_nodes)" 0x80000222
+       set_nodes_failloc $osts 0x80000222
        rm $DIR/$tfile
        sleep 10
        fail ost1
-       set_nodes_failloc "$(osts_nodes)" 0x0
+       set_nodes_failloc $osts 0x0
 }
 run_test 61c "test race mds llog sync vs llog cleanup"
 
index aa0f815..f69bbee 100644 (file)
@@ -1073,8 +1073,7 @@ test_21() {
 
        # for zfs - sync OST dataset so that du below will return
        # accurate results
-       [ "$FSTYPE" = "zfs" ] &&
-               do_nodes $(comma_list $(osts_nodes)) "$ZPOOL sync"
+       [[ "$FSTYPE" != "zfs" ]] || do_nodes $(osts_nodes) "$ZPOOL sync"
 
        local blocks=$(du -kc $tf $tf2 | awk '/total/{print $1}')
 
@@ -1742,8 +1741,7 @@ test_37()
        # verify mirror copy, write to this mirrored file will invalidate
        # the other two mirrors
        echo "Verifying mirror copy .."
-
-       local osts=$(comma_list $(osts_nodes))
+       local osts=$(osts_nodes)
 
        $LFS mirror copy -i ${mirror_array[0]} -o-1 $tf ||
                error "mirror copy error"
@@ -4343,7 +4341,7 @@ function check_ost_used() {
 
 test_208a() {
        local tf=$DIR/$tfile
-       local osts=$(comma_list $(osts_nodes))
+       local osts=$(osts_nodes)
 
        (( $OSTCOUNT >= 4 )) || skip "needs >= 4 OSTs"
        (( $MDS1_VERSION >= $(version_code 2.14.55) )) ||
@@ -4386,7 +4384,7 @@ run_test 208a "mirror selection to prefer non-rotational devices for reads"
 
 test_208b() {
        local tf=$DIR/$tfile
-       local osts=$(comma_list $(osts_nodes))
+       local osts=$(osts_nodes)
 
        (( $OSTCOUNT >= 4 )) || skip "needs >= 4 OSTs"
        (( $MDS1_VERSION >= $(version_code 2.14.55) )) ||
@@ -4433,7 +4431,7 @@ test_209a() {
        local tf=$DIR/$tfile
        local tmpfile="$TMP/$TESTSUITE-$TESTNAME-multiop.output"
        local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
-       local osts=$(comma_list $(osts_nodes))
+       local osts=$(osts_nodes)
 
        stack_trap "rm -f $tmpfile"
 
index 18eba49..fd504f1 100755 (executable)
@@ -1172,14 +1172,11 @@ test_9a() {
                error "(6) Speed $SPEED, expected < $MAX_SPEED"
        }
 
-       do_nodes $(comma_list $(mdts_nodes)) \
-               $LCTL set_param -n mdd.*.lfsck_speed_limit 0
-       do_nodes $(comma_list $(osts_nodes)) \
-               $LCTL set_param -n obdfilter.*.lfsck_speed_limit 0
+       do_nodes $(tgts_nodes) $LCTL set_param -n *.*.lfsck_speed_limit=0
 
        wait_update_facet $SINGLEMDS \
-               "$LCTL get_param -n mdd.${MDT_DEV}.lfsck_layout |
-               awk '/^status/ { print \\\$2 }'" "completed" 30 ||
+                         "$LCTL get_param -n mdd.${MDT_DEV}.lfsck_layout |
+                         awk '/^status/ { print \\\$2 }'" "completed" ||
                error "(7) Failed to get expected 'completed'"
 }
 run_test 9a "LFSCK speed control (1)"
@@ -1270,13 +1267,10 @@ test_9b() {
                error "(10) Speed $SPEED, expected < $MAX_SPEED"
        }
 
-       do_nodes $(comma_list $(mdts_nodes)) \
-               $LCTL set_param -n mdd.*.lfsck_speed_limit 0
-       do_nodes $(comma_list $(osts_nodes)) \
-               $LCTL set_param -n obdfilter.*.lfsck_speed_limit 0
+       do_nodes $(tgts_nodes) "$LCTL set_param -n *.*.lfsck_speed_limit=0"
        wait_update_facet $SINGLEMDS "$LCTL get_param -n \
-               mdd.${MDT_DEV}.lfsck_namespace |
-               awk '/^status/ { print \\\$2 }'" "completed" 32 || {
+                         mdd.${MDT_DEV}.lfsck_namespace |
+                         awk '/^status/ { print \\\$2 }'" "completed" || {
                $SHOW_NAMESPACE
                error "(11) unexpected status"
        }
@@ -1344,13 +1338,10 @@ test_10()
        [ "$STATUS" == "scanning-phase1" ] ||
                error "(15) Expect 'scanning-phase1', but got '$STATUS'"
 
-       do_nodes $(comma_list $(mdts_nodes)) \
-               $LCTL set_param -n mdd.*.lfsck_speed_limit 0
-       do_nodes $(comma_list $(osts_nodes)) \
-               $LCTL set_param -n obdfilter.*.lfsck_speed_limit 0
-       wait_update_facet $SINGLEMDS "$LCTL get_param -n \
-               mdd.${MDT_DEV}.lfsck_namespace |
-               awk '/^status/ { print \\\$2 }'" "completed" 32 || {
+       do_nodes $(tgts_nodes) "$LCTL set_param -n *.*.lfsck_speed_limit=0"
+       wait_update_facet $SINGLEMDS \
+                         "$LCTL get_param -n mdd.${MDT_DEV}.lfsck_namespace |
+                         awk '/^status/ { print \\\$2 }'" "completed" || {
                $SHOW_NAMESPACE
                error "(16) unexpected status"
        }
@@ -1808,6 +1799,7 @@ run_test 14b "LFSCK can repair MDT-object with dangling LOV EA reference (2)"
 test_15a() {
        (( $MDS1_VERSION > $(version_code 2.5.55) )) ||
                skip "MDS older than 2.5.55, LU-3591"
+       local osts=$(osts_nodes)
 
        echo "#####"
        echo "If the OST-object referenced by the MDT-object back points"
@@ -1822,7 +1814,7 @@ test_15a() {
        echo "non-exist MDT-object."
        #define OBD_FAIL_LFSCK_UNMATCHED_PAIR1  0x1611
 
-       do_nodes $(comma_list $(osts_nodes)) $LCTL set_param fail_loc=0x1611
+       do_nodes $osts "$LCTL set_param fail_loc=0x1611"
        dd if=/dev/zero of=$DIR/$tdir/f0 bs=1M count=1
        $LFS setstripe -E 1M -S 256K -c 1 -E -1 -S 512K -c $OSTCOUNT \
                $DIR/$tdir/f1 ||
@@ -1833,14 +1825,14 @@ test_15a() {
        # its layout information will be set also.
        dd if=/dev/zero of=$DIR/$tdir/f1 bs=4K count=257
        cancel_lru_locks osc
-       do_nodes $(comma_list $(osts_nodes)) $LCTL set_param fail_loc=0
+       do_nodes $osts "$LCTL set_param fail_loc=0"
 
        echo "Trigger layout LFSCK to find out unmatched pairs and fix them"
        $START_LAYOUT -r || error "(1) Fail to start LFSCK for layout!"
 
-       wait_update_facet $SINGLEMDS "$LCTL get_param -n \
-               mdd.${MDT_DEV}.lfsck_layout |
-               awk '/^status/ { print \\\$2 }'" "completed" 32 || {
+       wait_update_facet $SINGLEMDS \
+                         "$LCTL get_param -n mdd.${MDT_DEV}.lfsck_layout |
+                         awk '/^status/ { print \\\$2 }'" "completed" || {
                $SHOW_LAYOUT
                error "(2) unexpected status"
        }
@@ -1874,23 +1866,24 @@ test_15b() {
 
        local stripes=1
        [ $OSTCOUNT -ge 2 ] && stripes=2
+       local osts=$(osts_nodes)
 
        #define OBD_FAIL_LFSCK_UNMATCHED_PAIR2  0x1612
-       do_nodes $(comma_list $(osts_nodes)) $LCTL set_param fail_loc=0x1612
+       do_nodes $osts "$LCTL set_param fail_loc=0x1612"
        dd if=/dev/zero of=$DIR/$tdir/0/f0 bs=1M count=1
        $LFS setstripe -E 1M -S 256K -c $stripes -E 2M -S 512K -c 1 \
                $DIR/$tdir/f1 ||
                error "(0) Fail to create PFL $DIR/$tdir/f1"
        dd if=/dev/zero of=$DIR/$tdir/f1 bs=1M count=2
        cancel_lru_locks osc
-       do_nodes $(comma_list $(osts_nodes)) $LCTL set_param fail_loc=0
+       do_nodes $osts "$LCTL set_param fail_loc=0"
 
        echo "Trigger layout LFSCK to find out unmatched pairs and fix them"
        $START_LAYOUT -r || error "(1) Fail to start LFSCK for layout!"
 
-       wait_update_facet $SINGLEMDS "$LCTL get_param -n \
-               mdd.${MDT_DEV}.lfsck_layout |
-               awk '/^status/ { print \\\$2 }'" "completed" 32 || {
+       wait_update_facet $SINGLEMDS \
+                         "$LCTL get_param -n mdd.${MDT_DEV}.lfsck_layout |
+                         awk '/^status/ { print \\\$2 }'" "completed" || {
                $SHOW_LAYOUT
                error "(2) unexpected status"
        }
@@ -2439,10 +2432,11 @@ test_18c() {
        check_mount_and_prep
        $LFS mkdir -i 0 $DIR/$tdir/a1
        $LFS setstripe -c 1 -i 0 $DIR/$tdir/a1
+       local osts=$(osts_nodes)
 
        echo "Inject failure, to simulate the case of missing parent FID"
        #define OBD_FAIL_LFSCK_NOPFID           0x1617
-       do_nodes $(comma_list $(osts_nodes)) $LCTL set_param fail_loc=0x1617
+       do_nodes $osts "$LCTL set_param fail_loc=0x1617"
 
        dd if=/dev/zero of=$DIR/$tdir/a1/f1 bs=1M count=2
        $LFS getstripe $DIR/$tdir/a1/f1
@@ -2461,7 +2455,7 @@ test_18c() {
        $LFS getstripe $DIR/$tdir/f3
 
        cancel_lru_locks osc
-       do_nodes $(comma_list $(osts_nodes)) $LCTL set_param fail_loc=0
+       do_nodes $osts "$LCTL set_param fail_loc=0"
 
        echo "Inject failure, to simulate the case of missing the MDT-object"
        #define OBD_FAIL_LFSCK_LOST_MDTOBJ      0x1616
@@ -3097,9 +3091,10 @@ test_19a() {
 
        check_mount_and_prep
        $LFS setstripe -c 1 -i 0 $DIR/$tdir
+       local osts=$(osts_nodes)
 
-       do_nodes $(comma_list $(osts_nodes)) $LCTL set_param -n \
-               obdfilter.${FSNAME}-OST0000.lfsck_verify_pfid 0
+       do_nodes $osts $LCTL set_param -n \
+               obdfilter.${FSNAME}-OST0000.lfsck_verify_pfid=0
 
        echo "foo1" > $DIR/$tdir/a0
        $LFS setstripe -E 512K -S 512K -o 0 -E -1 -S 1M $DIR/$tdir/a1 ||
@@ -3109,8 +3104,8 @@ test_19a() {
        cancel_lru_locks osc
 
        echo "Inject failure, then client will offer wrong parent FID when read"
-       do_nodes $(comma_list $(osts_nodes)) $LCTL set_param -n \
-               obdfilter.${FSNAME}-OST0000.lfsck_verify_pfid 1
+       do_nodes $osts $LCTL set_param -n \
+               obdfilter.${FSNAME}-OST0000.lfsck_verify_pfid=1
 
        #define OBD_FAIL_LFSCK_INVALID_PFID     0x1619
        $LCTL set_param fail_loc=0x1619
@@ -3131,21 +3126,22 @@ test_19b() {
 
        echo "Inject failure stub to make the OST-object to back point to"
        echo "non-exist MDT-object"
+       local osts=$(osts_nodes)
 
-       do_nodes $(comma_list $(osts_nodes)) $LCTL set_param -n \
-               obdfilter.${FSNAME}-OST0000.lfsck_verify_pfid 0
+       do_nodes $osts $LCTL set_param -n \
+               obdfilter.${FSNAME}-OST0000.lfsck_verify_pfid=0
 
        #define OBD_FAIL_LFSCK_UNMATCHED_PAIR1  0x1611
-       do_nodes $(comma_list $(osts_nodes)) $LCTL set_param fail_loc=0x1611
+       do_nodes $osts "$LCTL set_param fail_loc=0x1611"
        echo "foo1" > $DIR/$tdir/f0
        $LFS setstripe -E 1M -S 1M -o 0 -E 4M -S 256K $DIR/$tdir/f1 ||
                error "(0) Fail to create PFL $DIR/$tdir/f1"
        echo "foo2" > $DIR/$tdir/f1
        cancel_lru_locks osc
-       do_nodes $(comma_list $(osts_nodes)) $LCTL set_param fail_loc=0
+       do_nodes $osts "$LCTL set_param fail_loc=0"
 
        do_facet ost1 $LCTL set_param -n \
-               obdfilter.${FSNAME}-OST0000.lfsck_verify_pfid 0
+               obdfilter.${FSNAME}-OST0000.lfsck_verify_pfid=0
        echo "Nothing should be fixed since self detect and repair is disabled"
        local repaired=$(do_facet ost1 $LCTL get_param -n \
                        obdfilter.${FSNAME}-OST0000.lfsck_verify_pfid |
@@ -3156,8 +3152,8 @@ test_19b() {
        echo "Read RPC with right parent FID should be accepted,"
        echo "and cause parent FID on OST to be fixed"
 
-       do_nodes $(comma_list $(osts_nodes)) $LCTL set_param -n \
-               obdfilter.${FSNAME}-OST0000.lfsck_verify_pfid 1
+       do_nodes $osts $LCTL set_param -n \
+               obdfilter.${FSNAME}-OST0000.lfsck_verify_pfid=1
 
        cat $DIR/$tdir/f0 || error "(2.1) Read f0 should not be denied!"
        cat $DIR/$tdir/f1 || error "(2.2) Read f1 should not be denied!"
@@ -3165,7 +3161,7 @@ test_19b() {
        repaired=$(do_facet ost1 $LCTL get_param -n \
                obdfilter.${FSNAME}-OST0000.lfsck_verify_pfid |
                awk '/^repaired/ { print $2 }')
-       [ $repaired -eq 2 ] ||
+       (( $repaired == 2 )) ||
                error "(3) Expected 1 repaired, but got $repaired"
 }
 run_test 19b "OST-object inconsistency self repair"
index 41fc236..f0661f9 100755 (executable)
@@ -82,15 +82,15 @@ lustre_fail() {
        local fail_node=$1
        local fail_loc=$2
        local fail_val=${3:-0}
-       local NODES=
+       local nodes=
 
        case $fail_node in
-       mds_ost|mdt_ost) NODES="$(comma_list $(mdts_nodes) $(osts_nodes))";;
-       mds|mdt) NODES="$(comma_list $(mdts_nodes))";;
-       ost) NODES="$(comma_list $(osts_nodes))";;
+       mds_ost|mdt_ost|mds_oss) nodes="$(tgts_nodes)";;
+       mds|mdt) nodes="$(comma_list $(mdts_nodes))";;
+       ost) nodes="$(osts_nodes)";;
        esac
 
-       do_nodes $NODES "lctl set_param fail_val=$fail_val fail_loc=$fail_loc"
+       do_nodes $nodes "lctl set_param fail_val=$fail_val fail_loc=$fail_loc"
 }
 
 RUNAS="runas -u $TSTID -g $TSTID"
index dd31a11..3da6e6d 100755 (executable)
@@ -3589,8 +3589,7 @@ sync_all_data_mdts() {
 }
 
 sync_all_data_osts() {
-       do_nodes $(comma_list $(osts_nodes)) \
-           "lctl set_param -n osd*.*OS*.force_sync=1" 2>&1 |
+       do_nodes $(osts_nodes) "lctl set_param -n osd*.*OS*.force_sync=1" 2>&1 |
                grep -v 'Found no match'
 }