Whamcloud - gitweb
LU-1842 test: remove code from s-q to use OFD
[fs/lustre-release.git] / lustre / tests / sanity-quota.sh
index 4029290..09806a5 100644 (file)
@@ -9,9 +9,6 @@ set -e
 SRCDIR=`dirname $0`
 export PATH=$PWD/$SRCDIR:$SRCDIR:$PWD/$SRCDIR/../utils:$PATH:/sbin
 
-# only accounting tests are supported for the time being
-ONLY="33 34 35"
-
 ONLY=${ONLY:-"$*"}
 ALWAYS_EXCEPT="$SANITY_QUOTA_EXCEPT"
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
@@ -82,14 +79,6 @@ SHOW_QUOTA_INFO_GROUP="$LFS quota -t -g $DIR"
 
 build_test_filter
 
-# Use OFD for all quota testing
-cleanupall
-USE_OFD_OLD="$USE_OFD"
-LOAD_MODULES_REMOTE_OLD="$LOAD_MODULES_REMOTE"
-export USE_OFD="yes"
-export LOAD_MODULES_REMOTE="true"
-setupall
-
 lustre_fail() {
         local fail_node=$1
        local fail_loc=$2
@@ -304,7 +293,7 @@ cleanup_quota_test() {
        rm -rf $DIR/$tdir
        echo "Wait for unlink objects finished..."
        wait_delete_completed
-       sync_all_data
+       sync_all_data || true
 }
 
 quota_show_check() {
@@ -338,7 +327,7 @@ quota_show_check() {
        fi
 }
 
-# enalbe quota debug
+# enable quota debug
 quota_init() {
        do_nodes $(comma_list $(nodes_list)) "lctl set_param debug=+quota"
 }
@@ -415,7 +404,7 @@ test_1() {
 
        rm -f $TESTFILE
        wait_delete_completed
-       sync_all_data
+       sync_all_data || true
        USED=$(getquota -u $TSTUSR global curspace)
        [ $USED -ne 0 ] && quota_error u $TSTUSR \
                "user quota isn't released after deletion"
@@ -583,7 +572,7 @@ test_block_soft() {
        echo "Unlink file to stop timer"
        rm -f $TESTFILE
        wait_delete_completed
-       sync_all_data
+       sync_all_data || true
 
        $SHOW_QUOTA_USER
        $SHOW_QUOTA_GROUP
@@ -841,18 +830,7 @@ test_6() {
        $RUNAS2 $DD of=$TESTFILE2 count=1 ||
                error "write $TESTFILE2 failure, expect success"
        sync; sync
-       sync_all_data
-
-       # set a small timeout value, to make the quota RPC timedout before
-       # the watchdog triggered.
-       local timeout
-       if at_is_enabled; then
-               timeout=$(at_max_get ost)
-               at_max_set 20 ost
-       else
-               timeout=$(do_facet ost1 $LCTL get_param -n timeout)
-               do_facet ost1 $LCTL set_param timeout=20
-       fi
+       sync_all_data || true
 
        #define QUOTA_DQACQ 601
        #define OBD_FAIL_PTLRPC_DROP_REQ_OPC 0x513
@@ -867,8 +845,8 @@ test_6() {
        $RUNAS $DD of=$TESTFILE count=2 seek=1 oflag=sync conv=notrunc &
        DDPID=$!
 
-       echo "Sleep for $timeout"
-       sleep $timeout
+       echo "Sleep for $TIMEOUT"
+       sleep $TIMEOUT
 
        # write should be blocked and never finished
        if ! ps -p $DDPID  > /dev/null 2>&1; then
@@ -876,12 +854,6 @@ test_6() {
                error "write finished incorrectly!"
        fi
 
-       if at_is_enabled; then
-               at_max_set $timeout ost
-       else
-               do_facet ost1 $LCTL set_param timeout=$timeout
-       fi
-
        lustre_fail mds 0 0
 
        # no watchdog is triggered
@@ -1238,7 +1210,7 @@ test_12() {
        echo "Free space from ost0..."
        rm -f $TESTFILE0
        wait_delete_completed
-       sync_all_data
+       sync_all_data || true
 
        echo "Write to ost1 after space freed from ost0..."
        $RUNAS $DD of=$TESTFILE1 count=$blk_cnt oflag=sync ||
@@ -1301,7 +1273,7 @@ test_15(){
        local LIMIT=$((24 * 1024 * 1024 * 1024 * 1024)) # 24 TB
 
        wait_delete_completed
-       sync_all_data
+       sync_all_data || true
 
         # test for user
        $LFS setquota -u $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $DIR
@@ -1365,7 +1337,7 @@ test_17sub() {
                sleep 1
        done
 
-       sync; sync_all_data
+       sync; sync_all_data || true
 
        USED=$(getquota -u $TSTUSR global curspace)
        [ $USED -ge $(($BLKS * 1024)) ] || quota_error u $TSTUSR \
@@ -1728,7 +1700,7 @@ test_24() {
        runas -u 0 -g 0 $DD of=$TESTFILE count=$((blimit + 1)) ||
                error "write failure, expect success"
        cancel_lru_locks osc
-       sync_all_data
+       sync_all_data || true
 
        $SHOW_QUOTA_USER | grep '*' || error "no matching *"
 
@@ -1820,7 +1792,7 @@ test_33() {
                echo "Iteration $i/$INODES completed"
        done
        cancel_lru_locks osc
-       sync; sync_all_data
+       sync; sync_all_data || true
 
        echo "Verify disk usage after write"
        USED=$(getquota -u $TSTID global curspace)
@@ -1869,7 +1841,7 @@ test_34() {
        $DD of=$DIR/$tdir/$tfile count=$BLK_CNT 2>/dev/null ||
                error "write failed"
        cancel_lru_locks osc
-       sync; sync_all_data
+       sync; sync_all_data || true
 
        echo "chown the file to user $TSTID"
        chown $TSTID $DIR/$tdir/$tfile || error "chown failed"
@@ -1916,7 +1888,7 @@ test_35() {
        $RUNAS $DD of=$DIR/$tdir/$tfile count=$BLK_CNT 2>/dev/null ||
                error "write failed"
        cancel_lru_locks osc
-       sync; sync_all_data
+       sync; sync_all_data || true
 
        echo "Save disk usage before restart"
        local ORIG_USR_SPACE=$(getquota -u $TSTID global curspace)
@@ -1964,7 +1936,7 @@ test_35() {
        $RUNAS $DD of=$DIR/$tdir/$tfile count=$BLK_CNT seek=1 2>/dev/null ||
                error "write failed"
        cancel_lru_locks osc
-       sync; sync_all_data
+       sync; sync_all_data || true
 
        echo "Verify space usage is increased"
        USED=$(getquota -u $TSTID global curspace)
@@ -1996,8 +1968,12 @@ test_36() {
        echo "Copy admin quota files into MDT0..."
        local mntpt=$(facet_mntpt $SINGLEMDS)
        local mdt0_fstype=$(facet_fstype $SINGLEMDS)
-       echo "$mdt0_node, $mdt0_dev, $mntpt"
-       do_node $mdt0_node mount -t $mdt0_fstype $MDS_MOUNT_OPTS $mdt0_dev $mntpt
+       local opt
+       if ! do_node $mdt0_node test -b $mdt0_fstype; then
+               opt="-o loop"
+       fi
+       echo "$mdt0_node, $mdt0_dev, $mntpt, $opt"
+       do_node $mdt0_node mount -t $mdt0_fstype $opt $mdt0_dev $mntpt
        do_node $mdt0_node mkdir $mntpt/OBJECTS
        do_node $mdt0_node cp $LUSTRE/tests/admin_quotafile_v2.usr $mntpt/OBJECTS
        do_node $mdt0_node cp $LUSTRE/tests/admin_quotafile_v2.grp $mntpt/OBJECTS
@@ -2012,7 +1988,7 @@ test_36() {
 
        local proc="qmt.*.md-0x0.glb-usr"
        id_cnt=$(do_node $mdt0_node $LCTL get_param -n $proc | wc -l)
-       [ $id_cnt -eq 201 ] || error "Migrate inode user limit failed"
+       [ $id_cnt -eq 401 ] || error "Migrate inode user limit failed: $id_cnt"
        limit=$(getquota -u 1 global isoftlimit)
        [ $limit -eq 1024 ] || error "User inode softlimit: $limit"
        limit=$(getquota -u 1 global ihardlimit)
@@ -2020,7 +1996,7 @@ test_36() {
 
        proc="qmt.*.md-0x0.glb-grp"
        id_cnt=$(do_node $mdt0_node $LCTL get_param -n $proc | wc -l)
-       [ $id_cnt -eq 201 ] || error "Migrate inode group limit failed"
+       [ $id_cnt -eq 401 ] || error "Migrate inode group limit failed: $id_cnt"
        limit=$(getquota -g 1 global isoftlimit)
        [ $limit -eq 1024 ] || error "Group inode softlimit: $limit"
        limit=$(getquota -g 1 global ihardlimit)
@@ -2028,7 +2004,7 @@ test_36() {
 
        proc=" qmt.*.dt-0x0.glb-usr"
        id_cnt=$(do_node $mdt0_node $LCTL get_param -n $proc | wc -l)
-       [ $id_cnt -eq 201 ] || error "Migrate block user limit failed"
+       [ $id_cnt -eq 401 ] || error "Migrate block user limit failed: $id_cnt"
        limit=$(getquota -u 60001 global bsoftlimit)
        [ $limit -eq 10485760 ] || error "User block softlimit: $limit"
        limit=$(getquota -u 60001 global bhardlimit)
@@ -2036,7 +2012,7 @@ test_36() {
 
        proc="qmt.*.dt-0x0.glb-grp"
        id_cnt=$(do_node $mdt0_node $LCTL get_param -n $proc | wc -l)
-       [ $id_cnt -eq 201 ] || error "Migrate block user limit failed"
+       [ $id_cnt -eq 401 ] || error "Migrate block user limit failed: $id_cnt"
        limit=$(getquota -g 60001 global bsoftlimit)
        [ $limit -eq 10485760 ] || error "Group block softlimit: $limit"
        limit=$(getquota -g 60001 global bhardlimit)
@@ -2057,7 +2033,5 @@ quota_fini
 cd $ORIG_PWD
 complete $(basename $0) $SECONDS
 check_and_cleanup_lustre
-export USE_OFD="$USE_OFD_OLD"
-export LOAD_MODULES_REMOTE="$LOAD_MODULES_REMOTE_OLD"
 export QUOTA_AUTO=$QUOTA_AUTO_OLD
 exit_status