From: Sergey Cheremencev Date: Mon, 9 Oct 2023 02:45:16 +0000 (+0400) Subject: LU-17179 tests: check the system is clean X-Git-Tag: 2.15.62~119 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=7e1fb1a296e;p=fs%2Flustre-release.git LU-17179 tests: check the system is clean Main part of tests cannot work correctly if the system is not clean. So check this in the beginning of sanity-quota. Test-Parameters: trivial Signed-off-by: Sergey Cheremencev Change-Id: Ibfbe4663dee8476486e96eb99ccbcea13216861b Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52630 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Artem Blagodarenko Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index 88e472a..4bd8d45 100755 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -552,6 +552,38 @@ wait_quota_synced() { done } +# make sure the system is clean +check_system_is_clean() { + local used + + lfs quota -uv quota_usr /mnt/lustre + for cur in "curspace" "curinodes"; + do + used=$(getquota -u $TSTUSR global $cur) + [ $used -ne 0 ] && quota_error u $TSTUSR \ + "Used ${cur:3}($used) for user $TSTUSR isn't 0." + + used=$(getquota -u $TSTUSR2 global $cur) + [ $used -ne 0 ] && quota_error u $TSTUSR2 \ + "Used ${cur:3}($used) for user $TSTUSR2 isn't 0." + + used=$(getquota -g $TSTUSR global $cur) + [ $used -ne 0 ] && quota_error g $TSTUSR \ + "Used ${cur:3}($used) for group $TSTUSR isn't 0." + + used=$(getquota -g $TSTUSR2 global $cur) + [ $used -ne 0 ] && quota_error g $TSTUSR2 \ + "Used ${cur:3}($used) for group $TSTUSR2 isn't 0." + + if is_project_quota_supported; then + used=$(getquota -p $TSTPRJID global $cur) + [ $used -ne 0 ] && quota_error p $TSTPRJID \ + "Used ${cur:3}($used) for project $TSTPRJID isn't 0" + fi + done + return 0 +} + # enable quota debug quota_init() { do_nodes $(comma_list $(nodes_list)) \ @@ -564,6 +596,7 @@ check_runas_id_ret $TSTUSR $TSTUSR $RUNAS || error "Please create user $TSTUSR($TSTID) and group $TSTUSR($TSTID)" check_runas_id_ret $TSTUSR2 $TSTUSR2 $RUNAS2 || error "Please create user $TSTUSR2($TSTID2) and group $TSTUSR2($TSTID2)" +check_system_is_clean test_quota_performance() { local TESTFILE="$DIR/$tdir/$tfile-0"