. $LUSTRE/tests/test-framework.sh
init_test_env $@
. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
+init_logging
check_and_setup_lustre
fi
}
-create_pool() {
- do_facet $SINGLEMDS lctl pool_new $FSNAME.$1
- local RC=$?
- # get param should return err until pool is created
- [[ $RC -ne 0 ]] && return $RC
-
- wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$1 \
- 2>/dev/null || echo foo" "" || RC=1
- [[ $RC -ne 0 ]] && error "pool_new failed"
- return $RC
-}
-
drain_pool() {
pool=$1
wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$pool" ""\
}
create_pool_nofail() {
- create_pool $1
+ create_pool $FSNAME.$1
if [[ $? != 0 ]]
then
error "Pool creation of $1 failed"
}
create_pool_fail() {
- create_pool $1
+ create_pool $FSNAME.$1
if [[ $? == 0 ]]
then
error "Pool creation of $1 succeeded; should have failed"
remote_ost_nodsh && skip "remote OST with nodsh" && exit 0
ost_pools_init
-# Tests for new commands added
+trap "cleanup_pools $FSNAME" EXIT
+# Tests for new commands added
test_1() {
echo "Creating a pool with a 1 character pool name"
create_pool_nofail p
test_11() {
local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
- [[ $OSTCOUNT -le 1 ]] && skip "Need atleast 2 OSTs" && return
+ [[ $OSTCOUNT -le 1 ]] && skip_env "Need atleast 2 OSTs" && return
create_pool_nofail $POOL
create_pool_nofail $POOL2
test_12() {
local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
- [[ $OSTCOUNT -le 2 ]] && skip "Need atleast 3 OSTs" && return
+ [[ $OSTCOUNT -le 2 ]] && skip_env "Need atleast 3 OSTs" && return
create_pool_nofail $POOL
create_pool_nofail $POOL2
run_test 12 "OST Pool Membership"
test_13() {
- [[ $OSTCOUNT -le 2 ]] && skip "Need atleast 3 OSTs" && return
+ [[ $OSTCOUNT -le 2 ]] && skip_env "Need atleast 3 OSTs" && return
local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
local numfiles=10
run_test 13 "Striping characteristics in a pool"
test_14() {
- [[ $OSTCOUNT -le 2 ]] && skip "Need atleast 3 OSTs" && return
+ [[ $OSTCOUNT -le 2 ]] && skip_env "Need atleast 3 OSTs" && return
local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
local numfiles=100
test_21() {
local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
- [[ $OSTCOUNT -le 1 ]] && skip "Need atleast 2 OSTs" && return
+ [[ $OSTCOUNT -le 1 ]] && skip_env "Need atleast 2 OSTs" && return
local numfiles=12
local i=0
test_22() {
local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
- [[ $OSTCOUNT -le 1 ]] && skip "Need at least 2 OSTs" && return
+ [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return
local numfiles=100
test_23() {
local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
- [[ $OSTCOUNT -le 1 ]] && skip "Need atleast 2 OSTs" && return
+ [[ $OSTCOUNT -le 1 ]] && skip_env "Need atleast 2 OSTs" && return
mkdir -p $POOL_ROOT
check_runas_id $TSTID $TSTID $RUNAS || {
- skip "User $RUNAS_ID does not exist - skipping"
+ skip_env "User $RUNAS_ID does not exist - skipping"
return 0
}
- local numfiles=12
local i=0
local TGT
- local LIMIT=1024
+ local BLK_SZ=1024
+ local BUNIT_SZ=1024 # min block quota unit(kB)
+ local LOVNAME=`lctl get_param -n llite.*.lov.common_name | tail -n 1`
+ local OSTCOUNT=`lctl get_param -n lov.$LOVNAME.numobd`
+ local LIMIT
local dir=$POOL_ROOT/dir
- local file1="$dir/$tfile-quota1"
- local file2="$dir/$tfile-quota2"
+ local file="$dir/$tfile-quota"
create_pool_nofail $POOL
$LFS quotaoff -ug $MOUNT
$LFS quotacheck -ug $MOUNT
- $LFS setquota -u $TSTUSR -b $LIMIT -B $LIMIT $dir #-i 5 -I 5 $dir
-
- $LFS setstripe $file1 -c 1 -p $POOL
- chown $TSTUSR.$TSTUSR $file1
- ls -l $file1
+ LIMIT=$((BUNIT_SZ * (OSTCOUNT + 1)))
+ $LFS setquota -u $TSTUSR -b $LIMIT -B $LIMIT $dir
+ sleep 3
+ $LFS quota -v -u $TSTUSR $dir
+
+ $LFS setstripe $file -c 1 -p $POOL
+ chown $TSTUSR.$TSTUSR $file
+ ls -l $file
type runas
- stat=$(LC_ALL=C $RUNAS dd if=/dev/zero of=$file1 bs=1024 count=$((LIMIT*2)) 2>&1)
+ LOCALE=C $RUNAS dd if=/dev/zero of=$file bs=$BLK_SZ count=$((BUNIT_SZ*2)) || true
+ $LFS quota -v -u $TSTUSR $dir
+ cancel_lru_locks osc
+ stat=$(LOCALE=C $RUNAS dd if=/dev/zero of=$file bs=$BLK_SZ count=$BUNIT_SZ seek=$((BUNIT_SZ*2)) 2>&1)
RC=$?
echo $stat
[[ $RC -eq 0 ]] && error "dd did not fail with EDQUOT."
- echo $stat | grep "Disk quota exceeded"
+ echo $stat | grep "Disk quota exceeded" > /dev/null
[[ $? -eq 1 ]] && error "dd did not fail with EDQUOT."
+ $LFS quota -v -u $TSTUSR $dir
echo "second run"
$LFS quotaoff -ug $MOUNT
while [ $RC -eq 0 ];
do
i=$((i+1))
- stat=$(LOCALE=C $RUNAS2 dd if=/dev/zero of=${file2}$i bs=1024 \
+ stat=$(LOCALE=C $RUNAS2 dd if=/dev/zero of=${file}$i bs=1M \
count=$((LIMIT*LIMIT)) 2>&1)
RC=$?
if [ $RC -eq 1 ]; then
test_24() {
local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
- [[ $OSTCOUNT -le 1 ]] && skip "Need atleast 2 OSTs" && return
+ [[ $OSTCOUNT -le 1 ]] && skip_env "Need atleast 2 OSTs" && return
local numfiles=10
local i=0
stop $SINGLEMDS || return 1
start $SINGLEMDS ${dev} $MDS_MOUNT_OPTS || \
{ error "Failed to start $SINGLEMDS after stopping" && break; }
- client_df
+ clients_up
# Veriy that the pool got created and is usable
echo "Creating a file in pool$i"
log "cleanup: ======================================================"
cd $ORIG_PWD
-cleanup_tests
+cleanup_pools $FSNAME
check_and_cleanup_lustre
echo '=========================== finished ==============================='
[ -f "$POOLSLOG" ] && cat $POOLSLOG && grep -q FAIL $POOLSLOG && exit 1 || true