}
run_test_with_stat 14a "test setting quota on root ==="
-# set quota version (both administrative and operational quotas)
-quota_set_version() {
- do_facet mds "lctl set_param lquota.${FSNAME}-MDT*.quota_type=$1"
- for j in `seq $OSTCOUNT`; do
- do_facet ost$j "lctl set_param lquota.${FSNAME}-OST*.quota_type=$1"
- done
-}
-
test_14b(){
local l
local CURSPACE
echo " (group)total limits = $TOTAL_LIMIT; limit = $LIMIT, successful!"
resetquota -g $TSTUSR
- $LFS quotaoff -ug $DIR
- quota_save_version 1
- $LFS quotacheck -ug $DIR || error "quotacheck failed"
+
+ quota_save_version "ug1"
echo "Testing that >4GB quota limits fail on volume with quota v1"
$LFS setquota -u $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $DIR && error "no error from setquota, but should have failed"
run_test_with_stat 21 "run for fixing bug16053 ==========="
test_22() {
- $LFS quotaoff -ug $DIR || error "could not turn quotas off"
- quota_set_version "1"
- $LFS quotacheck -ug $DIR || error "quotacheck failed"
-
quota_save_version "ug1"
stopall
wait_exit_ST ${facet}
}
+# set quota version (both administrative and operational quotas)
+quota_set_version() {
+ do_facet mds "lctl set_param lquota.${FSNAME}-MDT*.quota_type=$1"
+ for j in `seq $OSTCOUNT`; do
+ do_facet ost$j "lctl set_param lquota.${FSNAME}-OST*.quota_type=$1"
+ done
+}
+
# save quota version (both administrative and operational quotas)
+# the function will also switch to the new version and the new type
quota_save_version() {
- local fsname=${2:-$FSNAME}
- do_facet mgs "lctl conf_param ${fsname}-MDT*.mdt.quota_type=$1"
+ local spec=$1
+ local ver=$(tr -c -d "123" <<< $spec)
+ local type=$(tr -c -d "ug" <<< $spec)
+
+ $LFS quotaoff -ug $MOUNT # just in case
+ [ -n "$ver" ] && quota_set_version $ver
+ [ -n "$type" ] && { $LFS quotacheck -$type $MOUNT || error "quotacheck has failed"; }
+
+ do_facet mgs "lctl conf_param ${FSNAME}-MDT*.mdt.quota_type=$spec"
local varsvc
local osts=$(get_facets OST)
for ost in ${osts//,/ }; do
varsvc=${ost}_svc
- do_facet mgs "lctl conf_param ${!varsvc}.ost.quota_type=$1"
- done
-
- # we must wait until the update has been triggered on the OST
- for ost in ${osts//,/ }; do
- wait_update_facet $ost "lctl get_param -n obdfilter.${!varsvc}.quota_type" $1
+ do_facet mgs "lctl conf_param ${!varsvc}.ost.quota_type=$spec"
done
- wait_update_facet mds "lctl get_param -n mds.${fsname}-MDT*.quota_type" $1
}
# client could mount several lustre
if [ ! "$old_QUOTA_TYPE" ] || [ "$quota_type" = "$old_QUOTA_TYPE" ]; then
return
fi
- $LFS quotaoff $mntpt
quota_save_version $old_QUOTA_TYPE
- $LFS quotacheck -ug $mntpt
}
setup_quota(){
if [ "$quota_type" != "$QUOTA_TYPE" ]; then
export old_QUOTA_TYPE=$quota_type
quota_save_version $QUOTA_TYPE
- $LFS quotacheck -ug $mntpt
fi
local quota_usrs=$QUOTA_USERS