From f0324c5c2f4390d6d7e93ed799e95d8eef4704f4 Mon Sep 17 00:00:00 2001 From: James Nunez Date: Mon, 13 Sep 2021 10:35:30 -0600 Subject: [PATCH] LU-14992 tests: sanity/replay-vbr mkdir on MDT0 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. 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 Change-Id: Icea2923a8d8d3a3aa0ddf0401f0a025480b2f6f0 Reviewed-on: https://review.whamcloud.com/44902 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Kevin Zhao Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/tests/replay-vbr.sh | 26 +++++++++++++------------- lustre/tests/sanity.sh | 42 ++++++++++++++++++++++++++++-------------- 2 files changed, 41 insertions(+), 27 deletions(-) diff --git a/lustre/tests/replay-vbr.sh b/lustre/tests/replay-vbr.sh index 4c0f697..2c785c4 100755 --- a/lustre/tests/replay-vbr.sh +++ b/lustre/tests/replay-vbr.sh @@ -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" diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 978f3c1..5c361e1 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -14227,21 +14227,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 } @@ -14261,8 +14271,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 @@ -14302,7 +14315,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 @@ -14457,12 +14471,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" -- 1.8.3.1