verify_comp_attr stripe-size $tf ${ids[1]} 4194304
verify_comp_attr stripe-count $tf ${ids[1]} 2
verify_comp_attr stripe-index $tf ${ids[1]} 2
- verify_comp_attr pool $tf ${ids[1]} flash
# verify component ${ids[2]}
verify_comp_attr stripe-size $tf ${ids[2]} 16777216
verify_comp_attr_with_default stripe-size $tf ${ids[$i]}
verify_comp_attr stripe-count $tf ${ids[$i]} 2
verify_comp_attr stripe-index $tf ${ids[$i]} 1
- verify_comp_attr pool $tf ${ids[$i]} flash
verify_comp_extent $tf ${ids[$i]} 0 4194304
done
verify_comp_attr stripe-size $tf ${ids[0]} 33554432
verify_comp_attr stripe-count $tf ${ids[0]} 3
verify_comp_attr stripe-index $tf ${ids[0]} 1
- verify_comp_attr pool $tf ${ids[0]} ssd
# verify component ${ids[1]}
verify_comp_attr stripe-size $tf ${ids[1]} 4194304
verify_comp_attr stripe-count $tf ${ids[1]} 2
verify_comp_attr stripe-index $tf ${ids[1]} 2
- verify_comp_attr pool $tf ${ids[1]} flash
# verify component ${ids[2]}
verify_comp_attr stripe-size $tf ${ids[2]} 16777216
verify_comp_attr_with_default stripe-size $tf ${ids[$i]}
verify_comp_attr stripe-count $tf ${ids[$i]} 2
verify_comp_attr stripe-index $tf ${ids[$i]} 1
- verify_comp_attr pool $tf ${ids[$i]} flash
verify_comp_extent $tf ${ids[$i]} 0 4194304
done
test_0g() {
local tf=$DIR/$tfile
+ ! $LFS mirror create --flags prefer $tf ||
+ error "creating $tf w/ --flags but w/o -N option should fail"
+
+ ! $LFS mirror create -N --flags foo $tf ||
+ error "creating $tf with '--flags foo' should fail"
+
+ ! $LFS mirror create -N --flags stale $tf ||
+ error "creating $tf with '--flags stale' should fail"
+
+ ! $LFS mirror create -N --flags prefer,init $tf ||
+ error "creating $tf with '--flags prefer,init' should fail"
+
+ ! $LFS mirror create -N --flags ^prefer $tf ||
+ error "creating $tf with '--flags ^prefer' should fail"
+
$LFS mirror create -N -E 1M -S 1M -o0 --flags=prefer -E eof -o1 \
-N -o1 $tf || error "create mirrored file $tf failed"
verify_comp_attr lcme_flags $tf 0x10002 prefer
# set flags to the first component
+ ! $LFS setstripe --comp-set -I 0x10001 --comp-flags=^prefer,foo $tf ||
+ error "setting '^prefer,foo' flags should fail"
+
+ ! $LFS getstripe --component-flags=prefer,foo $tf ||
+ error "getting component(s) with 'prefer,foo' flags should fail"
+
$LFS setstripe --comp-set -I 0x10001 --comp-flags=^prefer,stale $tf
verify_comp_attr lcme_flags $tf 0x10001 stale
}
run_test 205 "lfs mirror extend to set prefer flag"
+function test_206() {
+ # create a new OST pool
+ local pool_name=$TESTNAME
+
+ create_pool $FSNAME.$pool_name ||
+ error "create OST pool $pool_name failed"
+ # add OSTs into the pool
+ pool_add_targets $pool_name 0 1 ||
+ error "add OSTs into pool $pool_name failed"
+
+ $LFS setstripe -c1 --pool=$pool_name $DIR/$tfile ||
+ error "can't setstripe"
+ $LFS mirror extend -N $DIR/$tfile ||
+ error "can't create replica"
+ if $LFS getstripe $DIR/$tfile | grep -q prefer ; then
+ $LFS getstripe $DIR/$tfile
+ error "prefer found"
+ fi
+ $LFS setstripe --comp-set --comp-flags=prefer -p $pool_name $DIR/$tfile || {
+ $LFS getstripe $DIR/$tfile
+ error "can't setstripe prefer"
+ }
+
+ if ! $LFS getstripe $DIR/$tfile | grep -q prefer ; then
+ $LFS getstripe $DIR/$tfile
+ error "no prefer found"
+ fi
+
+ # destroy OST pool
+ destroy_test_pools
+}
+run_test 206 "lfs setstripe -pool .. --comp-flags=.. "
+
+test_207() {
+ local file=$DIR/$tfile
+ local tmpfile=$DIR/$tfile-tt
+
+ [ $MDS1_VERSION -lt $(version_code 2.14.50) ] &&
+ skip "Need MDS version at least 2.14.50"
+
+ stack_trap "rm -f $tmpfile $file"
+
+ # generate data for verification
+ dd if=/dev/urandom of=$tmpfile bs=1M count=1 ||
+ error "can't generate file with random data"
+
+ # create a mirrored file with one stale replica
+ $LFS mirror create -N -S 4M -c 2 -N -S 1M -c -1 $file ||
+ error "create mirrored file $file failed"
+ get_mirror_ids $file
+ echo "mirror IDs: ${mirror_array[@]}"
+
+ dd if=$tmpfile of=$file bs=1M || error "can't copy"
+ get_mirror_ids $file
+ echo "mirror IDs: ${mirror_array[@]}"
+
+ drop_client_cache
+ cmp $tmpfile $file || error "files don't match"
+ get_mirror_ids $file
+ echo "mirror IDs: ${mirror_array[@]}"
+
+ # mirror creation should work fine
+ $LFS mirror extend -N -S 8M -c -1 $file ||
+ error "mirror extend $file failed"
+
+ get_mirror_ids $file
+ echo "mirror IDs: ${mirror_array[@]}"
+
+ drop_client_cache
+ $LFS mirror verify -v $file || error "verification failed"
+ cmp $tmpfile $file || error "files don't match"
+}
+run_test 207 "create another replica with existing out-of-sync one"
+
complete $SECONDS
check_and_cleanup_lustre
exit_status