From 93e8f674017c73aa00028f21eb17dcb9bdd91ee7 Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 22 Aug 2008 17:41:05 +0000 Subject: [PATCH] b=15899 i=nathan i=adilger add OST pools --- lustre/tests/sanity.sh | 127 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 126 insertions(+), 1 deletion(-) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 8444e3c..11a9956 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -3522,6 +3522,7 @@ OLDHOME=$HOME [ $RUNAS_ID -ne $UID ] && HOME=/tmp test_99a() { + [ -z "$(which cvs 2>/dev/null)" ] && skip "could not find cvs" && return mkdir -p $DIR/d99cvsroot || error "mkdir $DIR/d99cvsroot failed" chown $RUNAS_ID $DIR/d99cvsroot || error "chown $DIR/d99cvsroot failed" $RUNAS cvs -d $DIR/d99cvsroot init || error "cvs init failed" @@ -3529,6 +3530,7 @@ test_99a() { run_test 99a "cvs init =========================================" test_99b() { + [ -z "$(which cvs 2>/dev/null)" ] && skip "could not find cvs" && return [ ! -d $DIR/d99cvsroot ] && test_99a $RUNAS [ ! -w /tmp ] && skip "/tmp has wrong w permission -- skipping" && return cd /etc/init.d || error "cd /etc/init.d failed" @@ -3542,6 +3544,7 @@ test_99b() { run_test 99b "cvs import =======================================" test_99c() { + [ -z "$(which cvs 2>/dev/null)" ] && skip "could not find cvs" && return [ ! -d $DIR/d99cvsroot ] && test_99b cd $DIR || error "cd $DIR failed" mkdir -p $DIR/d99reposname || error "mkdir $DIR/d99reposname failed" @@ -3553,6 +3556,7 @@ test_99c() { run_test 99c "cvs checkout =====================================" test_99d() { + [ -z "$(which cvs 2>/dev/null)" ] && skip "could not find cvs" && return [ ! -d $DIR/d99cvsroot ] && test_99c cd $DIR/d99reposname $RUNAS touch foo99 @@ -3561,6 +3565,7 @@ test_99d() { run_test 99d "cvs add ==========================================" test_99e() { + [ -z "$(which cvs 2>/dev/null)" ] && skip "could not find cvs" && return [ ! -d $DIR/d99cvsroot ] && test_99c cd $DIR/d99reposname $RUNAS cvs update @@ -3568,6 +3573,7 @@ test_99e() { run_test 99e "cvs update =======================================" test_99f() { + [ -z "$(which cvs 2>/dev/null)" ] && skip "could not find cvs" && return [ ! -d $DIR/d99cvsroot ] && test_99d cd $DIR/d99reposname $RUNAS cvs commit -m 'nomsg' foo99 @@ -4906,8 +4912,10 @@ test_122() { #bug 11544 run_test 122 "fail client bulk callback (shouldn't LBUG) =======" test_123a() { # was test 123, statahead(bug 11401) + SLOWOK=0 if [ -z "$(grep "processor.*: 1" /proc/cpuinfo)" ]; then log "testing on UP system. Performance may be not as good as expected." + SLOWOK=1 fi remount_client $MOUNT @@ -4962,7 +4970,7 @@ test_123a() { # was test 123, statahead(bug 11401) lctl get_param -n llite.*.statahead_stats # wait for commitment of removal sleep 2 - [ $error -ne 0 ] && error "statahead is slow!" + [ $error -ne 0 -a $SLOWOK -eq 0 ] && error "statahead is slow!" return 0 } run_test 123a "verify statahead work" @@ -5444,6 +5452,123 @@ test_130e() { } run_test 130e "FIEMAP (test continuation FIEMAP calls)" +POOL=${POOL:-cea1} +TGT_COUNT=$OSTCOUNT +TGTPOOL_FIRST=1 +TGTPOOL_MAX=$(($TGT_COUNT - 1)) +TGTPOOL_STEP=2 +TGTPOOL_LIST=`seq $TGTPOOL_FIRST $TGTPOOL_STEP $TGTPOOL_MAX` +POOL_ROOT=${POOL_ROOT:-$DIR/d200.pools} +POOL_DIR=$POOL_ROOT/dir_tst +POOL_FILE=$POOL_ROOT/file_tst + +check_file_in_pool() +{ + file=$1 + res=$($GETSTRIPE $file | grep 0x | cut -f2) + for i in $res + do + found=$(echo :$TGTPOOL_LIST: | tr " " ":" | grep :$i:) + if [[ "$found" == "" ]] + then + echo "pool list: $TGTPOOL_LIST" + echo "striping: $res" + error "$file not allocated in $POOL" + return 1 + fi + done + return 0 +} + +test_200() { + do_facet mgs $LCTL pool_new $FSNAME.$POOL + do_facet mgs $LCTL get_param -n lov.$FSNAME-mdtlov.pools.$POOL + [ $? == 0 ] || error "Pool creation of $POOL failed" +} +run_test 200 "Create new pool ==========================================" + +test_201() { + TGT=$(seq -f $FSNAME-OST%04g_UUID $TGTPOOL_FIRST $TGTPOOL_STEP \ + $TGTPOOL_MAX | tr '\n' ' ') + do_facet mgs $LCTL pool_add $FSNAME.$POOL \ + $FSNAME-OST[$TGTPOOL_FIRST-$TGTPOOL_MAX/$TGTPOOL_STEP]_UUID + res=$(do_facet mgs $LCTL get_param -n lov.$FSNAME-mdtlov.pools.$POOL | sort \ + | tr '\n' ' ') + [ "$res" = "$TGT" ] || error "Pool content ($res) do not match requested ($TGT)" +} +run_test 201 "Add targets to a pool ====================================" + +test_202a() { + mkdir -p $POOL_DIR + $SETSTRIPE -c 2 -p $POOL $POOL_DIR + [ $? = 0 ] || error "Cannot set pool $POOL to $POOL_DIR" +} +run_test 202a "Set pool on a directory =================================" + +test_202b() { + res=$($GETSTRIPE $POOL_DIR | grep pool: | cut -f8 -d " ") + [ "$res" = $POOL ] || error "Pool on $POOL_DIR is not $POOL" +} +run_test 202b "Check pool on a directory ===============================" + +test_202c() { + failed=0 + for i in $(seq -w 1 $(($TGT_COUNT * 3))) + do + file=$POOL_DIR/file-$i + touch $file + check_file_in_pool $file + if [[ $? != 0 ]] + then + failed=$(($failed + 1)) + fi + done + [ "$failed" = 0 ] || error "$failed files not allocated in $POOL" +} +run_test 202c "Check files allocation from directory pool ==============" + +test_203() { + mkdir -p $POOL_FILE + failed=0 + for i in $(seq -w 1 $(($TGT_COUNT * 3))) + do + file=$POOL_FILE/spoo-$i + $SETSTRIPE -p $POOL $file + check_file_in_pool $file + if [[ $? != 0 ]] + then + failed=$(($failed + 1)) + fi + done + [ "$failed" = 0 ] || error "$failed files not allocated in $POOL" +} +run_test 203 "Create files in a pool ===================================" + +test_210a() { + TGT=$(do_facet mgs $LCTL get_param -n lov.$FSNAME-mdtlov.pools.$POOL | head -1) + do_facet mgs $LCTL pool_remove $FSNAME.$POOL $TGT + res=$(do_facet mgs $LCTL get_param -n lov.$FSNAME-mdtlov.pools.$POOL | grep $TGT) + [ "$res" = "" ] || error "$TGT not removed from $FSNAME.$POOL" +} +run_test 210a "Remove a target from a pool =============================" + +test_210b() { + for TGT in $(do_facet mgs $LCTL get_param -n lov.$FSNAME-mdtlov.pools.$POOL) + do + do_facet mgs $LCTL pool_remove $FSNAME.$POOL $TGT + done + res=$(do_facet mgs $LCTL get_param -n lov.$FSNAME-mdtlov.pools.$POOL) + [ "$res" = "" ] || error "Pool $FSNAME.$POOL cannot be drained" +} +run_test 210b "Remove all targets from a pool ==========================" + +test_211() { + do_facet mgs $LCTL pool_destroy $FSNAME.$POOL + res=$(do_facet mgs "$LCTL get_param -n lov.$FSNAME-mdtlov.pools.$POOL 2>/dev/null") + [ "$res" = "" ] || error "Pool $FSNAME.$POOL is not destroyed" +} +run_test 211 "Remove a pool ============================================" + TMPDIR=$OLDTMPDIR TMP=$OLDTMP HOME=$OLDHOME -- 1.8.3.1