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]"
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."
# 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 ]] || \
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]
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]
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
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
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))"
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
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!"
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)
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"
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
}
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
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)"
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 ======================="