Whamcloud - gitweb
LU-322 tests: Pool test fixes for large number of OSTS
authorMinh Diep <mdiep@whamcloud.com>
Tue, 13 Dec 2011 01:41:04 +0000 (17:41 -0800)
committerJohann Lombardi <johann@whamcloud.com>
Tue, 7 Feb 2012 08:33:15 +0000 (03:33 -0500)
This patch fixes issues with large numbers of OSTs with the
ost-pools test. we need to use hexidecimal numbers for
the pool args since the OSTs UUID are named with hex numbers.
Currently the test does pass but erros can be seen in the logs
when more than 9 OSTs exist.

Signed-off-by: Minh Diep <mdiep@whamcloud.com>
Change-Id: I5db7540ee710c528af33d768a105a55bd09229b3
Reviewed-on: http://review.whamcloud.com/1841
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Yu Jian <yujian@whamcloud.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Johann Lombardi <johann@whamcloud.com>
lustre/tests/ost-pools.sh

index b34937a..f8273d0 100644 (file)
@@ -55,11 +55,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]"
@@ -249,7 +249,7 @@ test_1() {
 
     echo "Creating a pool with a 1000 character pool name; should fail"
     local pool_name="p"
-    for i in $(seq 1 999); do pool_name=${pool_name}"o"; done
+    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."
@@ -333,7 +333,7 @@ test_2c() {
 
     # 4. lustre-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 ]] || \
@@ -614,7 +614,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]
 
@@ -656,7 +656,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]
 
@@ -678,7 +678,7 @@ test_12() {
     echo Changing the pool membership
     do_facet $SINGLEMDS lctl pool_remove $FSNAME.$POOL $FSNAME-OST[$TGT_FIRST]
     do_facet $SINGLEMDS lctl pool_list $FSNAME.$POOL
-       FIRST_UUID=$(echo $TGT_UUID | awk '{print $1}')
+    FIRST_UUID=$(echo $TGT_UUID | awk '{print $1}')
     add_pool $POOL2 $FSNAME-OST[$TGT_FIRST] "$FIRST_UUID "
     do_facet $SINGLEMDS lctl pool_list $FSNAME.$POOL2
 
@@ -686,7 +686,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
@@ -728,7 +728,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))"
 
