Whamcloud - gitweb
LU-13445 tests: enhance ha.sh to support different users 01/38201/2
authorElena Gryaznova <elena.gryaznova@hpe.com>
Fri, 10 Apr 2020 13:38:53 +0000 (16:38 +0300)
committerOleg Drokin <green@whamcloud.com>
Sun, 19 Apr 2020 08:45:44 +0000 (08:45 +0000)
Patch adds the ability to run mpi workloads from different users.
The list of users is configured by parameter ha_mpi_users, default
is "mpiuser". Useful for Quota Pools testing.

Test-Parameters: trivial
Cray-bug-id: LUS-8603
Signed-off-by: Elena Gryaznova <elena.gryaznova@hpe.com>
Reviewed-by: Sergey Cheremencev <c17829@cray.com>
Reviewed-by: Vladimir Saveliev <c17830@cray.com>
Change-Id: I848e5eda4e8221ad0edde62f05d5c367d2156966
Reviewed-on: https://review.whamcloud.com/38201
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Sergey Cheremencev <sergey.cheremencev@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/ha.sh

index 347e3f3..13af59f 100755 (executable)
@@ -82,6 +82,9 @@
 #   The number of clients run MPI loads is configured by parameter
 #   ha_mpi_instances. Only one client runs MPI workloads by default.
 #
+#   MPI workloads can be run from several users. The list of users to use is
+#   configured by parameter ha_mpi_users, default is "mpiuser".
+#
 # PROCESS STRUCTURE AND IPC
 #
 #   On the node where this script is run, the processes look like this:
@@ -212,6 +215,7 @@ declare     ha_mpi_instances=${ha_mpi_instances:-1}
 
 declare     ha_mpi_loads=${ha_mpi_loads="ior simul mdtest"}
 declare -a  ha_mpi_load_tags=($ha_mpi_loads)
+declare -a  ha_mpiusers=(${ha_mpi_users="mpiuser"})
 
 declare     ha_ior_params=${IORP:-'" -b $ior_blockSize -t 2m -w -W -T 1"'}
 declare     ha_simul_params=${SIMULP:-'" -n 10"'}
@@ -415,6 +419,7 @@ ha_repeat_mpi_load()
        local parameter=$4
        local machines=$5
        local stripeparams=$6
+       local mpiuser=$7
        local tag=${ha_mpi_load_tags[$load]}
        local cmd=${ha_mpi_load_cmds[$tag]}
        local dir=$ha_test_dir/$client-$tag
@@ -443,7 +448,7 @@ ha_repeat_mpi_load()
                ha_on $client $LFS setstripe $stripeparams $dir &&
                ha_on $client $LFS getstripe $dir &&
                ha_on $client chmod a+xwr $dir &&
-               ha_on $client "su mpiuser sh -c \" $mpirun $ha_mpirun_options \
+               ha_on $client "su $mpiuser sh -c \" $mpirun $ha_mpirun_options \
                        -np $((${#ha_clients[@]} * mpi_threads_per_client )) \
                        $machines $cmd \" " &&
                        ha_on $client rm -rf "$dir";
@@ -478,6 +483,7 @@ ha_start_mpi_loads()
        local machines
        local m
        local -a mach
+       local mpiuser
 
        # ha_mpi_instances defines the number of
        # clients start mpi loads; should be <= ${#ha_clients[@]}
@@ -511,6 +517,7 @@ ha_start_mpi_loads()
 
        for ((n = 0; n < $inst; n++)); do
                client=${ha_clients[n]}
+               mpiuser=${ha_mpiusers[$((n % ${#ha_mpiusers[@]}))]}
                for ((load = 0; load < ${#ha_mpi_load_tags[@]}; load++)); do
                        tag=${ha_mpi_load_tags[$load]}
                        status=$ha_status_file_prefix-$tag-$client
@@ -525,7 +532,7 @@ ha_start_mpi_loads()
                        local stripe=${!aref}
                        local m=$(( n % ha_nclientsset))
                        machines=${mach[m]}
-                       ha_repeat_mpi_load $client $load $status "$parameter" $machines "$stripe" &
+                       ha_repeat_mpi_load $client $load $status "$parameter" $machines "$stripe" "$mpiuser" &
                                ha_status_files+=("$status")
                done
        done