Whamcloud - gitweb
LU-12597 tests: remove comma_list for MDTs part 3 26/57326/4
authorAndreas Dilger <adilger@whamcloud.com>
Wed, 9 Oct 2024 21:48:06 +0000 (15:48 -0600)
committerOleg Drokin <green@whamcloud.com>
Sun, 2 Feb 2025 06:27:22 +0000 (06:27 +0000)
Most places that use $(mdts_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: I33509872350987564ca560ad93fdaba0443ebbe5
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57326
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/sanity-krb5.sh
lustre/tests/sanity-lnet.sh
lustre/tests/sanity-lsnapshot.sh

index f92ee45..bd313d5 100755 (executable)
@@ -302,6 +302,7 @@ test_5() {
        local file2=$DIR/$tdir/$tfile-2
        local file3=$DIR/$tdir/$tfile-3
        local wait_time=$((TIMEOUT + TIMEOUT / 2))
+       local mdts=$(mdts_nodes)
 
        mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
        chmod 0777 $DIR/$tdir || error "chmod $DIR/$tdir failed"
@@ -314,9 +315,9 @@ test_5() {
        $RUNAS $LFS flushctx $MOUNT || error "can't flush context (1)"
 
        # stop lsvcgssd
-       send_sigint $(comma_list $(mdts_nodes)) $LSVCGSSD
+       send_sigint $mdts $LSVCGSSD
        sleep 5
-       check_gss_daemon_nodes $(comma_list $(mdts_nodes)) $LSVCGSSD &&
+       check_gss_daemon_nodes $mdts $LSVCGSSD &&
                error "$LSVCGSSD still running (1)"
 
        # daemon should restart automatically, at least on newer servers
@@ -335,16 +336,16 @@ test_5() {
        fi
 
        # stop lsvcgssd
-       send_sigint $(comma_list $(mdts_nodes)) $LSVCGSSD
+       send_sigint $mdts $LSVCGSSD
        sleep 5
-       check_gss_daemon_nodes $(comma_list $(mdts_nodes)) $LSVCGSSD &&
+       check_gss_daemon_nodes $mdts $LSVCGSSD &&
                error "$LSVCGSSD still running (2)"
 
        # restart lsvcgssd, expect touch succeed
        echo "restart $LSVCGSSD and recovering"
-       start_gss_daemons $(comma_list $(mdts_nodes)) $LSVCGSSD "-vvv"
+       start_gss_daemons $mdts $LSVCGSSD "-vvv"
        sleep 5
-       check_gss_daemon_nodes $(comma_list $(mdts_nodes)) $LSVCGSSD
+       check_gss_daemon_nodes $mdts $LSVCGSSD
        $RUNAS touch $file3 || error "should not fail now"
        [ -f $file3 ] || error "$file3 not found"
 }
index 0990236..36217cd 100755 (executable)
@@ -1236,7 +1236,7 @@ init_router_test_vars() {
        local rnodes_required
        ((rnodes_required=routers_required+rpeers_required))
        # all remote nodes, including some that may not be used
-       local rnodes_all=( $(remote_nodes_list) )
+       local rnodes_all=( $(remote_nodes_list | tr ',' ' ') )
        [[ -z $rnodes_all || "${#rnodes_all[@]}" -lt $rnodes_required ]] &&
                skip "Need at least $rnodes_required remote nodes" \
                        "found \"${rnodes_all[@]}\""
@@ -2033,7 +2033,7 @@ setup_health_test() {
 
        LNIDS=( $($LCTL list_nids | xargs echo) )
 
-       RNODE=$(awk '{print $1}' <<<$rnodes)
+       RNODE=(${rnodes//,/ })
        RNIDS=( $(do_node $RNODE $LCTL list_nids | xargs echo) )
 
        if [[ -z ${RNIDS[@]} ]]; then
@@ -2691,7 +2691,7 @@ test_212() {
        [[ -z $my_nid ]] &&
                error "Failed to get primary NID for local host $HOSTNAME"
 
-       local rnode=$(awk '{print $1}' <<<$rnodes)
+       local rnode=(${rnodes//,/ })
        local rnodenids=$(do_node $rnode $LCTL list_nids | xargs echo)
        local rloaded=false
 
index 8aa21c1..b05d45c 100755 (executable)
@@ -28,7 +28,7 @@ require_dsh_ost || exit 0
 check_and_setup_lustre
 
 do_facet mgs $LCTL set_param debug=+snapshot
-do_nodes $(comma_list $(mdts_nodes)) $LCTL set_param debug=+snapshot
+do_nodes $(mdts_nodes) "$LCTL set_param debug=+snapshot"
 
 lss_gen_conf
 lss_cleanup
@@ -374,7 +374,7 @@ run_test 4 "create/delete snapshot after MGS remount"
 
 lss_cleanup
 do_facet mgs $LCTL set_param debug=-snapshot
-do_nodes $(comma_list $(mdts_nodes)) $LCTL set_param debug=-snapshot
+do_nodes $(mdts_nodes) "$LCTL set_param debug=-snapshot"
 complete_test $SECONDS
 check_and_cleanup_lustre
 exit_status