@@ -792,7 +792,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
@@ -841,7 +841,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!"
@@ -945,50 +945,50 @@ test_18() {
     local numfiles=9877
     local plaindir=$POOL_ROOT/plaindir
     local pooldir=$POOL_ROOT/pooldir
-       local t1=0
-       local t2=0
-       local t3=0
-       local diff
+    local t1=0
+    local t2=0
+    local t3=0
+    local diff
 
     for i in $(seq 1 3);
     do
         echo "Create performance, iteration $i, $numfiles files x 3"
 
-               time1=$(create_perf $plaindir $numfiles)
-               echo "iter $i: $numfiles creates without pool: $time1"
-               t1=$(echo "scale=2; $t1 + $time1" | bc)
-
-               create_pool_nofail $POOL > /dev/null
-               add_pool $POOL $TGT_ALL "$TGT_UUID" > /dev/null
-               create_dir $pooldir $POOL
-               time2=$(create_perf $pooldir $numfiles)
-               echo "iter $i: $numfiles creates with pool: $time2"
-               t2=$(echo "scale=2; $t2 + $time2" | bc)
-
-               destroy_pool $POOL > /dev/null
-               time3=$(create_perf $pooldir $numfiles)
-               echo "iter $i: $numfiles creates with missing pool: $time3"
-               t3=$(echo "scale=2; $t3 + $time3" | bc)
-
-               echo
-       done
-
-       time1=$(echo "scale=2; $t1 / $i" | bc)
-       echo Avg time taken for $numfiles creates without pool: $time1
-       time2=$(echo "scale=2; $t2 / $i" | bc)
-       echo Avg time taken for $numfiles creates with pool: $time2
-       time3=$(echo "scale=2; $t3 / $i" | bc)
-       echo Avg time taken for $numfiles creates with missing pool: $time3
-
-       # Set this high until we establish a baseline for what the degradation
-       # is / should be
-       max=15
+        time1=$(create_perf $plaindir $numfiles)
+        echo "iter $i: $numfiles creates without pool: $time1"
+        t1=$(echo "scale=2; $t1 + $time1" | bc)
+
+        create_pool_nofail $POOL > /dev/null
+        add_pool $POOL $TGT_ALL "$TGT_UUID" > /dev/null
+        create_dir $pooldir $POOL
+        time2=$(create_perf $pooldir $numfiles)
+        echo "iter $i: $numfiles creates with pool: $time2"
+        t2=$(echo "scale=2; $t2 + $time2" | bc)
+
+        destroy_pool $POOL > /dev/null
+        time3=$(create_perf $pooldir $numfiles)
+        echo "iter $i: $numfiles creates with missing pool: $time3"
+        t3=$(echo "scale=2; $t3 + $time3" | bc)
+
+        echo
+    done
+
+    time1=$(echo "scale=2; $t1 / $i" | bc)
+    echo Avg time taken for $numfiles creates without pool: $time1
+    time2=$(echo "scale=2; $t2 / $i" | bc)
+    echo Avg time taken for $numfiles creates with pool: $time2
+    time3=$(echo "scale=2; $t3 / $i" | bc)
+    echo Avg time taken for $numfiles creates with missing pool: $time3
+
+    # Set this high until we establish a baseline for what the degradation
+    # is / should be
+    max=15
     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_ignore 23408 "Degradation with wide pool is $diff % (> $max %)"
 
-       max=30
+    max=30
     diff=$(echo "scale=2; ($time3 - $time1) * 100 / $time1" | bc)
     echo  "No pool to missing pool: $diff %."
     deg=$(echo "scale=2; $diff > $max" | bc)
@@ -1044,8 +1044,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"
 
@@ -1111,11 +1111,11 @@ add_loop() {
     for c in $(seq 1 10);
     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
-           do_facet $SINGLEMDS lctl pool_remove $FSNAME.$pool OST[$TGT_SECOND-$TGT_MAX/$step]
-       fi
+        do_facet $SINGLEMDS lctl pool_add $FSNAME.$pool OST[$TGT_FIRST-$TGT_MAX/$step] 2>/dev/null
+        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
     echo loop for $pool complete
 }
@@ -1168,7 +1168,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
@@ -1286,11 +1286,11 @@ test_24() {
           if [ "$pool" != "" ]; then
               check_file_in_pool $file $pool
           fi
-          pool1=$($GETSTRIPE -v $file | grep "^pool:" |\
+          pool1=$($GETSTRIPE -v $file | grep "^pool:" | \
               tr -d '[:blank:]' | cut -f 2 -d ':')
-          count1=$($GETSTRIPE -v $file | grep "^lmm_stripe_count:" |\
+          count1=$($GETSTRIPE -v $file | grep "^lmm_stripe_count:" | \
               tr -d '[:blank:]' | cut -f 2 -d ':')
-          size1=$($GETSTRIPE -v $file | grep "^lmm_stripe_size:" |\
+          size1=$($GETSTRIPE -v $file | grep "^lmm_stripe_size:" | \
               tr -d '[:blank:]' | cut -f 2 -d ':')
           [[ "$pool" != "$pool1" ]] && \
               error "Pool name ($pool) not inherited in $file($pool1)"
@@ -1314,37 +1314,37 @@ test_25() {
     mkdir -p $POOL_ROOT
 
     for i in $(seq 10); do
-               create_pool_nofail pool$i
-               do_facet $SINGLEMDS "lctl pool_add $FSNAME.pool$i OST0000; sync"
-               wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.pool$i | \
-                       sort -u | tr '\n' ' ' " "$FSNAME-OST0000_UUID " || \
-                       error "pool_add failed: $1; $2"
-
-               stop $SINGLEMDS || return 1
-               start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS  || \
-                       { error "Failed to start $SINGLEMDS after stopping" && break; }
-               wait_osc_import_state mds ost FULL
-               clients_up
-
-               # Verify that the pool got created and is usable
-               df $POOL_ROOT > /dev/null
-               sleep 5
-               # Make sure OST0 can be striped on
-               $SETSTRIPE -o 0 -c 1 $POOL_ROOT/$tfile
-               STR=$($GETSTRIPE $POOL_ROOT/$tfile | grep 0x | cut -f2 | tr -d " ")
-               rm $POOL_ROOT/$tfile
-               if [[ "$STR" == "0" ]]; then
-                       echo "Creating a file in pool$i"
-                       create_file $POOL_ROOT/file$i pool$i || break
-                       check_file_in_pool $POOL_ROOT/file$i pool$i || break
-               else
-                       echo "OST 0 seems to be unavailable.  Try later."
-               fi
-       done
+        create_pool_nofail pool$i
+        do_facet $SINGLEMDS "lctl pool_add $FSNAME.pool$i OST0000; sync"
+        wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.pool$i | \
+            sort -u | tr '\n' ' ' " "$FSNAME-OST0000_UUID " ||                \
+            error "pool_add failed: $1; $2"
+
+        stop $SINGLEMDS || return 1
+        start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS  || \
+            { error "Failed to start $SINGLEMDS after stopping" && break; }
+        wait_osc_import_state mds ost FULL
+        clients_up
+
+        # Verify that the pool got created and is usable
+        df $POOL_ROOT > /dev/null
+        sleep 5
+        # Make sure OST0 can be striped on
+        $SETSTRIPE -o 0 -c 1 $POOL_ROOT/$tfile
+        STR=$($GETSTRIPE $POOL_ROOT/$tfile | grep 0x | cut -f2 | tr -d " ")
+        rm $POOL_ROOT/$tfile
+        if [[ "$STR" == "0" ]]; then
+            echo "Creating a file in pool$i"
+            create_file $POOL_ROOT/file$i pool$i || break
+            check_file_in_pool $POOL_ROOT/file$i pool$i || break
+        else
+            echo "OST 0 seems to be unavailable.  Try later."
+        fi
+    done
 
     rm -rf $POOL_ROOT
     for i in $(seq 10); do
-               destroy_pool pool$i
+        destroy_pool pool$i
     done
 }
 run_test 25 "Create new pool and restart MDS ======================="