Whamcloud - gitweb
LU-322 tests: Pool test fixes for large number of OSTs
[fs/lustre-release.git] / lustre / tests / ost-pools.sh
index 11404d0..062924a 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}
@@ -56,11 +54,11 @@ NON_EXISTANT_POOL=nonexistantpool
 NON_EXISTANT_FS=nonexistantfs
 INVALID_POOL=some_invalid_pool_name
 TGT_COUNT=$OSTCOUNT
-TGT_FIRST=0
-TGT_MAX=$((TGT_COUNT-1))
+TGT_FIRST=$(printf %04x 0)
+TGT_MAX=$(printf %04x $((TGT_COUNT-1)))
 TGT_STEP=1
-TGT_LIST=$(seq $TGT_FIRST $TGT_STEP $TGT_MAX)
-TGT_LIST2=$(seq $TGT_FIRST 2 $TGT_MAX)
+TGT_LIST=$(seq 0x$TGT_FIRST $TGT_STEP 0x$TGT_MAX)
+TGT_LIST2=$(seq 0x$TGT_FIRST 2 0x$TGT_MAX)
 
 TGT_ALL="$FSNAME-OST[$TGT_FIRST-$TGT_MAX/1]"
 TGT_HALF="$FSNAME-OST[$TGT_FIRST-$TGT_MAX/2]"
@@ -257,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=1;i<=999;i++)); 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
@@ -329,23 +327,23 @@ 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
+    for i in $TGT_LIST; do TGT=${TGT}$(printf "%04x," $i); done
     TGT="${TGT}]"
     do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL $TGT
     [[ $? -eq 0 ]] || \
@@ -353,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"
@@ -636,7 +634,7 @@ test_11() {
     create_pool_nofail $POOL
     create_pool_nofail $POOL2
 
-    local start=$((TGT_FIRST+1))
+    local start=$(printf %04x $((TGT_FIRST+1)))
     do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL2 \
         $FSNAME-OST[$start-$TGT_MAX/2]
 
@@ -676,7 +674,7 @@ test_12() {
     create_pool_nofail $POOL
     create_pool_nofail $POOL2
 
-    local start=$((TGT_FIRST+1))
+    local start=$(printf %04x $((TGT_FIRST+1)))
     do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL2 \
         $FSNAME-OST[$start-$TGT_MAX/2]
 
@@ -706,7 +704,7 @@ test_12() {
     check_dir_in_pool $POOL_ROOT/dir1 $POOL
     check_dir_in_pool $POOL_ROOT/dir2 $POOL2
     check_file_in_osts $POOL_ROOT/file1 "$TGT_LIST2"    
-    check_file_in_osts $POOL_ROOT/file2 "$(seq $start 2 $TGT_MAX)"
+    check_file_in_osts $POOL_ROOT/file2 "$(seq 0x$start 2 0x$TGT_MAX)"
 
     echo Creating some more files
     create_dir $POOL_ROOT/dir3 $POOL
@@ -746,7 +744,7 @@ test_13() {
     check_file_in_pool $POOL_ROOT/dir1/file1 $POOL 1
     check_file_in_pool $POOL_ROOT/dir1/file2 $POOL 1
     create_file $POOL_ROOT/dir1/file3 $POOL 1 $((TGT_FIRST+2))
-    check_file_in_osts $POOL_ROOT/dir1/file1 "$TGT_FIRST"
+    check_file_in_osts $POOL_ROOT/dir1/file1 $((16#$TGT_FIRST))
     check_file_in_osts $POOL_ROOT/dir1/file2 "$((TGT_FIRST+1))"
     check_file_in_osts $POOL_ROOT/dir1/file3 "$((TGT_FIRST+2))"
 
@@ -810,7 +808,7 @@ test_14() {
     while [[ $i -lt $numfiles ]];
     do
         OST=$((OST+2))
-        [[ $OST -gt $TGT_MAX ]] && OST=$TGT_FIRST
+        [[ $OST -gt $((16#$TGT_MAX)) ]] && OST=$TGT_FIRST
 
         # echo "Iteration: $i OST: $OST"
         create_file $POOL_ROOT/dir1/file${i} $POOL 1
@@ -858,7 +856,7 @@ test_15() {
       create_pool_nofail pool${i}
 
       local tgt=$(printf "$FSNAME-OST%04x_UUID " $i)
-      add_pool pool${i} "$FSNAME-OST[$i]" "$tgt"
+      add_pool pool${i} "$FSNAME-OST[$(printf %04x $i)]" "$tgt"
       create_dir $POOL_ROOT/dir${i} pool${i}
       createmany -o $POOL_ROOT/dir$i/$tfile $numfiles || \
           error "createmany $POOL_ROOT/dir$i/$tfile failed!"
@@ -953,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
@@ -1057,8 +1055,8 @@ test_20() {
 
     add_pool $POOL $TGT_HALF "$TGT_UUID2"
 
-    local start=$((TGT_FIRST+1))
-    TGT=$(for i in `seq $start 2 $TGT_MAX`; \
+    local start=$(printf %04x $((TGT_FIRST+1)))
+    TGT=$(for i in $(seq 0x$start 2 0x$TGT_MAX); \
         do printf "$FSNAME-OST%04x_UUID " $i; done)
     add_pool $POOL2 "$FSNAME-OST[$start-$TGT_MAX/2]" "$TGT"
 
@@ -1123,8 +1121,8 @@ add_loop() {
     do
         echo "Pool $pool, iteration $c"
        do_facet $SINGLEMDS lctl pool_add $FSNAME.$pool OST[$TGT_FIRST-$TGT_MAX/$step] 2>/dev/null
-       local TGT_SECOND=$(($TGT_FIRST+$step))
-       if [ "$TGT_SECOND" -le "$TGT_MAX" ]; then
+       local TGT_SECOND=$(printf %04x $((TGT_FIRST+$step)))
+       if [ $((16#$TGT_SECOND)) -le $((16#$TGT_MAX)) ]; then
            do_facet $SINGLEMDS lctl pool_remove $FSNAME.$pool OST[$TGT_SECOND-$TGT_MAX/$step]
        fi
     done
@@ -1178,7 +1176,7 @@ test_23() {
 
     create_pool_nofail $POOL
 
-    local TGT=$(for i in `seq $TGT_FIRST 3 $TGT_MAX`; \
+    local TGT=$(for i in $(seq 0x$TGT_FIRST 3 0x$TGT_MAX); \
         do printf "$FSNAME-OST%04x_UUID " $i; done)
     add_pool $POOL "$FSNAME-OST[$TGT_FIRST-$TGT_MAX/3]" "$TGT"
     create_dir $dir $POOL
@@ -1395,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