Whamcloud - gitweb
New tag 2.15.63
[fs/lustre-release.git] / lustre / tests / lfsck-performance.sh
index 7b3d8cd..b90ff63 100644 (file)
@@ -3,21 +3,20 @@
 set -e
 
 ONLY=${ONLY:-"$*"}
-ALWAYS_EXCEPT="$LFSCK_PERFORMANCE_EXCEPT"
-[ "$SLOW" = "no" ] && EXCEPT_SLOW=""
-# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
 
-LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
+LUSTRE=${LUSTRE:-$(dirname $0)/..}
 . $LUSTRE/tests/test-framework.sh
-init_test_env $@
-. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
+init_test_env "$@"
 init_logging
 
+ALWAYS_EXCEPT="$LFSCK_PERFORMANCE_EXCEPT"
+build_test_filter
+
 require_dsh_mds || exit 0
 require_dsh_ost || exit 0
 
 [ "$SLOW" = "no" ] &&
-       skip "skip lfsck performance test under non-SLOW mode" && exit 0
+       skip "skip lfsck performance test under non-SLOW mode"
 
 NTHREADS=${NTHREADS:-0}
 UNIT=${UNIT:-8192}
@@ -59,9 +58,8 @@ lfsck_attach() {
 
 lfsck_detach() {
        ${ECHOCMD} "${LCTL} <<-EOF
-               device lfsck-MDT0000
-               cleanup
-               detach
+               --device lfsck-MDT0000 cleanup
+               --device lfsck-MDT0000 detach
        EOF"
 }
 
@@ -69,28 +67,20 @@ lfsck_create() {
        local echodev=$(${RLCTL} dl | grep echo_client|awk '{print $1}')
        local j
 
-       ${ECHOCMD} "${LCTL} <<-EOF
-               cfg_device ${echodev}
-               test_mkdir ${tdir}
-       EOF"
+       ${ECHOCMD} "${LCTL} --device ${echodev} test_mkdir ${tdir}"
 
        for ((j = 1; j < ${threads}; j++)); do
-               ${ECHOCMD} "${LCTL} <<-EOF
-                       cfg_device ${echodev}
-                       test_mkdir ${tdir}${j}
-               EOF"
+               ${ECHOCMD} "${LCTL} --device ${echodev} test_mkdir ${tdir}${j}"
        done
 
-       ${ECHOCMD} "${LCTL} <<-EOF
-               cfg_device ${echodev}
-               --threads ${threads} 0 ${echodev} test_create \
-               -d ${tdir} -D ${threads} -b ${lbase} -c 0 -n ${usize}
-       EOF"
+       ${ECHOCMD} "${LCTL} --device ${echodev} \
+               --threads ${threads} 0 ${echodev} \
+               test_create -d${tdir} -D${threads} -b${lbase} -c0 -n${usize}"
 }
 
 lfsck_cleanup() {
        do_rpc_nodes $(facet_active_host $SINGLEMDS) unload_modules
-       formatall
+       REFORMAT="yes" cleanup_and_setup_lustre
 }
 
 lfsck_create_nfiles() {
@@ -129,13 +119,18 @@ lfsck_create_nfiles() {
        done
 }
 
-build_test_filter
+format_start_mgs () {
+       do_rpc_nodes $(facet_active_host mgs) load_modules_local
+       format_mgs
+       start mgs $(mgsdevname) $MGS_MOUNT_OPTS
+}
 
 test_0() {
        local BCOUNT=0
        local i
 
        stopall
+       combined_mgs_mds || format_start_mgs
        do_rpc_nodes $(facet_active_host $SINGLEMDS) load_modules_local
        format_mdt $(facet_number $SINGLEMDS)
 
@@ -167,17 +162,19 @@ test_0() {
                echo "lfsck_namespace speed is ${SPEED}/sec"
                stop ${SINGLEMDS} > /dev/null || error "Fail to stop MDS!"
        done
+       combined_mgs_mds || stop mgs
 }
 run_test 0 "lfsck namespace performance (routine case) without load"
 
 test_1() {
-       [ $(facet_fstype $SINGLEMDS) != ldiskfs ] &&
-               skip "not implemented for ZFS" && return
+       [ "$mds1_FSTYPE" != ldiskfs ] &&
+               skip_env "not implemented for ZFS"
 
        local BCOUNT=0
        local i
 
        stopall
+       combined_mgs_mds || format_start_mgs
        do_rpc_nodes $(facet_active_host $SINGLEMDS) load_modules_local
        format_mdt $(facet_number $SINGLEMDS)
 
@@ -220,6 +217,7 @@ test_1() {
                echo "lfsck_namespace speed is ${SPEED}/sec"
                stop ${SINGLEMDS} > /dev/null || error "Fail to stop MDS!"
        done
+       combined_mgs_mds || stop mgs
 }
 run_test 1 "lfsck namespace performance (backup/restore) without load"
 
@@ -229,6 +227,7 @@ test_2() {
        for ((i = $MINCOUNT_REPAIR; i <= $MAXCOUNT_REPAIR;
              i = $((i * FACTOR)))); do
                stopall
+               combined_mgs_mds || format_start_mgs
                do_rpc_nodes $(facet_active_host $SINGLEMDS) load_modules_local
                format_mdt $(facet_number $SINGLEMDS)
 
@@ -256,6 +255,7 @@ test_2() {
                echo "lfsck_namespace speed is ${SPEED}/sec"
                stop ${SINGLEMDS} > /dev/null || error "Fail to stop MDS!"
        done
+       combined_mgs_mds || stop mgs
 }
 run_test 2 "lfsck namespace performance (upgrade from 1.8) without load"
 
@@ -267,6 +267,7 @@ test_3() {
        local i
 
        stopall
+       combined_mgs_mds || format_start_mgs
        do_rpc_nodes $(facet_active_host $SINGLEMDS) load_modules_local
        format_mdt $(facet_number $SINGLEMDS)
 
@@ -338,6 +339,7 @@ test_3() {
        lfsck_create_nfiles ${nfiles} ${BCOUNT} ${NTHREADS} ||
                error "Fail to create files!"
        echo "+++ end to create for ${i} files set at: $(date) +++"
+       combined_mgs_mds || stop mgs
 }
 run_test 3 "lfsck namespace impact on create performance"
 
@@ -780,7 +782,7 @@ namespace_gen_one() {
        echo "Creating $count 2-striped sub-dirs under $show_dir," \
                "and 4 regular files under each striped sub-dir at: $(date)"
        for ((m = 0; m < $count; m++)); do
-               $LFS setdirstripe -i ${idx1} -c 2 -t all_char \
+               $LFS setdirstripe -i ${idx1} -c 2 -H all_char \
                        $work_dir/d_s_${m} || {
                        error_noexit \
                        "(27) Fail to make striped-dir $work_dir/d_s_${m}"
@@ -918,8 +920,7 @@ test_7c() {
 run_test 7c "namespace LFSCK performance (repairing bad FID-in-dirent) for DNE"
 
 test_8() {
-       [ $MDSCOUNT -lt 2 ] &&
-               skip "We need at least 2 MDSes for this test" && return
+       [ $MDSCOUNT -lt 2 ] && skip_env "needs >= 2 MDTs"
 
        [ $INCFACTOR -gt 25 ] && INCFACTOR=25
 
@@ -1027,5 +1028,6 @@ run_test 8 "lfsck namespace impact on create performance"
 
 # cleanup the system at last
 lfsck_cleanup
-complete $SECONDS
+complete_test $SECONDS
+check_and_cleanup_lustre
 exit_status