From e965cf5b3d00f5101993e3428347a8a5c968957d Mon Sep 17 00:00:00 2001 From: anserper Date: Wed, 20 May 2009 23:59:37 +0000 Subject: [PATCH] b=19481 i=Johann Lombardi i=Gryaznova Elena fix for the quota_save_version function to allow it to be called before quota files are created --- lustre/tests/sanity-quota.sh | 17 ++--------------- lustre/tests/test-framework.sh | 31 +++++++++++++++++++------------ 2 files changed, 21 insertions(+), 27 deletions(-) diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index ba32c22..590bfa5 100644 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -1264,14 +1264,6 @@ test_14a() { # was test_14 b=12223 -- setting quota on root } 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 @@ -1369,9 +1361,8 @@ test_15(){ 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" @@ -1867,10 +1858,6 @@ test_21() { 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 diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 3d7e00f..71917c6 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -368,22 +368,32 @@ stop() { 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 @@ -402,9 +412,7 @@ restore_quota_type () { 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(){ @@ -420,7 +428,6 @@ 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 -- 1.8.3.1