Whamcloud - gitweb
LU-18293 test: check to sync quota setting 28/56628/3
authorHongchao Zhang <hongchao@whamcloud.com>
Sun, 29 Sep 2024 00:32:39 +0000 (08:32 +0800)
committerOleg Drokin <green@whamcloud.com>
Fri, 18 Oct 2024 18:42:04 +0000 (18:42 +0000)
If some quota setting version is droped between QMT and QSD,
the quota setting could not be transfered to QSD and cause
the corresponding quota ID is not enforced properly.

Test-Parameters: trivial testlist=sanity-quota
Signed-off-by: Hongchao Zhang <hongchao@whamcloud.com>
Change-Id: I8c34f5f045637e2f44f8cd6806b848ed93d8e784
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56628
Tested-by: Maloo <maloo@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Qian Yingjin <qian@ddn.com>
Reviewed-by: Sergey Cheremencev <scherementsev@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/sanity-quota.sh

index c86b8f8..b7e72df 100755 (executable)
@@ -612,9 +612,11 @@ test_1a() {
        local used=$(getquota -u $TSTUSR global curspace)
        [ $used -ne 0 ] && error "Used space($used) for user $TSTUSR isn't 0."
 
-       $LFS setstripe $testfile -c 1 || error "setstripe $testfile failed"
+       $LFS setstripe $testfile -i 0 -c 1 || error "setstripe $testfile failed"
        chown $TSTUSR.$TSTUSR $testfile || error "chown $testfile failed"
 
+       wait_quota_synced ost1 OST0000 usr $TSTID hardlimit $((limit*1024))
+
        test_1_check_write $testfile "user" $limit
 
        rm -f $testfile
@@ -636,9 +638,11 @@ test_1a() {
        used=$(getquota -g $TSTUSR global curspace)
        [ $used -ne 0 ] && error "Used space ($used) for group $TSTUSR isn't 0"
 
-       $LFS setstripe $testfile -c 1 || error "setstripe $testfile failed"
+       $LFS setstripe $testfile -i 0 -c 1 || error "setstripe $testfile failed"
        chown $TSTUSR.$TSTUSR $testfile || error "chown $testfile failed"
 
+       wait_quota_synced ost1 OST0000 grp $TSTID hardlimit $((limit*1024))
+
        test_1_check_write $testfile "group" $limit
        rm -f $testfile
        wait_delete_completed || error "wait_delete_completed failed"
@@ -665,10 +669,12 @@ test_1a() {
        $LFS setquota -p $TSTPRJID -b 0 -B ${limit}M -i 0 -I 0 $DIR ||
                error "set project quota failed"
 
-       $LFS setstripe $testfile -c 1 || error "setstripe $testfile failed"
+       $LFS setstripe $testfile -i 0 -c 1 || error "setstripe $testfile failed"
        chown $TSTUSR:$TSTUSR $testfile || error "chown $testfile failed"
        change_project -p $TSTPRJID $testfile
 
+       wait_quota_synced ost1 OST0000 prj $TSTPRJID hardlimit $((limit*1024))
+
        test_1_check_write $testfile "project" $limit
 
        # cleanup
@@ -702,6 +708,9 @@ test_1b() {
        $LFS setquota -u $TSTUSR -b 0 -B ${global_limit}M -i 0 -I 0 $DIR ||
                error "set user quota failed"
 
+       wait_quota_synced ost1 OST0000 usr $TSTID hardlimit \
+                                                       $((global_limit*1024))
+
        pool_add $qpool || error "pool_add failed"
        pool_add_targets $qpool 0 $(($OSTCOUNT - 1)) ||
                error "pool_add_targets failed"
@@ -722,7 +731,7 @@ test_1b() {
 
        used=$(getquota -u $TSTUSR global bhardlimit $qpool)
 
-       $LFS setstripe $testfile -c 1 || error "setstripe $testfile failed"
+       $LFS setstripe $testfile -i 0 -c 1 || error "setstripe $testfile failed"
        chown $TSTUSR.$TSTUSR $testfile || error "chown $testfile failed"
 
        test_1_check_write $testfile "user" $limit
@@ -744,12 +753,15 @@ test_1b() {
        $LFS setquota -g $TSTUSR -b 0 -B ${limit}M --pool $qpool $DIR ||
                error "set group quota failed"
 
+       wait_quota_synced ost1 OST0000 grp $TSTID hardlimit \
+                                                       $((global_limit*1024))
+
        testfile="$DIR/$tdir/$tfile-1"
        # make sure the system is clean
        used=$(getquota -g $TSTUSR global curspace $qpool)
        [ $used -ne 0 ] && error "Used space ($used) for group $TSTUSR isn't 0"
 
-       $LFS setstripe $testfile -c 1 || error "setstripe $testfile failed"
+       $LFS setstripe $testfile -i 0 -c 1 || error "setstripe $testfile failed"
        chown $TSTUSR.$TSTUSR $testfile || error "chown $testfile failed"
 
        test_1_check_write $testfile "group" $limit
@@ -782,8 +794,10 @@ test_1b() {
        $LFS setquota -p $TSTPRJID -b 0 -B ${limit}M --pool $qpool $DIR ||
                error "set project quota failed"
 
+       wait_quota_synced ost1 OST0000 prj $TSTPRJID hardlimit \
+                                                       $((global_limit*1024))
 
-       $LFS setstripe $testfile -c 1 || error "setstripe $testfile failed"
+       $LFS setstripe $testfile -i 0 -c 1 || error "setstripe $testfile failed"
        chown $TSTUSR:$TSTUSR $testfile || error "chown $testfile failed"
        change_project -p $TSTPRJID $testfile
 
@@ -815,6 +829,9 @@ test_1c() {
        $LFS setquota -u $TSTUSR -b 0 -B ${global_limit}M -i 0 -I 0 $DIR ||
                error "set user quota failed"
 
+       wait_quota_synced ost1 OST0000 usr $TSTID hardlimit \
+                                                       $((global_limit*1024))
+
        pool_add $qpool1 || error "pool_add failed"
        pool_add_targets $qpool1 0 $(($OSTCOUNT - 1)) ||
                error "pool_add_targets failed"
@@ -838,6 +855,9 @@ test_1c() {
 
        used=$(getquota -u $TSTUSR global bhardlimit $qpool)
 
+       $LFS setstripe $testfile -i 0 -c 1 || error "setstripe $testfile failed"
+       chown $TSTUSR.$TSTUSR $testfile || error "chown $testfile failed"
+
        test_1_check_write $testfile "user" $global_limit
 
        used=$(getquota -u $TSTUSR global curspace $qpool1)