. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
init_logging
-# bug number for skipped test: EX-2745/EX-2757
-ALWAYS_EXCEPT="$HOT_POOLS_EXCEPT 56"
+# bug number for skipped test:
+ALWAYS_EXCEPT="$HOT_POOLS_EXCEPT "
# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
(( OSTCOUNT >= 2 )) || skip_env "need at least 2 OSTs"
done
}
+wait_file_resync() {
+ local file="$1"
+ local max=${2:-900}
+ local i
+
+ for ((i = 0; i < $max; i++)); do
+ grep -q 'lcme_flags:.*stale' <<< $($LFS getstripe $file) ||
+ break
+ sleep 1
+ done
+
+ (( i < max )) || {
+ $LFS getstripe $file
+ error "$file still has stale component after $i seconds"
+ }
+}
+
wait_file_mirror() {
local file="$1"
local count="$2"
local tf=$DIR/$tfile
local free_MB
local size_MB
+ local freehi=99
+ local freelo=96
local cksum_orig
local cksum_new
local ids
+ local cmd
local i
init_hot_pools_env
stack_trap stop_lamigo_service
# start lpurge
- LPURGE_FREELO=80 start_lpurge_service
+ LPURGE_FREELO=$freelo LPURGE_FREEHI=$freehi start_lpurge_service
check_lpurge_is_started || error "failed to start lpurge"
stack_trap stop_lpurge_service
$LFS df
free_MB=$(($(df -P $DIR | tail -n 1 | awk '{ print $4 }') / 1024))
- size_MB=$((free_MB / 2 / 4))
+ size_MB=$((free_MB * (100 - freelo + 1) / 100 / 2))
# create a regular file in source pool
- $LFS setstripe -c -1 -p $LAMIGO_SRC $tf-1 ||
- error "$LFS setstripe $tf-1 failed"
+ cmd="$LFS setstripe -c -1 -p $LAMIGO_SRC $tf-1"
+ echo $cmd
+ $cmd || error "$LFS setstripe $tf-1 failed"
# create a PFL file
- $LFS setstripe -E 1M -c -1 -p $LAMIGO_SRC --comp-flags=prefer \
- -E eof -p $LAMIGO_TGT $tf-2 ||
- error "$LFS setstripe $tf-2 failed"
+ cmd="$LFS setstripe -E 1M -c -1 -p $LAMIGO_SRC --comp-flags=prefer"
+ cmd+=" -E eof -p $LAMIGO_TGT $tf-2"
+ echo $cmd
+ $cmd || error "$LFS setstripe $tf-2 failed"
# create a FLR file
- $LFS mirror create -N -E 1M -c -1 -p $LAMIGO_SRC -E eof -p $LAMIGO_TGT \
- -N -p $LAMIGO_SRC $tf-3 ||
- error "$LFS setstripe $tf-3 failed"
+ cmd="$LFS mirror create -N -E 1M -c -1 -p $LAMIGO_SRC"
+ cmd+=" -E eof -p $LAMIGO_TGT -N -p $LAMIGO_SRC $tf-3"
+ echo $cmd
+ $cmd || error "$LFS setstripe $tf-3 failed"
+
# fill in data
- for i in $(seq 2); do
- yes "${size_MB}M file"|
- dd bs=1M count=$size_MB iflag=fullblock of=$tf-$i ||
- error "failed to write to $tf-$i"
- done
yes "1M file"| dd bs=1M count=1 iflag=fullblock of=$tf-3 ||
error "failed to write to $tf-3"
cancel_lru_locks
sync; sleep 5; sync
$LFS mirror resync $tf-3 || error "failed to resync $tf-3"
+
+ for i in {1..2}; do
+ yes "${size_MB}M file"|
+ dd bs=1M count=$size_MB iflag=fullblock of=$tf-$i || {
+ $LFS getstripe $tf-$i
+ error "failed to write to $tf-$i"
+ }
+ done
+
cancel_lru_locks osc
echo "Before replicating and purging:"
$LFS df
# compute checksums if file size is equal to or smaller than 2GB
- if (( size_MB <= 2048 )); then
- echo "Compute checksums ..."
- for i in $(seq 3); do
- cksum_orig[${#cksum_orig[@]}]=$(md5sum $tf-$i)
- done
- fi
+ echo "Compute checksums ..."
+ for i in {1..3}; do
+ ! (( i < 3 && size_MB > 2048 )) || continue
+ cksum_orig[${#cksum_orig[@]}]=$(md5sum $tf-$i)
+ done
sleep $((LAMIGO_AGE * 2 + LPURGE_INTV * 2))
+ for i in {1..3}; do
+ wait_file_resync $tf-$i
+ done
+
echo "After replicating and purging:"
$LFS df
# check checksums if file size is equal to or smaller than 2GB
- if (( size_MB <= 2048 )); then
- echo "Check checksums ..."
- for i in $(seq 3); do
- cksum_new[${#cksum_new[@]}]=$(md5sum $tf-$i)
-
- [[ "${cksum_orig[i-1]}" = "${cksum_new[i-1]}" ]] ||
- error "$tf-$i checksum mismatch: '${cksum_orig[i-1]}' != '${cksum_new[i-1]}'"
- done
- fi
+ echo "Check checksums ..."
+ for i in {1..3}; do
+ ! (( i < 3 && size_MB > 2048 )) || continue
+ cksum_new[${#cksum_new[@]}]=$(md5sum $tf-$i)
+
+ [[ "${cksum_orig[i-1]}" = "${cksum_new[i-1]}" ]] ||
+ error "$tf-$i checksum mismatch: '${cksum_orig[i-1]}' != '${cksum_new[i-1]}'"
+ done
# verify files replicated in target pool and purged from source pool
wait_file_mirror $tf-1 1 900