Whamcloud - gitweb
LU-14992 tests: sanity/replay-vbr mkdir on MDT0 04/49404/9
authorJames Nunez <jnunez@whamcloud.com>
Mon, 13 Sep 2021 16:35:30 +0000 (10:35 -0600)
committerOleg Drokin <green@whamcloud.com>
Wed, 17 Apr 2024 05:24:06 +0000 (05:24 +0000)
Replace mkdir with mkdir_on_mdt0() for sanity test 133a
and relay-vbr test 7a.  These tests expect the newly
created directory is on MDT0.

Lustre-change: https://review.whamcloud.com/44902
Lustre-commit: f0324c5c2f4390d6d7e93ed799e95d8eef4704f4

Test-Parameters: trivial mdscount=2 mdtcount=4 testlist=sanity
Test-Parameters: env=SLOW=yes mdscount=2 mdtcount=4 testlist=replay-vbr
Signed-off-by: James Nunez <jnunez@whamcloud.com>
Change-Id: Icea2923a8d8d3a3aa0ddf0401f0a025480b2f6f0
Reviewed-by: Kevin Zhao <kevin.zhao@linaro.org>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Xinliang Liu <xinliang.liu@linaro.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49404
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/replay-vbr.sh
lustre/tests/sanity.sh

index 4c0f697..2c785c4 100755 (executable)
@@ -716,21 +716,21 @@ test_7_cycle() {
 }
 
 test_7a() {
-    first="createmany -o $DIR/$tdir/$tfile- 1"
-    lost="rm $MOUNT2/$tdir/$tfile-0"
-    last="createmany -o $DIR/$tdir/$tfile- 1"
-    test_7_cycle "$first" "$lost" "$last" || error "Test 7a.1 failed"
+       first="createmany -o $DIR/$tdir/$tfile- 1"
+       lost="rm $MOUNT2/$tdir/$tfile-0"
+       last="createmany -o $DIR/$tdir/$tfile- 1"
+       test_7_cycle "$first" "$lost" "$last" || error "Test 7a.1 failed"
 
-    first="createmany -o $DIR/$tdir/$tfile- 1"
-    lost="rm $MOUNT2/$tdir/$tfile-0"
-    last="mkdir $DIR/$tdir/$tfile-0"
-    test_7_cycle "$first" "$lost" "$last" || error "Test 7a.2 failed"
+       first="createmany -o $DIR/$tdir/$tfile- 1"
+       lost="rm $MOUNT2/$tdir/$tfile-0"
+       last="$LFS mkdir -i 0 -c 1 $DIR/$tdir/$tfile-0"
+       test_7_cycle "$first" "$lost" "$last" || error "Test 7a.2 failed"
 
-    first="mkdir $DIR/$tdir/$tfile-0"
-    lost="mv $MOUNT2/$tdir/$tfile-0 $MOUNT2/$tdir/$tfile-1"
-    last="createmany -o $DIR/$tdir/$tfile- 1"
-    test_7_cycle "$first" "$lost" "$last" || error "Test 7a.3 failed"
-    return 0
+       first="mkdir $DIR/$tdir/$tfile-0"
+       lost="mv $MOUNT2/$tdir/$tfile-0 $MOUNT2/$tdir/$tfile-1"
+       last="createmany -o $DIR/$tdir/$tfile- 1"
+       test_7_cycle "$first" "$lost" "$last" || error "Test 7a.3 failed"
+       return 0
 }
 run_test 7a "create, {lost}, create"
 
index a6f75b2..4195903 100755 (executable)
@@ -14109,21 +14109,31 @@ check_stats() {
        local want=${3:-0}
        local res
 
+       # open             11 samples [usecs] 468 4793 13658 35791898
        case $facet in
-       mds*) res=$(do_facet $facet \
-                  $LCTL get_param mdt.$FSNAME-MDT0000.md_stats | grep "$op")
+       mds*) res=($(do_facet $facet \
+                  $LCTL get_param mdt.$FSNAME-MDT0000.md_stats | grep "$op"))
                 ;;
-       ost*) res=$(do_facet $facet \
-                  $LCTL get_param obdfilter.$FSNAME-OST0000.stats | grep "$op")
+       ost*) res=($(do_facet $facet \
+                 $LCTL get_param obdfilter.$FSNAME-OST0000.stats | grep "$op"))
                 ;;
        *) error "Wrong facet '$facet'" ;;
        esac
-       [ "$res" ] || error "The counter for $op on $facet was not incremented"
-       # if the argument $3 is zero, it means any stat increment is ok.
-       if [[ $want -gt 0 ]]; then
-               local count=$(echo $res | awk '{ print $2 }')
-               [[ $count -ne $want ]] &&
+       [[ -n "$res" ]] || error "counter for $op on $facet not incremented"
+       # if $want is zero, it means any stat increment is ok.
+       if (( $want > 0 )); then
+               local count=${res[1]}
+
+               if (( $count != $want )); then
+                       if [[ $facet =~ "mds" ]]; then
+                               do_nodes $(comma_list $(mdts_nodes)) \
+                                       $LCTL get_param mdt.*.md_stats
+                       else
+                               do_nodes $(comma_list $(osts-nodes)) \
+                                       $LCTL get_param obdfilter.*.stats
+                       fi
                        error "The $op counter on $facet is $count, not $want"
+               fi
        fi
 }
 
@@ -14143,8 +14153,11 @@ test_133a() {
        do_facet ost1 $LCTL set_param obdfilter.*.stats=clear
 
        # verify mdt stats first.
-       mkdir ${testdir} || error "mkdir failed"
+       mkdir_on_mdt0 ${testdir} || error "mkdir_on_mdt0 failed"
        check_stats $SINGLEMDS "mkdir" 1
+
+       # clear "open" from "lfs mkdir" above
+       do_facet $SINGLEMDS $LCTL set_param mdt.*.md_stats=clear
        touch ${testdir}/${tfile} || error "touch failed"
        check_stats $SINGLEMDS "open" 1
        check_stats $SINGLEMDS "close" 1
@@ -14184,7 +14197,8 @@ test_133b() {
 
        local testdir=$DIR/${tdir}/stats_testdir
 
-       mkdir -p ${testdir} || error "mkdir failed"
+       mkdir -p $DIR/$tdir || error "mkdir $tdir failed"
+       mkdir_on_mdt0 ${testdir} || error "mkdir_on_mdt0 failed"
        touch ${testdir}/${tfile} || error "touch failed"
        cancel_lru_locks mdc
 
@@ -14339,12 +14353,12 @@ test_133d() {
 
        local testdir1=$DIR/${tdir}/stats_testdir1
        local testdir2=$DIR/${tdir}/stats_testdir2
-       mkdir -p $DIR/${tdir}
+       mkdir -p $DIR/${tdir} || error "mkdir $tdir failed"
 
        do_facet $SINGLEMDS $LCTL set_param mdt.*.rename_stats=clear
 
-       lfs mkdir -i 0 -c 1 ${testdir1} || error "mkdir failed"
-       lfs mkdir -i 0 -c 1 ${testdir2} || error "mkdir failed"
+       mkdir_on_mdt0 ${testdir1} || error "mkdir $testdir1 failed"
+       mkdir_on_mdt0 ${testdir2} || error "mkdir $testdir2 failed"
 
        createmany -o $testdir1/test 512 || error "createmany failed"