Whamcloud - gitweb
LU-14631 quota: fix qunit sort
[fs/lustre-release.git] / lustre / tests / sanity-quota.sh
index f876f20..773c04c 100755 (executable)
@@ -524,7 +524,7 @@ test_quota_performance() {
 
 # test basic quota performance b=21696
 test_0() {
-       local MB=100 # 100M
+       local MB=100 # MB
        [ "$SLOW" = "no" ] && MB=10
 
        local free_space=$(lfs_df | grep "summary" | awk '{print $4}')
@@ -596,7 +596,7 @@ check_write_fallocate() {
 
 # test block hardlimit
 test_1a() {
-       local limit=10  # 10M
+       local limit=10 # MB
        local testfile="$DIR/$tdir/$tfile-0"
 
        setup_quota_test || error "setup quota failed with $?"
@@ -686,8 +686,8 @@ test_1a() {
 run_test 1a "Block hard limit (normal use and out of quota)"
 
 test_1b() {
-       local limit=10  # 10M
-       local global_limit=20  # 100M
+       local limit=10 # MB
+       local global_limit=20 # MB
        local testfile="$DIR/$tdir/$tfile-0"
        local qpool="qpool1"
 
@@ -795,7 +795,7 @@ test_1b() {
 run_test 1b "Quota pools: Block hard limit (normal use and out of quota)"
 
 test_1c() {
-       local global_limit=20  # 100M
+       local global_limit=20 # MB
        local testfile="$DIR/$tdir/$tfile-0"
        local qpool1="qpool1"
        local qpool2="qpool2"
@@ -857,9 +857,9 @@ test_1c() {
 run_test 1c "Quota pools: check 3 pools with hardlimit only for global"
 
 test_1d() {
-       local limit1=10  # 10M
-       local limit2=12  # 12M
-       local global_limit=20  # 100M
+       local limit1=10 # MB
+       local limit2=12 # MB
+       local global_limit=20 # MB
        local testfile="$DIR/$tdir/$tfile-0"
        local qpool1="qpool1"
        local qpool2="qpool2"
@@ -919,8 +919,8 @@ test_1d() {
 run_test 1d "Quota pools: check block hardlimit on different pools"
 
 test_1e() {
-       local limit1=10  # 10M
-       local global_limit=200  # 200M
+       local limit1=10 # MB
+       local global_limit=53000000 # MB
        local testfile="$DIR/$tdir/$tfile-0"
        local testfile2="$DIR/$tdir/$tfile-1"
        local qpool1="qpool1"
@@ -981,8 +981,8 @@ test_1e() {
 run_test 1e "Quota pools: global pool high block limit vs quota pool with small"
 
 test_1f() {
-       local global_limit=200  # 200M
-       local limit1=10  # 10M
+       local global_limit=200 # MB
+       local limit1=10 # MB
        local TESTDIR="$DIR/$tdir/"
        local testfile="$TESTDIR/$tfile-0"
        local qpool1="qpool1"
@@ -1036,8 +1036,8 @@ test_1f() {
 run_test 1f "Quota pools: correct qunit after removing/adding OST"
 
 test_1g() {
-       local limit=20  # 20M
-       local global_limit=40  # 40M
+       local limit=20 # MB
+       local global_limit=40 # MB
        local testfile="$DIR/$tdir/$tfile-0"
        local qpool="qpool1"
        local mdmb_param="osc.*.max_dirty_mb"
@@ -1099,7 +1099,7 @@ test_1g() {
 run_test 1g "Quota pools: Block hard limit with wide striping"
 
 test_1h() {
-       local limit=10  # 10M
+       local limit=10 # MB
        local testfile="$DIR/$tdir/$tfile-0"
 
        check_set_fallocate_or_skip
@@ -1345,7 +1345,7 @@ test_block_soft() {
 
 # block soft limit
 test_3a() {
-       local grace=20 # 20s
+       local grace=20 # seconds
        if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
            grace=60
        fi
@@ -1412,7 +1412,7 @@ test_3a() {
 run_test 3a "Block soft limit (start timer, timer goes off, stop timer)"
 
 test_3b() {
-       local grace=20 # 20s
+       local grace=20 # seconds
        local qpool="qpool1"
        if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
                grace=60
@@ -1511,7 +1511,7 @@ test_3b() {
 run_test 3b "Quota pools: Block soft limit (start timer, expires, stop timer)"
 
 test_3c() {
-       local grace=20 # 20s
+       local grace=20 # seconds
        local qpool="qpool1"
        local qpool2="qpool2"
        if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
@@ -1745,8 +1745,8 @@ run_test 4b "Grace time strings handling"
 
 # chown & chgrp (chown & chgrp successfully even out of block/file quota)
 test_5() {
-       local BLIMIT=10 # 10M
-       local ILIMIT=10 # 10 inodes
+       local BLIMIT=10 # MB
+       local ILIMIT=10 # inodes
 
        setup_quota_test || error "setup quota failed with $?"
        trap cleanup_quota_test EXIT
@@ -1807,7 +1807,7 @@ run_test 5 "Chown & chgrp successfully even out of block/file quota"
 
 # test dropping acquire request on master
 test_6() {
-       local LIMIT=3 # 3M
+       local LIMIT=3 # MB
 
        # Clear dmesg so watchdog is not triggered by previous
        # test output
@@ -1919,7 +1919,7 @@ run_test 6 "Test dropping acquire request on master"
 # quota reintegration (global index)
 test_7a() {
        local TESTFILE=$DIR/$tdir/$tfile
-       local LIMIT=20 # 20M
+       local LIMIT=20 # MB
 
        [ "$SLOW" = "no" ] && LIMIT=5
 
@@ -1990,7 +1990,7 @@ run_test 7a "Quota reintegration (global index)"
 
 # quota reintegration (slave index)
 test_7b() {
-       local LIMIT="100G"
+       local limit=100000 # MB
        local TESTFILE=$DIR/$tdir/$tfile
 
        setup_quota_test || error "setup quota failed with $?"
@@ -2023,7 +2023,7 @@ test_7b() {
        lustre_fail mds 0xa02
 
        set_ost_qtype $QTYPE || error "enable ost quota failed"
-       $LFS setquota -u $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $DIR ||
+       $LFS setquota -u $TSTUSR -b 0 -B ${limit}M -i 0 -I 0 $DIR ||
                error "set quota failed"
 
        # ignore the write error
@@ -2050,7 +2050,7 @@ run_test 7b "Quota reintegration (slave index)"
 
 # quota reintegration (restart mds during reintegration)
 test_7c() {
-       local LIMIT=20 # 20M
+       local LIMIT=20 # MB
        local TESTFILE=$DIR/$tdir/$tfile
 
        [ "$SLOW" = "no" ] && LIMIT=5
@@ -2103,7 +2103,7 @@ run_test 7c "Quota reintegration (restart mds during reintegration)"
 test_7d(){
        local TESTFILE=$DIR/$tdir/$tfile
        local TESTFILE1="$DIR/$tdir/$tfile"-1
-       local limit=20 #20M
+       local limit=20 # MB
 
        setup_quota_test || error "setup quota failed with $?"
        trap cleanup_quota_test EXIT
@@ -2150,7 +2150,7 @@ test_7e() {
                        skip "requires zpool with active userobj_accounting"
        }
 
-       local ilimit=$((1024 * 2)) # 2k inodes
+       local ilimit=$((1024 * 2)) # inodes
        local TESTFILE=$DIR/${tdir}-1/$tfile
 
        setup_quota_test || error "setup quota failed with $?"
@@ -2375,7 +2375,7 @@ run_test 11 "Chown/chgrp ignores quota"
 test_12a() {
        [ "$OSTCOUNT" -lt "2" ] && skip "needs >= 2 OSTs"
 
-       local blimit=22 # 22M
+       local blimit=22 # MB
        local blk_cnt=$((blimit - 5))
        local TESTFILE0="$DIR/$tdir/$tfile"-0
        local TESTFILE1="$DIR/$tdir/$tfile"-1
@@ -2386,7 +2386,7 @@ test_12a() {
        set_ost_qtype "u" || error "enable ost quota failed"
        quota_show_check b u $TSTUSR
 
-       $LFS setquota -u $TSTUSR -b 0 -B "$blimit"M -i 0 -I 0 $DIR ||
+       $LFS setquota -u $TSTUSR -b 0 -B ${blimit}M -i 0 -I 0 $DIR ||
                error "set quota failed"
 
        $LFS setstripe $TESTFILE0 -c 1 -i 0 || error "setstripe $TESTFILE0 failed"
@@ -2418,7 +2418,7 @@ run_test 12a "Block quota rebalancing"
 test_12b() {
        [ "$MDSCOUNT" -lt "2" ] && skip "needs >= 2 MDTs"
 
-       local ilimit=$((1024 * 2)) # 2k inodes
+       local ilimit=$((1024 * 2)) # inodes
        local TESTFILE0=$DIR/$tdir/$tfile
        local TESTFILE1=$DIR/${tdir}-1/$tfile
 
@@ -2611,7 +2611,7 @@ run_test 17 "DQACQ return recoverable error"
 
 test_18_sub () {
        local io_type=$1
-       local blimit="200m" # 200M
+       local blimit=200 # MB
        local TESTFILE="$DIR/$tdir/$tfile"
 
        setup_quota_test || error "setup quota failed with $?"
@@ -2619,7 +2619,7 @@ test_18_sub () {
 
        set_ost_qtype "u" || error "enable ost quota failed"
        log "User quota (limit: $blimit)"
-       $LFS setquota -u $TSTUSR -b 0 -B $blimit -i 0 -I 0 $MOUNT ||
+       $LFS setquota -u $TSTUSR -b 0 -B ${blimit}M -i 0 -I 0 $MOUNT ||
                error "set quota failed"
        quota_show_check b u $TSTUSR
 
@@ -2690,7 +2690,7 @@ test_18() {
 run_test 18 "MDS failover while writing, no watchdog triggered (b14840)"
 
 test_19() {
-       local blimit=5 # 5M
+       local blimit=5 # MB
        local TESTFILE=$DIR/$tdir/$tfile
 
        setup_quota_test || error "setup quota failed with $?"
@@ -2703,11 +2703,11 @@ test_19() {
        chown $TSTUSR.$TSTUSR $TESTFILE || error "chown $TESTFILE failed"
 
        echo "Set user quota (limit: ${blimit}M)"
-       $LFS setquota -u $TSTUSR -b 0 -B "$blimit"M -i 0 -I 0 $MOUNT ||
+       $LFS setquota -u $TSTUSR -b 0 -B ${blimit}M -i 0 -I 0 $MOUNT ||
                error "set user quota failed"
        quota_show_check b u $TSTUSR
        echo "Update quota limits"
-       $LFS setquota -u $TSTUSR -b 0 -B "$blimit"M -i 0 -I 0 $MOUNT ||
+       $LFS setquota -u $TSTUSR -b 0 -B ${blimit}M -i 0 -I 0 $MOUNT ||
                error "set group quota failed"
        quota_show_check b u $TSTUSR
 
@@ -2942,7 +2942,7 @@ test_23() {
 run_test 23 "Quota should be honored with directIO (b16125)"
 
 test_24() {
-       local blimit=5 # 5M
+       local blimit=5 # MB
        local TESTFILE="$DIR/$tdir/$tfile"
 
        setup_quota_test || error "setup quota failed with $?"
@@ -3045,7 +3045,7 @@ test_27d() {
 run_test 27d "lfs setquota should support fraction block limit"
 
 test_30() {
-       local LIMIT=4 # 4MB
+       local LIMIT=4 # MB
        local TESTFILE="$DIR/$tdir/$tfile"
        local GRACE=10
 
@@ -3083,8 +3083,8 @@ run_test 30 "Hard limit updates should not reset grace times"
 
 # basic usage tracking for user & group
 test_33() {
-       local INODES=10 # 10 files
-       local BLK_CNT=2 # of 2M each
+       local INODES=10 # files
+       local BLK_CNT=2 # MB each
        local TOTAL_BLKS=$((INODES * BLK_CNT * 1024))
 
        setup_quota_test || error "setup quota failed with $?"
@@ -3168,7 +3168,7 @@ run_test 33 "Basic usage tracking for user & group & project"
 
 # usage transfer test for user & group & project
 test_34() {
-       local BLK_CNT=2 # 2MB
+       local BLK_CNT=2 # MB
        local project_supported="no"
 
        is_project_quota_supported && project_supported="yes"
@@ -3260,7 +3260,7 @@ run_test 34 "Usage transfer for user & group & project"
 
 # usage is still accessible across restart
 test_35() {
-       local BLK_CNT=2 # MB
+       local BLK_CNT=2 # MB
 
        setup_quota_test || error "setup quota failed with $?"
        trap cleanup_quota_test EXIT
@@ -4236,7 +4236,7 @@ test_64() {
 run_test 64 "lfs project on symlink files should fail"
 
 test_65() {
-       local SIZE=10 #10M
+       local SIZE=10 # MB
        local TESTFILE="$DIR/$tdir/$tfile-0"
 
        setup_quota_test || error "setup quota failed with $?"
@@ -4350,7 +4350,7 @@ getgranted() {
 }
 
 test_67() {
-       local limit=20  # 20M
+       local limit=20 # MB
        local testfile="$DIR/$tdir/$tfile-0"
        local testfile2="$DIR/$tdir/$tfile-1"
        local testfile3="$DIR/$tdir/$tfile-2"
@@ -4534,8 +4534,8 @@ run_test 68 "slave number in quota pool changed after each add/remove OST"
 
 test_69()
 {
-       local global_limit=200  # 200M
-       local limit=10  # 10M
+       local global_limit=200 # MB
+       local limit=10 # MB
        local testfile="$DIR/$tdir/$tfile-0"
        local dom0="$DIR/$tdir/dom0"
        local qpool="qpool1"
@@ -4598,7 +4598,7 @@ run_test 69 "EDQUOT at one of pools shouldn't affect DOM"
 test_70()
 {
        local qpool="qpool1"
-       local limit=20
+       local limit=20 # MB
        local err=0
        local bhard
 
@@ -4637,8 +4637,8 @@ run_test 70 "check lfs setquota/quota with a pool option"
 
 test_71a()
 {
-       local limit=10  # 10M
-       local global_limit=100  # 100M
+       local limit=10 # MB
+       local global_limit=100 # MB
        local testfile="$DIR/$tdir/$tfile-0"
        local qpool="qpool1"
        local qpool2="qpool2"
@@ -4721,9 +4721,9 @@ run_test 71a "Check PFL with quota pools"
 
 test_71b()
 {
-       local global_limit=1000 # 1G
-       local limit1=160 # 160M
-       local limit2=10 # 10M
+       local global_limit=1000 # MB
+       local limit1=160 # MB
+       local limit2=10 # MB
        local testfile="$DIR/$tdir/$tfile-0"
        local qpool="qpool1"
        local qpool2="qpool2"
@@ -4788,8 +4788,8 @@ run_test 71b "Check SEL with quota pools"
 
 test_72()
 {
-       local limit=10  # 10M
-       local global_limit=50  # 50M
+       local limit=10 # MB
+       local global_limit=50 # MB
        local testfile="$DIR/$tdir/$tfile-0"
        local qpool="qpool1"