Whamcloud - gitweb
LU-690 test: wait_osc_import_state() fixes
[fs/lustre-release.git] / lustre / tests / ost-pools.sh
index 8357fd4..3e9afb9 100644 (file)
@@ -32,8 +32,6 @@ check_and_setup_lustre
 DIR=${DIR:-$MOUNT}
 assert_DIR
 
-POOLSLOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log}
-[ "$POOLSLOG" ] && rm -f $POOLSLOG || true
 build_test_filter
 
 FAIL_ON_ERROR=${FAIL_ON_ERROR:-true}
@@ -148,10 +146,15 @@ check_file_in_osts() {
         return 0
 }
 
+file_pool() {
+    $GETSTRIPE -v $1 | grep "^lmm_pool:" | tr -d "[:blank:]" | cut -f 2 -d ':'
+}
+
 check_file_not_in_pool() {
     local file=$1
     local pool=$2
-    local res=$($GETSTRIPE -v $file | grep "^pool:" | tr -d "[:blank:]" | cut -f 2 -d ':')
+    local res=$(file_pool $file)
+
     if [[ "$res" == "$pool" ]]; then
         error "File $file is in pool: $res"
         return 1
@@ -252,9 +255,9 @@ test_1() {
     create_pool_fail p1234567891234567
 
     echo "Creating a pool with a 1000 character pool name; should fail"
-    NAME="p"
-    for i in `seq 1 999`; do NAME=${NAME}"o"; done
-    create_pool_fail $NAME
+    local pool_name="p"
+    for i in $(seq 1 999); do pool_name=${pool_name}"o"; done
+    create_pool_fail $pool_name
 
     echo "pool_new should fail if fs-name or poolname are missing."
     do_facet $SINGLEMDS lctl pool_new .pool1 2>/dev/null
@@ -324,21 +327,21 @@ test_2c() {
     do_facet $SINGLEMDS lctl pool_remove $FSNAME.$POOL OST0000
     drain_pool $POOL
 
-    # 2. lustre-OST0000
+    # 2. $FSNAME-OST0000
     do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL $FSNAME-OST0000
     RC=$?; [[ $RC -eq 0 ]] || \
         error "pool_add failed. $FSNAME $POOL $FSNAME-OST0000: $RC"
     do_facet $SINGLEMDS lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000
     drain_pool $POOL
 
-    # 3. lustre-OST0000_UUID
+    # 3. $FSNAME-OST0000_UUID
     do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL $FSNAME-OST0000_UUID
     RC=$?; [[ $RC -eq 0 ]] || \
         error "pool_add failed. $FSNAME $POOL $FSNAME-OST0000_UUID: $RC"
     do_facet $SINGLEMDS lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000_UUID
     drain_pool $POOL
 
-    # 4. lustre-OST[0,1,2,3,]
+    # 4. $FSNAME-OST[0,1,2,3,]
     TGT="$FSNAME-OST["
     for i in $TGT_LIST; do TGT=${TGT}$(printf "$i," $i); done
     TGT="${TGT}]"
@@ -348,7 +351,7 @@ test_2c() {
     do_facet $SINGLEMDS lctl pool_remove $FSNAME.$POOL $TGT
     drain_pool $POOL
 
-    # 5. lustre-OST[0-5/1]
+    # 5. $FSNAME-OST[0-5/1]
     do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL $TGT_ALL
     RC=$?; [[ $RC -eq 0 ]] || \
         error "pool_add failed. $FSNAME $POOL" "$TGT_ALL $RC"
@@ -948,7 +951,7 @@ create_perf() {
 test_18() {
     set_cleanup_trap
     local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
-    local numfiles=9877
+    local numfiles=30000
     local plaindir=$POOL_ROOT/plaindir
     local pooldir=$POOL_ROOT/pooldir
        local t1=0
@@ -988,16 +991,17 @@ test_18() {
 
        # Set this high until we establish a baseline for what the degradation
        # is / should be
-       max=15
+       max=30
     diff=$(echo "scale=2; ($time2 - $time1) * 100 / $time1" | bc)
     echo  "No pool to wide pool: $diff %."
     deg=$(echo "scale=2; $diff > $max" | bc)
-    [ "$deg" == "1" ] && error "Degradation with wide pool is $diff % (> $max %)"
+    [ "$deg" == "1" ] && error_ignore 23408  "Degradation with wide pool is $diff % (> $max %)"
 
+       max=15
     diff=$(echo "scale=2; ($time3 - $time1) * 100 / $time1" | bc)
     echo  "No pool to missing pool: $diff %."
     deg=$(echo "scale=2; $diff > $max" | bc)
-    [ "$deg" == "1" ] && error "Degradation with missing pool is $diff % (> $max %)"
+    [ "$deg" == "1" ] && error_ignore 23408 "Degradation with missing pool is $diff % (> $max %)"
 
     return 0
 }
@@ -1290,8 +1294,7 @@ test_24() {
           if [ "$pool" != "" ]; then
               check_file_in_pool $file $pool
           fi
-          pool1=$($GETSTRIPE -v $file | grep "^pool:" |\
-              tr -d '[:blank:]' | cut -f 2 -d ':')
+          pool1=$(file_pool $file)
           count1=$($GETSTRIPE -v $file | grep "^lmm_stripe_count:" |\
               tr -d '[:blank:]' | cut -f 2 -d ':')
           size1=$($GETSTRIPE -v $file | grep "^lmm_stripe_size:" |\
@@ -1390,10 +1393,9 @@ test_26() {
 }
 run_test 26 "Choose other OSTs in the pool first in the creation remedy"
 
-log "cleanup: ======================================================"
 cd $ORIG_PWD
+
+complete $(basename $0) $SECONDS
 cleanup_pools $FSNAME
 check_and_cleanup_lustre
-echo '=========================== finished ==============================='
-[ -f "$POOLSLOG" ] && cat $POOLSLOG && grep -q FAIL $POOLSLOG && exit 1 || true
-echo "$0: completed"
+exit_status