Whamcloud - gitweb
LU-14707 tests: Bashify scripts for Ubuntu et. al.
[fs/lustre-release.git] / lustre / tests / functions.sh
index 9a27e27..1807bb8 100644 (file)
@@ -169,26 +169,26 @@ signaled() {
 }
 
 mpi_run () {
-    local mpirun="$MPIRUN $MPIRUN_OPTIONS --oversubscribe"
-    local command="$mpirun $@"
-    local mpilog=$TMP/mpi.log
-    local rc
-
-    if [ -n "$MPI_USER" -a "$MPI_USER" != root -a -n "$mpirun" ]; then
-        echo "+ chmod 0777 $MOUNT"
-        chmod 0777 $MOUNT
-        command="su $MPI_USER sh -c \"$command \""
-    fi
+       local mpirun="$MPIRUN $MPIRUN_OPTIONS"
+       local command="$mpirun $@"
+       local mpilog=$TMP/mpi.log
+       local rc
+
+       if [ -n "$MPI_USER" -a "$MPI_USER" != root -a -n "$mpirun" ]; then
+               echo "+ chmod 0777 $MOUNT"
+               chmod 0777 $MOUNT
+               command="su $MPI_USER bash -c \"$command \""
+       fi
 
-    ls -ald $MOUNT
-    echo "+ $command"
-    eval $command 2>&1 | tee $mpilog || true
+       ls -ald $MOUNT
+       echo "+ $command"
+       eval $command 2>&1 | tee $mpilog || true
 
-    rc=${PIPESTATUS[0]}
-    if [ $rc -eq 0 ] && grep -q "p4_error:" $mpilog ; then
-       rc=1
-    fi
-    return $rc
+       rc=${PIPESTATUS[0]}
+       if [ $rc -eq 0 ] && grep -q "p4_error:" $mpilog ; then
+               rc=1
+       fi
+       return $rc
 }
 
 nids_list () {
@@ -611,6 +611,7 @@ run_ior() {
        ior_xferSize=${ior_xferSize:-1M}
        ior_type=${ior_type:-POSIX}
        ior_DURATION=${ior_DURATION:-30}        # minutes
+       ior_CLEANUP=${ior_CLEANUP:-true}
        local multiplier=1
        case ${ior_blockUnit} in
                [G])
@@ -692,7 +693,7 @@ run_ior() {
     if [ $rc != 0 ] ; then
         error "ior failed! $rc"
     fi
-    rm -rf $testdir
+    $ior_CLEANUP && rm -rf $testdir || true
 }
 
 run_mib() {
@@ -1041,7 +1042,7 @@ run_rr_alloc() {
        # Save mdt values, set threshold to 100% i.e always Round Robin,
        # restore the saved values again after creating files...
        save_lustre_params mds1 \
-               "lov.$FSNAME-MDT0000*.qos_threshold_rr" > $qos_prec_objs
+               "lod.$FSNAME-MDT0000*.qos_threshold_rr" > $qos_prec_objs
        save_lustre_params mds1 \
                "osp.$FSNAME-OST*-osc-MDT0000.create_count" >> $qos_prec_objs
 
@@ -1057,10 +1058,17 @@ run_rr_alloc() {
 
        foeo_calc=$((rr_alloc_NFILES * total_MNTPTS / OSTCOUNT))
        local create_count=$((2 * foeo_calc))
-       do_facet mds1 "$LCTL set_param -n \
-               lov.$FSNAME-MDT0000*.qos_threshold_rr 100 \
-               osp.$FSNAME-OST*-osc-MDT0000.create_count $create_count" ||
-               error "failed while setting qos_threshold_rr & creat_count"
+
+       # create_count accepted values:
+       #   [OST_MIN_PRECREATE=32, OST_MAX_PRECREATE=20000]
+       # values exceeding OST_MAX_PRECREATE are lowered to the maximum.
+       [[ $create_count -lt 32 ]] && create_count=32
+       local i
+       for i in $(seq $MDSCOUNT); do
+               do_facet mds$i "$LCTL set_param -n \
+                       lod.$FSNAME-MDT*.qos_threshold_rr=100 \
+                       osp.$FSNAME-OST*-osc-MDT*.create_count=$create_count"
+       done
 
        # Create few temporary files in order to increase the precreated objects
        # to a desired value, before starting 'rr_alloc' app. Due to default