2 # -*- mode: Bash; tab-width: 4; indent-tabs-mode: t; -*-
3 # vim:shiftwidth=4:softtabstop=4:tabstop=4:
5 # Run select tests by setting ONLY, or as arguments to the script.
6 # Skip specific tests by setting EXCEPT.
8 # Run test by setting NOSETUP=true when ltest has setup env for us
11 export PATH=$PWD/$SRCDIR:$SRCDIR:$PWD/$SRCDIR/../utils:$PATH:/sbin
14 ALWAYS_EXCEPT="$OST_POOLS_EXCEPT"
15 # bug number for skipped test: -
16 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
18 [ "$ALWAYS_EXCEPT$EXCEPT" ] &&
19 echo "Skipping tests: $(echo $ALWAYS_EXCEPT $EXCEPT)"
24 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
25 . $LUSTRE/tests/test-framework.sh
27 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
30 check_and_setup_lustre
32 [ "$SLOW" = "no" ] && EXCEPT_SLOW="5b 18 22 23b 25"
39 MAXFREE=${MAXFREE:-$((2000000 * OSTCOUNT))}
43 POOL2=${POOL2:-${POOL}2}
44 POOL3=${POOL3:-${POOL}3}
45 NON_EXISTANT_POOL=nonexistantpool
46 NON_EXISTANT_FS=nonexistantfs
47 INVALID_POOL=some_invalid_pool_name
49 TGT_FIRST=$(printf %04x 0)
50 TGT_MAX=$(printf %04x $((TGT_COUNT-1)))
52 TGT_LIST=$(seq 0x$TGT_FIRST $TGT_STEP 0x$TGT_MAX)
53 TGT_LIST2=$(seq 0x$TGT_FIRST 2 0x$TGT_MAX)
55 TGT_ALL="$FSNAME-OST[$TGT_FIRST-$TGT_MAX/1]"
56 TGT_HALF="$FSNAME-OST[$TGT_FIRST-$TGT_MAX/2]"
58 TGT_UUID=$(for i in $TGT_LIST; do printf "$FSNAME-OST%04x_UUID " $i; done)
59 TGT_UUID2=$(for i in $TGT_LIST2; do printf "$FSNAME-OST%04x_UUID " $i; done)
64 local count=${3:-"-1"}
68 if [[ -n $idx ]]; then
69 $SETSTRIPE -c $count -p $pool -i $idx $dir
71 $SETSTRIPE -c $count -p $pool $dir
74 error "$SETSTRIPE -p $pool $dir failed."
80 local count=${3:-"-1"}
81 local index=${4:-"-1"}
83 $SETSTRIPE -i $index -c $count -p $pool $file
85 error "$SETSTRIPE -p $pool $file failed."
91 for i in $(do_facet $SINGLEMDS lctl pool_list $FSNAME.$pool |
92 grep -v "^Pool:" | sed -e 's/_UUID$//;s/^.*-OST//'); do
93 res="$res $(printf "%d" 0x$i)"
101 local res=$($GETSTRIPE $dir | grep "^stripe_count:" |
102 cut -d ':' -f 5 | tr -d "[:blank:]")
103 if [[ "$res" != "$pool" ]]; then
104 error found $res instead of $pool
111 check_file_in_pool() {
112 local osts=$(osts_in_pool $2)
113 check_file_in_osts $1 "$osts" $3
116 check_file_in_osts() {
118 local pool_list=${2:-$TGT_LIST}
120 local res=$($GETSTRIPE $file | grep 0x | cut -f2)
123 found=$(echo :$pool_list: | tr " " ":" | grep :$i:)
124 if [[ "$found" == "" ]]; then
125 echo "pool list: $pool_list"
126 echo "striping: $res"
128 error "$file not allocated from OSTs $pool_list."
133 local ost_count=$($GETSTRIPE $file | grep 0x | wc -l)
134 [[ -n "$count" ]] && [[ $ost_count -ne $count ]] &&
135 { error "Stripe count $count expected; got $ost_count" && return 1;}
141 $GETSTRIPE -v $1 | grep "^lmm_pool:" | tr -d "[:blank:]" | cut -f 2 -d ':'
144 check_file_not_in_pool() {
147 local res=$(file_pool $file)
149 if [[ "$res" == "$pool" ]]; then
150 error "File $file is in pool: $res"
157 check_dir_not_in_pool() {
160 local res=$($GETSTRIPE -v $dir | grep "^stripe_count" | head -n1 |
162 if [[ "$res" == "$pool" ]]; then
163 error "File $dir is in pool: $res"
171 wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$pool" "" ||
172 error "Failed to remove targets from pool: $pool"
178 local tgt="${3}$(lctl get_param -n lov.$FSNAME-*.pools.$pool |
179 sort -u | tr '\n' ' ')"
181 do_facet $SINGLEMDS lctl pool_add $FSNAME.$pool $osts
183 [[ $RC -ne 0 ]] && return $RC
185 wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$pool |
186 sort -u | tr '\n' ' ' " "$tgt" >/dev/null || RC=1
187 [[ $RC -ne 0 ]] && error "pool_add failed: $1; $2"
191 create_pool_nofail() {
192 create_pool $FSNAME.$1
193 if [[ $? != 0 ]]; then
194 error "Pool creation of $1 failed"
199 create_pool $FSNAME.$1
200 if [[ $? == 0 ]]; then
201 error "Pool creation of $1 succeeded; should have failed"
206 # Destroy pools from previous test runs
207 for p in $(do_facet $SINGLEMDS lctl pool_list $FSNAME | grep $POOL); do
210 rm -rf $DIR/d0.${TESTSUITE}
218 trap "cleanup_tests $FSNAME" EXIT
222 remote_mds_nodsh && skip "remote MDS with nodsh" && exit 0
223 remote_ost_nodsh && skip "remote OST with nodsh" && exit 0
227 # Tests for new commands added
233 run_test 1a "Create a pool with a 1 character pool name"
237 create_pool_nofail ${POOL}12
238 destroy_pool ${POOL}12
240 run_test 1b "Create a pool with a 10 char pool name"
244 create_pool_nofail ${POOL}1234567
245 destroy_pool ${POOL}1234567
247 run_test 1c "Create a pool with a 15 char pool name"
251 create_pool_fail ${POOL}12345678
253 run_test 1d "Create a pool with a 16 char pool name; should fail"
257 local pool_name="$POOL"
258 for ((i = 1; i <= 991; i++)); do pool_name=${pool_name}"o"; done
259 create_pool_fail $pool_name
261 run_test 1e "Create a pool with a 1000 char pool name; should fail"
265 do_facet $SINGLEMDS lctl pool_new .$POOL 2>/dev/null
267 error "pool_new did not fail even though fs-name was missing"
269 run_test 1f "pool_new should fail if fs-name is missing"
273 do_facet $SINGLEMDS lctl pool_new $POOL 2>/dev/null
275 error "pool_new did not fail even though fs-name was missing"
277 run_test 1g "pool_new should fail if fs-name is missing"
281 do_facet $SINGLEMDS lctl pool_new ${FSNAME}. 2>/dev/null
283 error "pool_new did not fail even though pool name was missing"
285 run_test 1h "pool_new should fail if poolname is missing"
289 do_facet $SINGLEMDS lctl pool_new . 2>/dev/null
291 error "pool_new did not fail even if pool and fs-name were missing"
293 run_test 1i "pool_new should fail if poolname and fs-name are missing"
297 do_facet $SINGLEMDS lctl pool_new ${FSNAME},$POOL 2>/dev/null
299 error "pool_new did not fail even though pool name format was wrong"
301 run_test 1j "pool_new should fail if poolname format is wrong"
305 do_facet $SINGLEMDS lctl pool_new ${FSNAME}/$POOL 2>/dev/null
307 error "pool_new did not fail even though pool name format was wrong"
309 run_test 1k "pool_new should fail if poolname format is wrong"
313 create_pool_nofail $POOL2
314 do_facet $SINGLEMDS lctl pool_new ${FSNAME}.$POOL2 2>/dev/null
316 error "pool_new did not fail even though $POOL2 existed"
319 run_test 1m "pool_new did not fail even though $POOL2 existed"
323 create_pool_nofail ${POOL}1234567
325 add_pool ${POOL}1234567 "OST0000" "$FSNAME-OST0000_UUID "
326 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
327 create_dir $POOL_ROOT ${POOL}1234567
328 dd if=/dev/zero of=$POOL_ROOT/file bs=1M count=100
329 RC=$?; [[ $RC -eq 0 ]] ||
330 error "failed to write to $POOL_ROOT/file: $RC"
331 do_facet $SINGLEMDS lctl pool_remove $FSNAME.${POOL}1234567 OST0000
332 drain_pool ${POOL}1234567
334 destroy_pool ${POOL}1234567
336 run_test 1n "Pool with a 15 char pool name works well"
342 do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL $FSNAME-OST0000 2>/dev/null
344 error "pool_add did not fail even though $POOL did not exist"
346 run_test 2a "pool_add: non-existant pool $POOL"
350 do_facet $SINGLEMDS lctl pool_add $FSNAME.${POOL}1234567890 \
351 $FSNAME-OST0000 2>/dev/null
353 error "pool_add did not fail even though pool name was invalid."
355 run_test 2b "pool_add: Invalid pool name"
357 # Testing various combinations of OST name list
363 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
364 [[ $? -ne 0 ]] || destroy_pool $POOL
366 create_pool_nofail $POOL
369 do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL OST0000
370 RC=$?; [[ $RC -eq 0 ]] ||
371 error "pool_add failed. $FSNAME $POOL OST0000: $RC"
372 do_facet $SINGLEMDS lctl pool_remove $FSNAME.$POOL OST0000
376 do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL $FSNAME-OST0000
377 RC=$?; [[ $RC -eq 0 ]] ||
378 error "pool_add failed. $FSNAME $POOL $FSNAME-OST0000: $RC"
379 do_facet $SINGLEMDS lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000
382 # 3. $FSNAME-OST0000_UUID
383 do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL $FSNAME-OST0000_UUID
384 RC=$?; [[ $RC -eq 0 ]] ||
385 error "pool_add failed. $FSNAME $POOL $FSNAME-OST0000_UUID: $RC"
386 do_facet $SINGLEMDS lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000_UUID
389 # 4. $FSNAME-OST[0,1,2,3,]
391 for i in $TGT_LIST; do TGT=${TGT}$(printf "%04x," $i); done
393 do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL $TGT
394 [[ $? -eq 0 ]] || error "pool_add failed. $FSNAME.$POOL $TGT. $RC"
395 do_facet $SINGLEMDS lctl pool_remove $FSNAME.$POOL $TGT
398 # 5. $FSNAME-OST[0-5/1]
399 do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL $TGT_ALL
400 RC=$?; [[ $RC -eq 0 ]] ||
401 error "pool_add failed. $FSNAME $POOL" "$TGT_ALL $RC"
402 wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$POOL |
403 sort -u | tr '\n' ' ' " "$TGT_UUID" || error "Add to pool failed"
404 do_facet $SINGLEMDS lctl pool_remove $FSNAME.$POOL $TGT_ALL
409 run_test 2c "pool_add: OST index combinations"
416 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
417 [[ $? -ne 0 ]] || destroy_pool $POOL
419 create_pool_nofail $POOL
421 TGT=$(printf "$FSNAME-OST%04x_UUID " $OSTCOUNT)
422 do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL $TGT
423 RC=$?; [[ $RC -ne 0 ]] ||
424 error "pool_add succeeded for an OST ($TGT) that does not exist."
428 run_test 2d "pool_add: OSTs that don't exist should be rejected"
436 $LCTL get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
437 [[ $? -ne 0 ]] || destroy_pool $POOL
439 create_pool_nofail $POOL
441 TGT="$FSNAME-OST0000_UUID "
442 do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL $TGT
443 wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$POOL |
444 sort -u | tr '\n' ' ' " "$TGT" || error "Add to pool failed"
445 RESULT=$(do_facet $SINGLEMDS \
446 "LOCALE=C $LCTL pool_add $FSNAME.$POOL $TGT 2>&1")
451 error "pool_add succeeded for an OST that was already in the pool."
453 [[ $(grep "already in pool" <<< $RESULT) ]] ||
454 error "pool_add failed as expected but error message not as expected."
458 run_test 2e "pool_add: OST already in a pool should be rejected"
462 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
463 [[ $? -ne 0 ]] || destroy_pool $POOL
465 do_facet $SINGLEMDS \
466 lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000 2>/dev/null
468 error "pool_remove did not fail even though pool did not exist."
470 run_test 3a "pool_remove: non-existant pool"
474 do_facet $SINGLEMDS \
475 lctl pool_remove ${NON_EXISTANT_FS}.$POOL OST0000 2>/dev/null
477 error "pool_remove did not fail even though fsname did not exist."
479 run_test 3b "pool_remove: non-existant fsname"
483 do_facet $SINGLEMDS lctl pool_remove $FSNAME.p1234567891234567890 \
484 $FSNAME-OST0000 2>/dev/null
486 error "pool_remove did not fail even though pool name was invalid."
488 run_test 3c "pool_remove: Invalid pool name"
490 # Testing various combinations of OST name list
493 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
494 [[ $? -ne 0 ]] || destroy_pool $POOL
496 create_pool_nofail $POOL
497 do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL OST0000
498 do_facet $SINGLEMDS lctl pool_remove $FSNAME.$POOL OST0000
499 [[ $? -eq 0 ]] || error "pool_remove failed. $FSNAME $POOL OST0000"
502 do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL $FSNAME-OST0000
503 do_facet $SINGLEMDS lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000
504 [[ $? -eq 0 ]] || error "pool_remove failed. $FSNAME $POOL $FSNAME-OST0000"
507 do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL $FSNAME-OST0000_UUID
508 do_facet $SINGLEMDS lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000_UUID
510 error "pool_remove failed. $FSNAME $POOL $FSNAME-OST0000_UUID"
513 add_pool $POOL $TGT_ALL "$TGT_UUID"
514 do_facet $SINGLEMDS lctl pool_remove $FSNAME.$POOL $TGT_ALL
515 [[ $? -eq 0 ]] || error "pool_remove failed. $FSNAME $POOL" $TGT_ALL
520 run_test 3d "pool_remove: OST index combinations"
524 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
525 [[ $? -ne 0 ]] || destroy_pool $POOL
527 do_facet $SINGLEMDS lctl pool_destroy $FSNAME.$POOL 2>/dev/null
529 error "pool_destroy did not fail even though pool did not exist."
531 run_test 4a "pool_destroy: non-existant pool"
535 do_facet $SINGLEMDS lctl pool_destroy ${NON_EXISTANT_FS}.$POOL 2>/dev/null
537 error "pool_destroy did not fail even though filesystem did not exist."
539 run_test 4b "pool_destroy: non-existant fs-name"
543 create_pool_nofail $POOL
544 add_pool $POOL "OST0000" "$FSNAME-OST0000_UUID "
546 do_facet $SINGLEMDS lctl pool_destroy ${FSNAME}.$POOL
547 [[ $? -ne 0 ]] || error "pool_destroy succeeded with a non-empty pool."
550 run_test 4c "pool_destroy: non-empty pool"
555 $LCMD pool_list 2>/dev/null
556 [[ $? -ne 0 ]] || error "pool_list did not fail even though fsname missing."
558 destroy_pool $POOL 2>/dev/null
559 destroy_pool $POOL2 2>/dev/null
561 create_pool_nofail $POOL
562 create_pool_nofail $POOL2
563 $LCMD pool_list $FSNAME
564 [[ $? -eq 0 ]] || error "pool_list $FSNAME failed."
566 do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL $TGT_ALL
568 $LCMD pool_list $FSNAME.$POOL
569 [[ $? -eq 0 ]] || error "pool_list $FSNAME.$POOL failed."
571 $LCMD pool_list ${NON_EXISTANT_FS} 2>/dev/null
572 [[ $? -ne 0 ]] || error "pool_list did not fail for fsname $NON_EXISTANT_FS"
574 $LCMD pool_list ${FSNAME}.$NON_EXISTANT_POOL 2>/dev/null
575 [[ $? -ne 0 ]] || error "pool_list did not fail for pool $NON_EXISTANT_POOL"
577 if [[ ! $(grep $SINGLEMDS <<< $LCMD) ]]; then
578 echo $LCMD pool_list $DIR
580 [[ $? -eq 0 ]] || error "pool_list failed for $DIR"
583 $LCMD pool_list ${DIR}/d1
584 [[ $? -eq 0 ]] || error "pool_list failed for ${DIR}/d1"
587 rm -rf ${DIR}nonexistant
588 $LCMD pool_list ${DIR}nonexistant 2>/dev/null
590 error "pool_list did not fail for invalid mountpoint ${DIR}nonexistant"
598 # Issue commands from client
601 run_test 5a "lfs pool_list from client"
605 sub_test_5 "do_facet $SINGLEMDS lctl"
607 run_test 5b "lctl pool_list from MDS"
611 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
612 local POOL_DIR=$POOL_ROOT/dir_tst
613 local POOL_FILE=$POOL_ROOT/file_tst
615 create_pool_nofail $POOL
617 do_facet $SINGLEMDS lctl pool_list $FSNAME
618 [[ $? -eq 0 ]] || error "pool_list $FSNAME failed."
620 add_pool $POOL $TGT_ALL "$TGT_UUID"
623 $SETSTRIPE -c -1 -p $POOL $POOL_DIR
624 [[ $? -eq 0 ]] || error "$SETSTRIPE -p $POOL failed."
625 check_dir_in_pool $POOL_DIR $POOL
627 # If an invalid pool name is specified, the command should fail
628 $SETSTRIPE -c 2 -p $INVALID_POOL $POOL_DIR 2>/dev/null
629 [[ $? -ne 0 ]] || error "setstripe to invalid pool did not fail."
631 # If the pool name does not exist, the command should fail
632 $SETSTRIPE -c 2 -p $NON_EXISTANT_POOL $POOL_DIR 2>/dev/null
633 [[ $? -ne 0 ]] || error "setstripe to non-existant pool did not fail."
635 # lfs setstripe should work as before if a pool name is not specified.
636 $SETSTRIPE -c -1 $POOL_DIR
637 [[ $? -eq 0 ]] || error "$SETSTRIPE -p $POOL_DIR failed."
638 $SETSTRIPE -c -1 $POOL_FILE
639 [[ $? -eq 0 ]] || error "$SETSTRIPE -p $POOL_FILE failed."
641 # lfs setstripe should fail if a start index that is outside the
643 create_pool_nofail $POOL2
644 add_pool $POOL2 "OST0000" "$FSNAME-OST0000_UUID "
645 $SETSTRIPE -i 1 -p $POOL2 $ROOT_POOL/$tfile 2>/dev/null
647 error "$SETSTRIPE with start index outside the pool did not fail."
650 run_test 6 "getstripe/setstripe"
654 # Create a pool, stripe a directory and file with it
657 pool_add $pool || error "pool_add failed"
658 pool_add_targets $pool 0 1 || error "pool_add_targets failed"
660 $SETSTRIPE -c 1 $DIR/$tdir/testfile1 --pool "$pool" || \
661 error "setstripe failed"
662 $SETSTRIPE -c 1 $DIR/$tdir/testfile2 --pool "$FSNAME.$pool" || \
663 error "setstripe failed"
665 mkdir $DIR/$tdir/testdir
666 $SETSTRIPE -c 1 $DIR/$tdir/testdir -p "$pool" || \
667 error "setstripe failed"
668 $SETSTRIPE -c 1 $DIR/$tdir/testdir -p "$FSNAME.$pool" || \
669 error "setstripe failed"
671 rm -f $DIR/$tdir/testfile1
672 rm -f $DIR/$tdir/testfile2
673 rmdir $DIR/$tdir/testdir
675 destroy_pool_int $FSNAME.$pool
680 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
684 # Generate pool with random name from 1 to 15 characters
686 POOLNAME=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w $i |
688 echo set poolname to $POOLNAME
689 helper_test_7a $POOLNAME
692 run_test 7a "create various pool name"
697 do_facet mgs lctl pool_new qwerty
698 [ $? -ne 22 ] && error "can create a pool with no fsname"
701 do_facet mgs lctl pool_new $FSNAME.
702 [ $? -ne 22 ] && error "can create a pool with no name"
705 do_facet mgs lctl pool_new $FSNAME.0123456789^bdef
706 [ $? -ne 22 ] && error "can create a pool with an invalid name"
709 do_facet mgs lctl pool_new $FSNAME.0123456789abdefg
710 [ $? -ne 36 ] && error "can create a pool with a name too long"
714 run_test 7b "try to create pool name with invalid lengths or names"
718 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
722 # Create a pool with 15 letters
723 local pool=0123456789abcde
724 pool_add $pool || error "pool_add failed"
725 pool_add_targets $pool 0 1 || error "pool_add_targets failed"
727 # setstripe with the same pool name plus 1 letter
728 $SETSTRIPE -c 1 $DIR/$tdir/testfile1 --pool "${pool}X" && \
729 error "setstripe succedeed"
731 # setstripe with the same pool name minus 1 letter
732 $SETSTRIPE -c 1 $DIR/$tdir/testfile1 --pool "${pool%?}" && \
733 error "setstripe succedeed"
735 rm -f $DIR/$tdir/testfile1
737 destroy_pool_int $FSNAME.$pool
739 run_test 7c "create a valid pool name and setstripe with a bad one"
743 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
745 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return
747 create_pool_nofail $POOL
748 create_pool_nofail $POOL2
750 local start=$(printf %04x $((TGT_FIRST + 1)))
751 do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL2 \
752 $FSNAME-OST[$start-$TGT_MAX/2]
754 add_pool $POOL $TGT_HALF "$TGT_UUID2"
756 create_dir $POOL_ROOT/dir1 $POOL
757 create_dir $POOL_ROOT/dir2 $POOL2
758 check_dir_in_pool $POOL_ROOT/dir1 $POOL
759 check_dir_in_pool $POOL_ROOT/dir1 $POOL
762 createmany -o $POOL_ROOT/dir1/$tfile $numfiles ||
763 error "createmany $POOL_ROOT/dir1/$tfile failed!"
765 for file in $POOL_ROOT/dir1/*; do
766 check_file_in_pool $file $POOL
769 createmany -o $POOL_ROOT/dir2/$tfile $numfiles ||
770 error "createmany $POOL_ROOT/dir2/$tfile failed!"
771 for file in $POOL_ROOT/dir2/*; do
772 check_file_in_pool $file $POOL2
775 rm -rf $POOL_ROOT/dir?
779 run_test 11 "OSTs in overlapping/multiple pools"
783 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
785 [[ $OSTCOUNT -le 2 ]] && skip_env "Need at least 3 OSTs" && return
787 create_pool_nofail $POOL
788 create_pool_nofail $POOL2
790 local start=$(printf %04x $((TGT_FIRST + 1)))
791 do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL2 \
792 $FSNAME-OST[$start-$TGT_MAX/2]
794 add_pool $POOL $TGT_HALF "$TGT_UUID2"
796 echo creating some files in $POOL and $POOL2
798 create_dir $POOL_ROOT/dir1 $POOL
799 create_dir $POOL_ROOT/dir2 $POOL2
800 create_file $POOL_ROOT/file1 $POOL
801 create_file $POOL_ROOT/file2 $POOL2
803 echo Checking the files created
804 check_dir_in_pool $POOL_ROOT/dir1 $POOL
805 check_dir_in_pool $POOL_ROOT/dir2 $POOL2
806 check_file_in_pool $POOL_ROOT/file1 $POOL
807 check_file_in_pool $POOL_ROOT/file2 $POOL2
809 echo Changing the pool membership
810 do_facet $SINGLEMDS lctl pool_remove $FSNAME.$POOL $FSNAME-OST[$TGT_FIRST]
811 do_facet $SINGLEMDS lctl pool_list $FSNAME.$POOL
812 FIRST_UUID=$(echo $TGT_UUID | awk '{print $1}')
813 add_pool $POOL2 $FSNAME-OST[$TGT_FIRST] "$FIRST_UUID "
814 do_facet $SINGLEMDS lctl pool_list $FSNAME.$POOL2
816 echo Checking the files again
817 check_dir_in_pool $POOL_ROOT/dir1 $POOL
818 check_dir_in_pool $POOL_ROOT/dir2 $POOL2
819 check_file_in_osts $POOL_ROOT/file1 "$TGT_LIST2"
820 check_file_in_osts $POOL_ROOT/file2 "$(seq 0x$start 2 0x$TGT_MAX)"
822 echo Creating some more files
823 create_dir $POOL_ROOT/dir3 $POOL
824 create_dir $POOL_ROOT/dir4 $POOL2
825 create_file $POOL_ROOT/file3 $POOL
826 create_file $POOL_ROOT/file4 $POOL2
828 echo Checking the new files
829 check_file_in_pool $POOL_ROOT/file3 $POOL
830 check_file_in_pool $POOL_ROOT/file4 $POOL2
834 run_test 12 "OST Pool Membership"
838 [[ $OSTCOUNT -le 2 ]] && skip_env "Need at least 3 OSTs" && return
840 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
844 create_pool_nofail $POOL
845 add_pool $POOL $TGT_ALL "$TGT_UUID"
847 create_dir $POOL_ROOT/dir1 $POOL -1
848 createmany -o $POOL_ROOT/dir1/$tfile $numfiles ||
849 error "createmany $POOL_ROOT/dir1/$tfile failed!"
850 for file in $POOL_ROOT/dir1/*; do
851 check_file_in_pool $file $POOL $OSTCOUNT
854 create_file $POOL_ROOT/dir1/file1 $POOL 1 $TGT_FIRST
855 create_file $POOL_ROOT/dir1/file2 $POOL 1 $((TGT_FIRST + 1))
856 create_file $POOL_ROOT/dir1/file3 $POOL 1 $((TGT_FIRST + 2))
857 check_file_in_pool $POOL_ROOT/dir1/file1 $POOL 1
858 check_file_in_pool $POOL_ROOT/dir1/file2 $POOL 1
859 create_file $POOL_ROOT/dir1/file3 $POOL 1 $((TGT_FIRST + 2))
860 check_file_in_osts $POOL_ROOT/dir1/file1 $((16#$TGT_FIRST))
861 check_file_in_osts $POOL_ROOT/dir1/file2 "$((TGT_FIRST + 1))"
862 check_file_in_osts $POOL_ROOT/dir1/file3 "$((TGT_FIRST + 2))"
864 create_dir $POOL_ROOT/dir2 $POOL $count
865 createmany -o $POOL_ROOT/dir2/$tfile- $numfiles ||
866 error "createmany $POOL_ROOT/dir2/$tfile- failed!"
867 for file in $POOL_ROOT/dir2/*; do
868 check_file_in_pool $file $POOL $count
871 create_dir $POOL_ROOT/dir3 $POOL $count $((TGT_FIRST + 1))
872 createmany -o $POOL_ROOT/dir3/$tfile- $numfiles ||
873 error "createmany $POOL_ROOT/dir3/$tfile- failed!"
874 for file in $POOL_ROOT/dir3/*; do
875 check_file_in_pool $file $POOL $count
878 create_dir $POOL_ROOT/dir4 $POOL 1
879 createmany -o $POOL_ROOT/dir4/$tfile- $numfiles ||
880 error "createmany $POOL_ROOT/dir4/$tfile- failed!"
881 for file in $POOL_ROOT/dir4/*; do
882 check_file_in_pool $file $POOL 1
885 create_dir $POOL_ROOT/dir5 $POOL 1 $((TGT_FIRST + 2))
886 createmany -o $POOL_ROOT/dir5/$tfile- $numfiles ||
887 error "createmany $POOL_ROOT/dir5/$tfile- failed!"
888 for file in $POOL_ROOT/dir5/*; do
889 check_file_in_pool $file $POOL 1
890 check_file_in_osts $file "$((TGT_FIRST + 2))"
893 rm -rf $POOL_ROOT/dir[1-5]/
897 run_test 13 "Striping characteristics in a pool"
901 [[ $OSTCOUNT -le 2 ]] && skip_env "Need at least 3 OSTs" && return
903 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
907 [ $OSTSIZE -gt $((MAXFREE / OSTCOUNT)) ] &&
908 skip_env "OST size $OSTSIZE is larger than $((MAXFREE / OSTCOUNT))" &&
911 create_pool_nofail $POOL
912 create_pool_nofail $POOL2
914 add_pool $POOL $TGT_HALF "$TGT_UUID2"
915 add_pool $POOL2 "OST0000" "$FSNAME-OST0000_UUID "
917 create_dir $POOL_ROOT/dir1 $POOL 1
918 create_file $POOL_ROOT/dir1/file $POOL 1
919 local OST=$($GETSTRIPE -i $POOL_ROOT/dir1/file)
921 while [[ $i -lt $numfiles ]]; do
923 [[ $OST -gt $((16#$TGT_MAX)) ]] && OST=$TGT_FIRST
925 # echo "Iteration: $i OST: $OST"
926 create_file $POOL_ROOT/dir1/file${i} $POOL 1
927 check_file_in_pool $POOL_ROOT/dir1/file${i} $POOL
931 # Fill up OST0 until it is nearly full.
932 # Create 9 files of size OST0_SIZE/10 each.
933 create_dir $POOL_ROOT/dir2 $POOL2 1
934 $LFS df $POOL_ROOT/dir2
935 OST0_SIZE=$($LFS df $POOL_ROOT/dir2 | awk '/\[OST:0\]/ { print $4 }')
936 FILE_SIZE=$((OST0_SIZE/1024/10))
937 echo "Filling OST0 with 9 files of ${FILE_SIZE}MB in $POOL_ROOT/dir2"
939 while [[ $i -lt 10 ]]; do
940 dd if=/dev/zero of=$POOL_ROOT/dir2/f${i} bs=1M count=$FILE_SIZE
943 sleep 1 # get new statfs info
944 $LFS df $POOL_ROOT/dir2
946 # OST $TGT_FIRST is no longer favored; but it may still be used.
947 create_dir $POOL_ROOT/dir3 $POOL 1
948 create_file $POOL_ROOT/dir3/file $POOL 1
949 createmany -o $POOL_ROOT/dir3/$tfile- $numfiles ||
950 error "createmany $POOL_ROOT/dir3/$tfile- failed!"
951 for file in $POOL_ROOT/dir3/*; do
952 check_file_in_pool $file $POOL
959 run_test 14 "Round robin and QOS striping within a pool"
963 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
967 while [[ $i -lt $OSTCOUNT ]]; do
968 create_pool_nofail $POOL${i}
970 local tgt=$(printf "$FSNAME-OST%04x_UUID " $i)
971 add_pool $POOL${i} "$FSNAME-OST[$(printf %04x $i)]" "$tgt"
972 create_dir $POOL_ROOT/dir${i} $POOL${i}
973 createmany -o $POOL_ROOT/dir$i/$tfile $numfiles ||
974 error "createmany $POOL_ROOT/dir$i/$tfile failed!"
976 for file in $POOL_ROOT/dir$i/*; do
977 check_file_in_osts $file $i
985 run_test 15 "One directory per OST/pool"
989 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
993 create_pool_nofail $POOL
995 add_pool $POOL $TGT_HALF "$TGT_UUID2"
997 local dir=$POOL_ROOT/$tdir
998 create_dir $dir $POOL
1000 for i in $(seq 1 10); do
1005 createmany -o $dir/$tfile $numfiles ||
1006 error "createmany $dir/$tfile failed!"
1008 for file in $dir/*; do
1009 check_file_in_pool $file $POOL
1012 rm -rf $POOL_ROOT/$tdir
1016 run_test 16 "Inheritance of pool properties"
1020 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1024 create_pool_nofail $POOL
1026 add_pool $POOL $TGT_ALL "$TGT_UUID"
1028 local dir=$POOL_ROOT/dir
1029 create_dir $dir $POOL
1031 createmany -o $dir/${tfile}1_ $numfiles ||
1032 error "createmany $dir/${tfile}1_ failed!"
1034 for file in $dir/*; do
1035 check_file_in_pool $file $POOL
1040 createmany -o $dir/${tfile}2_ $numfiles ||
1041 error "createmany $dir/${tfile}2_ failed!"
1046 run_test 17 "Referencing an empty pool"
1055 wait_delete_completed >/dev/null # give pending IO a chance to go to disk
1056 stat=$(createmany -o $cdir/${tfile} -$numsec | tail -1)
1057 files=$(echo $stat | cut -f 2 -d ' ')
1059 unlinkmany $cdir/${tfile} $files > /dev/null
1067 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1070 local plaindir=$POOL_ROOT/plaindir
1071 local pooldir=$POOL_ROOT/pooldir
1077 for i in $(seq 1 $iter); do
1078 echo "Create performance, iteration $i, $numsec seconds x 3"
1080 files1=$(create_perf $plaindir $numsec)
1081 echo "iter $i: $files1 creates without pool"
1082 f1=$(($f1 + $files1))
1084 create_pool_nofail $POOL > /dev/null
1085 add_pool $POOL $TGT_ALL "$TGT_UUID" > /dev/null
1086 create_dir $pooldir $POOL
1087 files2=$(create_perf $pooldir $numsec)
1088 echo "iter $i: $files2 creates with pool"
1089 f2=$(($f2 + $files2))
1091 destroy_pool $POOL > /dev/null
1092 files3=$(create_perf $pooldir $numsec)
1093 echo "iter $i: $files3 creates with missing pool"
1094 f3=$(($f3 + $files3))
1099 echo Avg files created in $numsec seconds without pool: $((files1 / iter))
1100 echo Avg files created in $numsec seconds with pool: $((files2 / iter))
1101 echo Avg files created in $numsec seconds missing pool: $((files3 / iter))
1103 # Set this high until we establish a baseline for what the degradation
1106 diff=$((($files1 - $files2) * 100 / $files1))
1107 echo "No pool / wide pool: $diff %."
1108 [ $diff -gt $max ] &&
1109 error_ignore bz23408 "Degradation with wide pool is $diff% > $max%"
1112 diff=$((($files1 - $files3) * 100 / $files1))
1113 echo "No pool / missing pool: $diff %."
1114 [ $diff -gt $max ] &&
1115 error_ignore bz23408 "Degradation with wide pool is $diff% > $max%"
1119 run_test 18 "File create in a directory which references a deleted pool"
1123 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1125 local dir1=$POOL_ROOT/dir1
1126 local dir2=$POOL_ROOT/dir2
1129 create_pool_nofail $POOL
1131 add_pool $POOL $TGT_HALF "$TGT_UUID2"
1133 create_dir $dir1 $POOL
1134 createmany -o $dir1/${tfile} $numfiles ||
1135 error "createmany $dir1/${tfile} failed!"
1136 for file in $dir1/*; do
1137 check_file_in_pool $file $POOL
1141 createmany -o $dir2/${tfile} $numfiles ||
1142 error "createmany $dir2/${tfile} failed!"
1143 for file in $dir2/*; do
1144 check_file_not_in_pool $file $POOL
1151 run_test 19 "Pools should not come into play when not specified"
1155 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1157 local dir1=$POOL_ROOT/dir1
1158 local dir2=$dir1/dir2
1159 local dir3=$dir1/dir3
1163 create_pool_nofail $POOL
1164 create_pool_nofail $POOL2
1166 add_pool $POOL $TGT_HALF "$TGT_UUID2"
1168 local start=$(printf %04x $((TGT_FIRST + 1)))
1169 TGT=$(for i in $(seq 0x$start 2 0x$TGT_MAX); do \
1170 printf "$FSNAME-OST%04x_UUID " $i; done)
1171 add_pool $POOL2 "$FSNAME-OST[$start-$TGT_MAX/2]" "$TGT"
1173 create_dir $dir1 $POOL
1174 create_file $dir1/file1 $POOL2
1175 create_dir $dir2 $POOL2
1178 $SETSTRIPE -c 1 $dir3 # No pool assignment
1180 $SETSTRIPE -c 1 $dir2/file4 # No pool assignment
1182 check_file_in_pool $dir1/file1 $POOL2
1183 check_file_in_pool $dir2/file2 $POOL2
1185 check_dir_not_in_pool $dir3 $POOL
1186 check_dir_not_in_pool $dir3 $POOL2
1188 check_file_not_in_pool $dir3/file3 $POOL
1189 check_file_not_in_pool $dir3/file3 $POOL2
1191 check_file_not_in_pool $dir2/file4 $POOL
1192 check_file_not_in_pool $dir2/file4 $POOL2
1198 run_test 20 "Different pools in a directory hierarchy."
1202 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1203 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return
1207 local dir=$POOL_ROOT/dir
1209 create_pool_nofail $POOL
1211 add_pool $POOL $TGT_HALF "$TGT_UUID2"
1213 create_dir $dir $POOL $OSTCOUNT
1214 create_file $dir/file1 $POOL $OSTCOUNT
1215 $GETSTRIPE -v $dir/file1
1216 check_file_in_pool $dir/file1 $POOL
1222 run_test 21 "OST pool with fewer OSTs than stripe count"
1230 for c in $(seq 1 10); do
1231 echo "Pool $pool, iteration $c"
1232 do_facet $SINGLEMDS lctl pool_add $FSNAME.$pool \
1233 OST[$TGT_FIRST-$TGT_MAX/$step] 2>/dev/null
1234 local TGT_SECOND=$(printf %04x $((TGT_FIRST + $step)))
1235 if [ $((16#$TGT_SECOND)) -le $((16#$TGT_MAX)) ]; then
1236 do_facet $SINGLEMDS lctl pool_remove $FSNAME.$pool \
1237 OST[$TGT_SECOND-$TGT_MAX/$step]
1240 echo loop for $pool complete
1245 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1246 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return
1250 create_pool_nofail $POOL
1251 add_pool $POOL "OST0000" "$FSNAME-OST0000_UUID "
1252 create_pool_nofail $POOL2
1253 add_pool $POOL2 "OST0000" "$FSNAME-OST0000_UUID "
1258 create_dir $POOL_ROOT $POOL
1259 createmany -o $POOL_ROOT/${tfile} $numfiles ||
1260 error "createmany $POOL_ROOT/${tfile} failed!"
1265 run_test 22 "Simultaneous manipulation of a pool"
1269 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1270 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return
1273 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS || {
1274 skip_env "User $RUNAS_ID does not exist - skipping"
1280 local BUNIT_SZ=1024 # min block quota unit(kB)
1281 local LIMIT=$((BUNIT_SZ * (OSTCOUNT + 1)))
1282 local dir=$POOL_ROOT/dir
1283 local file="$dir/$tfile-quota"
1285 create_pool_nofail $POOL
1287 local TGT=$(for i in $(seq 0x$TGT_FIRST 3 0x$TGT_MAX); do \
1288 printf "$FSNAME-OST%04x_UUID " $i; done)
1289 add_pool $POOL "$FSNAME-OST[$TGT_FIRST-$TGT_MAX/3]" "$TGT"
1290 create_dir $dir $POOL
1292 # XXX remove the interoperability code once we drop the old server
1293 # ( < 2.3.50) support.
1294 if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.50) ]; then
1295 $LFS quotaoff -ug $MOUNT
1296 $LFS quotacheck -ug $MOUNT
1298 do_facet mgs $LCTL conf_param $FSNAME.quota.ost=ug
1302 $LFS setquota -u $RUNAS_ID -b $LIMIT -B $LIMIT $dir
1304 $LFS quota -v -u $RUNAS_ID $dir
1306 $SETSTRIPE -c 1 -p $POOL $file
1307 chown $RUNAS_ID.$RUNAS_GID $file
1310 # This does two "dd" runs to ensure that the quota failure is returned
1311 # to userspace when we check. The first "dd" might otherwise complete
1312 # without error if it is only writing into cache.
1313 stat=$(LOCALE=C $RUNAS dd if=/dev/zero of=$file bs=$BUNIT_SZ \
1314 count=$((BUNIT_SZ*2)) 2>&1)
1315 echo $stat | grep "Disk quota exceeded" > /dev/null
1316 if [ $? -eq 0 ]; then
1317 $LFS quota -v -u $RUNAS_ID $dir
1318 cancel_lru_locks osc
1319 stat=$(LOCALE=C $RUNAS dd if=/dev/zero of=$file bs=$BUNIT_SZ \
1320 count=$BUNIT_SZ seek=$((BUNIT_SZ*2)) 2>&1)
1323 [[ $RC -eq 0 ]] && error "second dd did not fail."
1324 echo $stat | grep "Disk quota exceeded" > /dev/null
1325 [[ $? -eq 1 ]] && error "second dd did not fail with EDQUOT."
1327 log "first dd failed with EDQUOT."
1329 $LFS quota -v -u $RUNAS_ID $dir
1331 run_test 23a "OST pools and quota"
1335 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1336 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return 0
1339 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS || {
1340 skip_env "User $RUNAS_ID does not exist - skipping"
1346 local dir=$POOL_ROOT/dir
1347 local file="$dir/$tfile-quota"
1349 create_pool_nofail $POOL
1351 local TGT=$(for i in $(seq 0x$TGT_FIRST 3 0x$TGT_MAX); do \
1352 printf "$FSNAME-OST%04x_UUID " $i; done)
1353 add_pool $POOL "$FSNAME-OST[$TGT_FIRST-$TGT_MAX/3]" "$TGT"
1354 create_dir $dir $POOL
1356 local maxfree=$((1024 * 1024 * 30)) # 30G
1357 local AVAIL=$(lfs_df -p $POOL $dir | awk '/summary/ { print $4 }')
1358 [ $AVAIL -gt $maxfree ] &&
1359 skip_env "Filesystem space $AVAIL is larger than " \
1360 "$maxfree limit" && return 0
1362 echo "OSTCOUNT=$OSTCOUNT, OSTSIZE=$OSTSIZE, AVAIL=$AVAIL"
1363 echo "MAXFREE=$maxfree, SLOW=$SLOW"
1365 # XXX remove the interoperability code once we drop the old server
1366 # ( < 2.3.50) support.
1367 if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.50) ]; then
1368 $LFS quotaoff -ug $MOUNT
1370 do_facet mgs $LCTL conf_param $FSNAME.quota.ost=none
1374 chown $RUNAS_ID.$RUNAS_ID $dir
1378 local stime=$(date +%s)
1382 local maxtime=300 # minimum speed: 5GB / 300sec ~= 17MB/s
1383 while [ $RC -eq 0 ]; do
1385 stat=$(LOCALE=C $RUNAS2 dd if=/dev/zero of=${file}$i bs=1M \
1386 count=$((5 * 1024)) 2>&1)
1388 TOTAL=$((TOTAL + 1024 * 1024 * 5))
1389 echo "[$i iteration] $stat"
1390 echo "total written: $TOTAL"
1393 elapsed=$((etime - stime))
1394 echo "stime=$stime, etime=$etime, elapsed=$elapsed"
1396 if [ $RC -eq 1 ]; then
1397 echo $stat | grep -q "Disk quota exceeded"
1399 error "dd failed with EDQUOT with quota off"
1401 echo $stat | grep -q "No space left on device"
1403 error "dd did not fail with ENOSPC"
1404 elif [ $TOTAL -gt $AVAIL ]; then
1405 error "dd didn't fail with ENOSPC ($TOTAL > $AVAIL)"
1406 elif [ $i -eq 1 -a $elapsed -gt $maxtime ]; then
1407 log "The first 5G write used $elapsed (> $maxtime) " \
1408 "seconds, terminated"
1416 run_test 23b "OST pools and OOS"
1420 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1421 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return
1429 create_pool_nofail $POOL
1431 add_pool $POOL $TGT_ALL "$TGT_UUID"
1433 create_dir $POOL_ROOT/dir1 $POOL $OSTCOUNT
1435 mkdir $POOL_ROOT/dir2
1436 $SETSTRIPE -p $POOL -S 65536 -i 0 -c 1 $POOL_ROOT/dir2 ||
1437 error "$SETSTRIPE $POOL_ROOT/dir2 failed"
1439 mkdir $POOL_ROOT/dir3
1440 $SETSTRIPE -S 65536 -i 0 -c 1 $POOL_ROOT/dir3 ||
1441 error "$SETSTRIPE $POOL_ROOT/dir3 failed"
1443 mkdir $POOL_ROOT/dir4
1445 for i in 1 2 3 4; do
1446 dir=${POOL_ROOT}/dir${i}
1455 createmany -o $dir/${tfile} $numfiles ||
1456 error "createmany $dir/${tfile} failed!"
1457 res=$($GETSTRIPE -v $dir | grep "^stripe_count:")
1458 if [ $? -ne 0 ]; then
1459 res=$($GETSTRIPE -v $dir | grep "^(Default) ")
1460 pool=$(cut -f 9 -d ' ' <<< $res)
1461 index=$(cut -f 7 -d ' ' <<< $res)
1462 size=$(cut -f 5 -d ' ' <<< $res)
1463 count=$(cut -f 3 -d ' ' <<< $res)
1465 pool=$(cut -f 8 -d ' ' <<< $res)
1466 index=$(cut -f 6 -d ' ' <<< $res)
1467 size=$(cut -f 4 -d ' ' <<< $res)
1468 count=$(cut -f 2 -d ' ' <<< $res)
1471 for file in $dir/*; do
1472 if [ "$pool" != "" ]; then
1473 check_file_in_pool $file $pool
1475 pool1=$(file_pool $file)
1476 count1=$($GETSTRIPE -v $file | grep "^lmm_stripe_count:" |
1477 tr -d '[:blank:]' | cut -f 2 -d ':')
1478 size1=$($GETSTRIPE -v $file | grep "^lmm_stripe_size:" |
1479 tr -d '[:blank:]' | cut -f 2 -d ':')
1480 [[ "$pool" != "$pool1" ]] &&
1481 error "Pool name ($pool) not inherited in $file($pool1)"
1482 [[ "$count" != "$count1" ]] &&
1483 error "Stripe count ($count) not inherited in $file ($count1)"
1484 [[ "$size" != "$size1" ]] && [[ "$size" != "0" ]] &&
1485 error "Stripe size ($size) not inherited in $file ($size1)"
1493 run_test 24 "Independence of pool from other setstripe parameters"
1497 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1501 for i in $(seq 10); do
1502 create_pool_nofail $POOL$i
1503 do_facet $SINGLEMDS "lctl pool_add $FSNAME.$POOL$i OST0000; sync"
1504 wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$POOL$i |
1505 sort -u | tr '\n' ' ' " "$FSNAME-OST0000_UUID " >/dev/null ||
1506 error "pool_add failed: $1; $2"
1508 facet_failover $SINGLEMDS || error "failed to failover $SINGLEMDS"
1509 wait_osc_import_state $SINGLEMDS ost FULL
1513 # Veriy that the pool got created and is usable
1514 df $POOL_ROOT > /dev/null
1516 # Make sure OST0 can be striped on
1517 $SETSTRIPE -i 0 -c 1 $POOL_ROOT/$tfile
1518 STR=$($GETSTRIPE $POOL_ROOT/$tfile | grep 0x | cut -f2 | tr -d " ")
1519 rm $POOL_ROOT/$tfile
1520 if [[ "$STR" == "0" ]]; then
1521 echo "Creating a file in pool$i"
1522 create_file $POOL_ROOT/file$i $POOL$i || break
1523 check_file_in_pool $POOL_ROOT/file$i $POOL$i || break
1525 echo "OST 0 seems to be unavailable. Try later."
1531 run_test 25 "Create new pool and restart MDS"
1534 [[ $OSTCOUNT -le 2 ]] && skip_env "Need at least 3 OSTs" && return
1536 local dev=$(mdsdevname ${SINGLEMDS//mds/})
1537 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1541 create_pool_nofail $POOL2
1543 do_facet $SINGLEMDS "lctl pool_add $FSNAME.$POOL2 OST0000; sync"
1544 wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$POOL2 |
1545 sort -u | grep $FSNAME-OST0000_UUID " "$FSNAME-OST0000_UUID" ||
1546 error "pool_add failed: $1; $2"
1548 do_facet $SINGLEMDS "lctl pool_add $FSNAME.$POOL2 OST0002; sync"
1549 wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$POOL2 |
1550 sort -u | grep $FSNAME-OST0002_UUID" "$FSNAME-OST0002_UUID" ||
1551 error "pool_add failed: $1; $2"
1553 # Veriy that the pool got created and is usable
1555 echo "Creating files in $POOL2"
1557 for ((i = 0; i < 10; i++)); do
1558 #OBD_FAIL_MDS_OSC_CREATE_FAIL 0x147
1559 #Fail OST0000 to ensure objects create on the other OST in the pool
1560 do_facet $SINGLEMDS lctl set_param fail_loc=0x147
1561 do_facet $SINGLEMDS lctl set_param fail_val=0
1562 create_file $POOL_ROOT/file$i $POOL2 1 -1 || break
1563 do_facet $SINGLEMDS lctl set_param fail_loc=0
1564 check_file_in_pool $POOL_ROOT/file$i $POOL2 || break
1568 run_test 26 "Choose other OSTs in the pool first in the creation remedy"
1573 cleanup_pools $FSNAME
1574 check_and_cleanup_lustre