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
33 [ "$SLOW" = "no" ] && EXCEPT_SLOW="18 23b"
40 MAXFREE=${MAXFREE:-$((2000000 * OSTCOUNT))}
44 POOL2=${POOL2:-${POOL}2}
45 POOL3=${POOL3:-${POOL}3}
46 NON_EXISTANT_POOL=nonexistantpool
47 NON_EXISTANT_FS=nonexistantfs
48 INVALID_POOL=some_invalid_pool_name
50 TGT_FIRST=$(printf %04x 0)
51 TGT_MAX=$(printf %04x $((TGT_COUNT-1)))
53 TGT_LIST=$(seq 0x$TGT_FIRST $TGT_STEP 0x$TGT_MAX)
54 TGT_LIST2=$(seq 0x$TGT_FIRST 2 0x$TGT_MAX)
56 TGT_ALL="$FSNAME-OST[$TGT_FIRST-$TGT_MAX/1]"
57 TGT_HALF="$FSNAME-OST[$TGT_FIRST-$TGT_MAX/2]"
59 TGT_UUID=$(for i in $TGT_LIST; do printf "$FSNAME-OST%04x_UUID " $i; done)
60 TGT_UUID2=$(for i in $TGT_LIST2; do printf "$FSNAME-OST%04x_UUID " $i; done)
65 local count=${3:-"-1"}
69 if [[ -n $idx ]]; then
70 $SETSTRIPE -c $count -p $pool -i $idx $dir
72 $SETSTRIPE -c $count -p $pool $dir
75 error "$SETSTRIPE -p $pool $dir failed."
81 local count=${3:-"-1"}
82 local index=${4:-"-1"}
84 $SETSTRIPE -i $index -c $count -p $pool $file
86 error "$SETSTRIPE -p $pool $file failed."
92 for i in $(do_facet mgs lctl pool_list $FSNAME.$pool |
93 grep -v "^Pool:" | sed -e 's/_UUID$//;s/^.*-OST//'); do
94 res="$res $(printf "%d" 0x$i)"
102 local res=$($GETSTRIPE $dir | grep "^stripe_count:" |
103 cut -d ':' -f 5 | tr -d "[:blank:]")
104 if [[ "$res" != "$pool" ]]; then
105 error found $res instead of $pool
112 check_file_in_pool() {
113 local osts=$(osts_in_pool $2)
114 check_file_in_osts $1 "$osts" $3
117 check_file_in_osts() {
119 local pool_list=${2:-$TGT_LIST}
121 local res=$($GETSTRIPE $file | grep 0x | cut -f2)
124 found=$(echo :$pool_list: | tr " " ":" | grep :$i:)
125 if [[ "$found" == "" ]]; then
126 echo "pool list: $pool_list"
127 echo "striping: $res"
129 error "$file not allocated from OSTs $pool_list."
134 local ost_count=$($GETSTRIPE $file | grep 0x | wc -l)
135 [[ -n "$count" ]] && [[ $ost_count -ne $count ]] &&
136 { error "Stripe count $count expected; got $ost_count" && return 1;}
142 $GETSTRIPE -v $1 | grep "^lmm_pool:" | tr -d "[:blank:]" | cut -f 2 -d ':'
145 check_file_not_in_pool() {
148 local res=$(file_pool $file)
150 if [[ "$res" == "$pool" ]]; then
151 error "File $file is in pool: $res"
158 check_dir_not_in_pool() {
161 local res=$($GETSTRIPE -v $dir | grep "^stripe_count" | head -n1 |
163 if [[ "$res" == "$pool" ]]; then
164 error "File $dir is in pool: $res"
172 wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$pool" "" ||
173 error "Failed to remove targets from pool: $pool"
179 local tgt="${3}$(lctl get_param -n lov.$FSNAME-*.pools.$pool |
180 sort -u | tr '\n' ' ')"
182 do_facet mgs lctl pool_add $FSNAME.$pool $osts
184 [[ $RC -ne 0 ]] && return $RC
186 wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$pool |
187 sort -u | tr '\n' ' ' " "$tgt" >/dev/null || RC=1
188 [[ $RC -ne 0 ]] && error "pool_add failed: $1; $2"
192 create_pool_nofail() {
193 create_pool $FSNAME.$1
194 if [[ $? != 0 ]]; then
195 error "Pool creation of $1 failed"
200 create_pool $FSNAME.$1
201 if [[ $? == 0 ]]; then
202 error "Pool creation of $1 succeeded; should have failed"
207 # Destroy pools from previous test runs
208 for p in $(do_facet mgs lctl pool_list $FSNAME | grep $POOL); do
211 rm -rf $DIR/d0.${TESTSUITE}
219 trap "cleanup_tests $FSNAME" EXIT
223 remote_mds_nodsh && skip "remote MDS with nodsh" && exit 0
224 remote_ost_nodsh && skip "remote OST with nodsh" && exit 0
228 # Tests for new commands added
234 run_test 1a "Create a pool with a 1 character pool name"
238 create_pool_nofail ${POOL}12
239 destroy_pool ${POOL}12
241 run_test 1b "Create a pool with a 10 char pool name"
245 create_pool_nofail ${POOL}1234567
246 destroy_pool ${POOL}1234567
248 run_test 1c "Create a pool with a 15 char pool name"
252 create_pool_fail ${POOL}12345678
254 run_test 1d "Create a pool with a 16 char pool name; should fail"
258 local pool_name="$POOL"
259 for ((i = 1; i <= 991; i++)); do pool_name=${pool_name}"o"; done
260 create_pool_fail $pool_name
262 run_test 1e "Create a pool with a 1000 char pool name; should fail"
266 do_facet mgs lctl pool_new .$POOL 2>/dev/null
268 error "pool_new did not fail even though fs-name was missing"
270 run_test 1f "pool_new should fail if fs-name is missing"
274 do_facet mgs lctl pool_new $POOL 2>/dev/null
276 error "pool_new did not fail even though fs-name was missing"
278 run_test 1g "pool_new should fail if fs-name is missing"
282 do_facet mgs lctl pool_new ${FSNAME}. 2>/dev/null
284 error "pool_new did not fail even though pool name was missing"
286 run_test 1h "pool_new should fail if poolname is missing"
290 do_facet mgs lctl pool_new . 2>/dev/null
292 error "pool_new did not fail even if pool and fs-name were missing"
294 run_test 1i "pool_new should fail if poolname and fs-name are missing"
298 do_facet mgs lctl pool_new ${FSNAME},$POOL 2>/dev/null
300 error "pool_new did not fail even though pool name format was wrong"
302 run_test 1j "pool_new should fail if poolname format is wrong"
306 do_facet mgs lctl pool_new ${FSNAME}/$POOL 2>/dev/null
308 error "pool_new did not fail even though pool name format was wrong"
310 run_test 1k "pool_new should fail if poolname format is wrong"
314 create_pool_nofail $POOL2
315 do_facet mgs lctl pool_new ${FSNAME}.$POOL2 2>/dev/null
317 error "pool_new did not fail even though $POOL2 existed"
320 run_test 1m "pool_new did not fail even though $POOL2 existed"
324 create_pool_nofail ${POOL}1234567
326 add_pool ${POOL}1234567 "OST0000" "$FSNAME-OST0000_UUID "
327 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
328 create_dir $POOL_ROOT ${POOL}1234567
329 dd if=/dev/zero of=$POOL_ROOT/file bs=1M count=100
330 RC=$?; [[ $RC -eq 0 ]] ||
331 error "failed to write to $POOL_ROOT/file: $RC"
332 do_facet mgs lctl pool_remove $FSNAME.${POOL}1234567 OST0000
333 drain_pool ${POOL}1234567
335 destroy_pool ${POOL}1234567
337 run_test 1n "Pool with a 15 char pool name works well"
343 do_facet mgs lctl pool_add $FSNAME.$POOL $FSNAME-OST0000 2>/dev/null
345 error "pool_add did not fail even though $POOL did not exist"
347 run_test 2a "pool_add: non-existant pool $POOL"
351 do_facet mgs lctl pool_add $FSNAME.${POOL}1234567890 \
352 $FSNAME-OST0000 2>/dev/null
354 error "pool_add did not fail even though pool name was invalid."
356 run_test 2b "pool_add: Invalid pool name"
358 # Testing various combinations of OST name list
364 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
365 [[ $? -ne 0 ]] || destroy_pool $POOL
367 create_pool_nofail $POOL
370 do_facet mgs lctl pool_add $FSNAME.$POOL OST0000
371 RC=$?; [[ $RC -eq 0 ]] ||
372 error "pool_add failed. $FSNAME $POOL OST0000: $RC"
373 do_facet mgs lctl pool_remove $FSNAME.$POOL OST0000
377 do_facet mgs lctl pool_add $FSNAME.$POOL $FSNAME-OST0000
378 RC=$?; [[ $RC -eq 0 ]] ||
379 error "pool_add failed. $FSNAME $POOL $FSNAME-OST0000: $RC"
380 do_facet mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000
383 # 3. $FSNAME-OST0000_UUID
384 do_facet mgs lctl pool_add $FSNAME.$POOL $FSNAME-OST0000_UUID
385 RC=$?; [[ $RC -eq 0 ]] ||
386 error "pool_add failed. $FSNAME $POOL $FSNAME-OST0000_UUID: $RC"
387 do_facet mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000_UUID
390 # 4. $FSNAME-OST[0,1,2,3,]
392 for i in $TGT_LIST; do TGT=${TGT}$(printf "%04x," $i); done
394 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT
395 [[ $? -eq 0 ]] || error "pool_add failed. $FSNAME.$POOL $TGT. $RC"
396 do_facet mgs lctl pool_remove $FSNAME.$POOL $TGT
399 # 5. $FSNAME-OST[0-5/1]
400 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT_ALL
401 RC=$?; [[ $RC -eq 0 ]] ||
402 error "pool_add failed. $FSNAME $POOL" "$TGT_ALL $RC"
403 wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$POOL |
404 sort -u | tr '\n' ' ' " "$TGT_UUID" ||
405 error "Add to pool failed"
406 do_facet mgs lctl pool_remove $FSNAME.$POOL $TGT_ALL
411 run_test 2c "pool_add: OST index combinations"
418 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
419 [[ $? -ne 0 ]] || destroy_pool $POOL
421 create_pool_nofail $POOL
423 TGT=$(printf "$FSNAME-OST%04x_UUID " $OSTCOUNT)
424 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT
425 RC=$?; [[ $RC -ne 0 ]] ||
426 error "pool_add succeeded for an OST ($TGT) that does not exist."
430 run_test 2d "pool_add: OSTs that don't exist should be rejected"
438 $LCTL get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
439 [[ $? -ne 0 ]] || destroy_pool $POOL
441 create_pool_nofail $POOL
443 TGT="$FSNAME-OST0000_UUID "
444 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT
445 wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$POOL |
446 sort -u | tr '\n' ' ' " "$TGT" || error "Add to pool failed"
447 RESULT=$(do_facet mgs \
448 "LOCALE=C $LCTL pool_add $FSNAME.$POOL $TGT 2>&1")
453 error "pool_add succeeded for an OST that was already in the pool."
455 [[ $(grep "already in pool" <<< $RESULT) ]] ||
456 error "pool_add failed as expected but error message not as expected."
460 run_test 2e "pool_add: OST already in a pool should be rejected"
464 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
465 [[ $? -ne 0 ]] || destroy_pool $POOL
468 lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000 2>/dev/null
470 error "pool_remove did not fail even though pool did not exist."
472 run_test 3a "pool_remove: non-existant pool"
477 lctl pool_remove ${NON_EXISTANT_FS}.$POOL OST0000 2>/dev/null
479 error "pool_remove did not fail even though fsname did not exist."
481 run_test 3b "pool_remove: non-existant fsname"
485 do_facet mgs lctl pool_remove $FSNAME.p1234567891234567890 \
486 $FSNAME-OST0000 2>/dev/null
488 error "pool_remove did not fail even though pool name was invalid."
490 run_test 3c "pool_remove: Invalid pool name"
492 # Testing various combinations of OST name list
495 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
496 [[ $? -ne 0 ]] || destroy_pool $POOL
498 create_pool_nofail $POOL
499 do_facet mgs lctl pool_add $FSNAME.$POOL OST0000
500 do_facet mgs lctl pool_remove $FSNAME.$POOL OST0000
501 [[ $? -eq 0 ]] || error "pool_remove failed. $FSNAME $POOL OST0000"
504 do_facet mgs lctl pool_add $FSNAME.$POOL $FSNAME-OST0000
505 do_facet mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000
506 [[ $? -eq 0 ]] || error "pool_remove failed. $FSNAME $POOL $FSNAME-OST0000"
509 do_facet mgs lctl pool_add $FSNAME.$POOL $FSNAME-OST0000_UUID
510 do_facet mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000_UUID
512 error "pool_remove failed. $FSNAME $POOL $FSNAME-OST0000_UUID"
515 add_pool $POOL $TGT_ALL "$TGT_UUID"
516 do_facet mgs lctl pool_remove $FSNAME.$POOL $TGT_ALL
517 [[ $? -eq 0 ]] || error "pool_remove failed. $FSNAME $POOL" $TGT_ALL
522 run_test 3d "pool_remove: OST index combinations"
526 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
527 [[ $? -ne 0 ]] || destroy_pool $POOL
529 do_facet mgs lctl pool_destroy $FSNAME.$POOL 2>/dev/null
531 error "pool_destroy did not fail even though pool did not exist."
533 run_test 4a "pool_destroy: non-existant pool"
537 do_facet mgs lctl pool_destroy ${NON_EXISTANT_FS}.$POOL 2>/dev/null
539 error "pool_destroy did not fail even though filesystem did not exist."
541 run_test 4b "pool_destroy: non-existant fs-name"
545 create_pool_nofail $POOL
546 add_pool $POOL "OST0000" "$FSNAME-OST0000_UUID "
548 do_facet mgs lctl pool_destroy ${FSNAME}.$POOL
549 [[ $? -ne 0 ]] || error "pool_destroy succeeded with a non-empty pool."
552 run_test 4c "pool_destroy: non-empty pool"
557 $LCMD pool_list 2>/dev/null
559 error "pool_list did not fail even though fsname missing."
561 destroy_pool $POOL 2>/dev/null
562 destroy_pool $POOL2 2>/dev/null
564 create_pool_nofail $POOL
565 create_pool_nofail $POOL2
566 $LCMD pool_list $FSNAME
567 [[ $? -eq 0 ]] || error "pool_list $FSNAME failed."
569 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT_ALL
571 $LCMD pool_list $FSNAME.$POOL
572 [[ $? -eq 0 ]] || error "pool_list $FSNAME.$POOL failed."
574 $LCMD pool_list ${NON_EXISTANT_FS} 2>/dev/null
576 error "pool_list did not fail for fsname $NON_EXISTANT_FS"
578 $LCMD pool_list ${FSNAME}.$NON_EXISTANT_POOL 2>/dev/null
580 error "pool_list did not fail for pool $NON_EXISTANT_POOL"
582 if [[ ! $(grep $SINGLEMDS <<< $LCMD) ]]; then
583 echo $LCMD pool_list $DIR
585 [[ $? -eq 0 ]] || error "pool_list failed for $DIR"
588 $LCMD pool_list ${DIR}/d1
589 [[ $? -eq 0 ]] || error "pool_list failed for ${DIR}/d1"
592 rm -rf ${DIR}nonexistant
593 $LCMD pool_list ${DIR}nonexistant 2>/dev/null
595 error "pool_list did not fail for invalid mountpoint ${DIR}nonexistant"
603 # Issue commands from client
606 run_test 5a "lfs pool_list from client"
610 sub_test_5 "do_facet $SINGLEMDS lctl"
612 run_test 5b "lctl pool_list from MDS"
616 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
617 local POOL_DIR=$POOL_ROOT/dir_tst
618 local POOL_FILE=$POOL_ROOT/file_tst
620 create_pool_nofail $POOL
622 do_facet $SINGLEMDS lctl pool_list $FSNAME
623 [[ $? -eq 0 ]] || error "pool_list $FSNAME failed."
625 add_pool $POOL $TGT_ALL "$TGT_UUID"
628 $SETSTRIPE -c -1 -p $POOL $POOL_DIR
629 [[ $? -eq 0 ]] || error "$SETSTRIPE -p $POOL failed."
630 check_dir_in_pool $POOL_DIR $POOL
632 # If an invalid pool name is specified, the command should fail
633 $SETSTRIPE -c 2 -p $INVALID_POOL $POOL_DIR 2>/dev/null
634 [[ $? -ne 0 ]] || error "setstripe to invalid pool did not fail."
636 # If the pool name does not exist, the command should fail
637 $SETSTRIPE -c 2 -p $NON_EXISTANT_POOL $POOL_DIR 2>/dev/null
638 [[ $? -ne 0 ]] || error "setstripe to non-existant pool did not fail."
640 # lfs setstripe should work as before if a pool name is not specified.
641 $SETSTRIPE -c -1 $POOL_DIR
642 [[ $? -eq 0 ]] || error "$SETSTRIPE -p $POOL_DIR failed."
643 $SETSTRIPE -c -1 $POOL_FILE
644 [[ $? -eq 0 ]] || error "$SETSTRIPE -p $POOL_FILE failed."
646 # lfs setstripe should fail if a start index that is outside the
648 create_pool_nofail $POOL2
649 add_pool $POOL2 "OST0000" "$FSNAME-OST0000_UUID "
650 $SETSTRIPE -i 1 -p $POOL2 $ROOT_POOL/$tfile 2>/dev/null
652 error "$SETSTRIPE with start index outside the pool did not fail."
655 run_test 6 "getstripe/setstripe"
659 # Create a pool, stripe a directory and file with it
662 pool_add $pool || error "pool_add failed"
663 pool_add_targets $pool 0 1 || error "pool_add_targets failed"
665 $SETSTRIPE -c 1 $DIR/$tdir/testfile1 --pool "$pool" || \
666 error "setstripe failed"
667 $SETSTRIPE -c 1 $DIR/$tdir/testfile2 --pool "$FSNAME.$pool" || \
668 error "setstripe failed"
670 mkdir $DIR/$tdir/testdir
671 $SETSTRIPE -c 1 $DIR/$tdir/testdir -p "$pool" || \
672 error "setstripe failed"
673 $SETSTRIPE -c 1 $DIR/$tdir/testdir -p "$FSNAME.$pool" || \
674 error "setstripe failed"
676 rm -f $DIR/$tdir/testfile1
677 rm -f $DIR/$tdir/testfile2
678 rmdir $DIR/$tdir/testdir
680 destroy_pool_int $FSNAME.$pool
685 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
689 # Generate pool with random name from 1 to 15 characters
691 POOLNAME=$(echo $$$RANDOM$RANDOM |
692 tr -dc 'a-zA-Z0-9' | fold -w $i |
694 echo set poolname to $POOLNAME
695 helper_test_7a $POOLNAME
698 run_test 7a "create various pool name"
703 do_facet mgs lctl pool_new qwerty
704 [ $? -ne 22 ] && error "can create a pool with no fsname"
707 do_facet mgs lctl pool_new $FSNAME.
708 [ $? -ne 22 ] && error "can create a pool with no name"
711 do_facet mgs lctl pool_new $FSNAME.0123456789^bdef
712 [ $? -ne 22 ] && error "can create a pool with an invalid name"
715 do_facet mgs lctl pool_new $FSNAME.0123456789abdefg
716 [ $? -ne 36 ] && error "can create a pool with a name too long"
720 run_test 7b "try to create pool name with invalid lengths or names"
724 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
728 # Create a pool with 15 letters
729 local pool=0123456789abcde
730 pool_add $pool || error "pool_add failed"
731 pool_add_targets $pool 0 1 || error "pool_add_targets failed"
733 # setstripe with the same pool name plus 1 letter
734 $SETSTRIPE -c 1 $DIR/$tdir/testfile1 --pool "${pool}X" && \
735 error "setstripe succedeed"
737 # setstripe with the same pool name minus 1 letter
738 $SETSTRIPE -c 1 $DIR/$tdir/testfile1 --pool "${pool%?}" && \
739 error "setstripe succedeed"
741 rm -f $DIR/$tdir/testfile1
743 destroy_pool_int $FSNAME.$pool
745 run_test 7c "create a valid pool name and setstripe with a bad one"
749 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
751 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return
753 create_pool_nofail $POOL
754 create_pool_nofail $POOL2
756 local start=$(printf %04x $((TGT_FIRST + 1)))
757 do_facet mgs lctl pool_add $FSNAME.$POOL2 \
758 $FSNAME-OST[$start-$TGT_MAX/2]
760 add_pool $POOL $TGT_HALF "$TGT_UUID2"
762 create_dir $POOL_ROOT/dir1 $POOL
763 create_dir $POOL_ROOT/dir2 $POOL2
764 check_dir_in_pool $POOL_ROOT/dir1 $POOL
765 check_dir_in_pool $POOL_ROOT/dir1 $POOL
768 createmany -o $POOL_ROOT/dir1/$tfile $numfiles ||
769 error "createmany $POOL_ROOT/dir1/$tfile failed!"
771 for file in $POOL_ROOT/dir1/*; do
772 check_file_in_pool $file $POOL
775 createmany -o $POOL_ROOT/dir2/$tfile $numfiles ||
776 error "createmany $POOL_ROOT/dir2/$tfile failed!"
777 for file in $POOL_ROOT/dir2/*; do
778 check_file_in_pool $file $POOL2
781 rm -rf $POOL_ROOT/dir?
785 run_test 11 "OSTs in overlapping/multiple pools"
789 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
791 [[ $OSTCOUNT -le 2 ]] && skip_env "Need at least 3 OSTs" && return
793 create_pool_nofail $POOL
794 create_pool_nofail $POOL2
796 local start=$(printf %04x $((TGT_FIRST + 1)))
797 do_facet mgs lctl pool_add $FSNAME.$POOL2 \
798 $FSNAME-OST[$start-$TGT_MAX/2]
800 add_pool $POOL $TGT_HALF "$TGT_UUID2"
802 echo creating some files in $POOL and $POOL2
804 create_dir $POOL_ROOT/dir1 $POOL
805 create_dir $POOL_ROOT/dir2 $POOL2
806 create_file $POOL_ROOT/file1 $POOL
807 create_file $POOL_ROOT/file2 $POOL2
809 echo Checking the files created
810 check_dir_in_pool $POOL_ROOT/dir1 $POOL
811 check_dir_in_pool $POOL_ROOT/dir2 $POOL2
812 check_file_in_pool $POOL_ROOT/file1 $POOL
813 check_file_in_pool $POOL_ROOT/file2 $POOL2
815 echo Changing the pool membership
816 do_facet mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST[$TGT_FIRST]
817 do_facet mgs lctl pool_list $FSNAME.$POOL
818 FIRST_UUID=$(echo $TGT_UUID | awk '{print $1}')
819 add_pool $POOL2 $FSNAME-OST[$TGT_FIRST] "$FIRST_UUID "
820 do_facet mgs lctl pool_list $FSNAME.$POOL2
822 echo Checking the files again
823 check_dir_in_pool $POOL_ROOT/dir1 $POOL
824 check_dir_in_pool $POOL_ROOT/dir2 $POOL2
825 check_file_in_osts $POOL_ROOT/file1 "$TGT_LIST2"
826 check_file_in_osts $POOL_ROOT/file2 "$(seq 0x$start 2 0x$TGT_MAX)"
828 echo Creating some more files
829 create_dir $POOL_ROOT/dir3 $POOL
830 create_dir $POOL_ROOT/dir4 $POOL2
831 create_file $POOL_ROOT/file3 $POOL
832 create_file $POOL_ROOT/file4 $POOL2
834 echo Checking the new files
835 check_file_in_pool $POOL_ROOT/file3 $POOL
836 check_file_in_pool $POOL_ROOT/file4 $POOL2
840 run_test 12 "OST Pool Membership"
844 [[ $OSTCOUNT -le 2 ]] && skip_env "Need at least 3 OSTs" && return
846 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
850 create_pool_nofail $POOL
851 add_pool $POOL $TGT_ALL "$TGT_UUID"
853 create_dir $POOL_ROOT/dir1 $POOL -1
854 createmany -o $POOL_ROOT/dir1/$tfile $numfiles ||
855 error "createmany $POOL_ROOT/dir1/$tfile failed!"
856 for file in $POOL_ROOT/dir1/*; do
857 check_file_in_pool $file $POOL $OSTCOUNT
860 create_file $POOL_ROOT/dir1/file1 $POOL 1 $TGT_FIRST
861 create_file $POOL_ROOT/dir1/file2 $POOL 1 $((TGT_FIRST + 1))
862 create_file $POOL_ROOT/dir1/file3 $POOL 1 $((TGT_FIRST + 2))
863 check_file_in_pool $POOL_ROOT/dir1/file1 $POOL 1
864 check_file_in_pool $POOL_ROOT/dir1/file2 $POOL 1
865 create_file $POOL_ROOT/dir1/file3 $POOL 1 $((TGT_FIRST + 2))
866 check_file_in_osts $POOL_ROOT/dir1/file1 $((16#$TGT_FIRST))
867 check_file_in_osts $POOL_ROOT/dir1/file2 "$((TGT_FIRST + 1))"
868 check_file_in_osts $POOL_ROOT/dir1/file3 "$((TGT_FIRST + 2))"
870 create_dir $POOL_ROOT/dir2 $POOL $count
871 createmany -o $POOL_ROOT/dir2/$tfile- $numfiles ||
872 error "createmany $POOL_ROOT/dir2/$tfile- failed!"
873 for file in $POOL_ROOT/dir2/*; do
874 check_file_in_pool $file $POOL $count
877 create_dir $POOL_ROOT/dir3 $POOL $count $((TGT_FIRST + 1))
878 createmany -o $POOL_ROOT/dir3/$tfile- $numfiles ||
879 error "createmany $POOL_ROOT/dir3/$tfile- failed!"
880 for file in $POOL_ROOT/dir3/*; do
881 check_file_in_pool $file $POOL $count
884 create_dir $POOL_ROOT/dir4 $POOL 1
885 createmany -o $POOL_ROOT/dir4/$tfile- $numfiles ||
886 error "createmany $POOL_ROOT/dir4/$tfile- failed!"
887 for file in $POOL_ROOT/dir4/*; do
888 check_file_in_pool $file $POOL 1
891 create_dir $POOL_ROOT/dir5 $POOL 1 $((TGT_FIRST + 2))
892 createmany -o $POOL_ROOT/dir5/$tfile- $numfiles ||
893 error "createmany $POOL_ROOT/dir5/$tfile- failed!"
894 for file in $POOL_ROOT/dir5/*; do
895 check_file_in_pool $file $POOL 1
896 check_file_in_osts $file "$((TGT_FIRST + 2))"
899 rm -rf $POOL_ROOT/dir[1-5]/
903 run_test 13 "Striping characteristics in a pool"
907 [[ $OSTCOUNT -le 2 ]] && skip_env "Need at least 3 OSTs" && return
909 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
913 [ $OSTSIZE -gt $((MAXFREE / OSTCOUNT)) ] &&
914 skip_env "OST size $OSTSIZE is larger than $((MAXFREE / OSTCOUNT))" &&
917 create_pool_nofail $POOL
918 create_pool_nofail $POOL2
920 add_pool $POOL $TGT_HALF "$TGT_UUID2"
921 add_pool $POOL2 "OST0000" "$FSNAME-OST0000_UUID "
923 create_dir $POOL_ROOT/dir1 $POOL 1
924 create_file $POOL_ROOT/dir1/file $POOL 1
925 local OST=$($GETSTRIPE -i $POOL_ROOT/dir1/file)
927 while [[ $i -lt $numfiles ]]; do
929 [[ $OST -gt $((16#$TGT_MAX)) ]] && OST=$TGT_FIRST
931 # echo "Iteration: $i OST: $OST"
932 create_file $POOL_ROOT/dir1/file${i} $POOL 1
933 check_file_in_pool $POOL_ROOT/dir1/file${i} $POOL
937 # Fill up OST0 until it is nearly full.
938 # Create 9 files of size OST0_SIZE/10 each.
939 create_dir $POOL_ROOT/dir2 $POOL2 1
940 $LFS df $POOL_ROOT/dir2
941 OST0_SIZE=$($LFS df $POOL_ROOT/dir2 | awk '/\[OST:0\]/ { print $4 }')
942 FILE_SIZE=$((OST0_SIZE/1024/10))
943 echo "Filling OST0 with 9 files of ${FILE_SIZE}MB in $POOL_ROOT/dir2"
945 while [[ $i -lt 10 ]]; do
946 dd if=/dev/zero of=$POOL_ROOT/dir2/f${i} bs=1M count=$FILE_SIZE
949 sleep 1 # get new statfs info
950 $LFS df $POOL_ROOT/dir2
952 # OST $TGT_FIRST is no longer favored; but it may still be used.
953 create_dir $POOL_ROOT/dir3 $POOL 1
954 create_file $POOL_ROOT/dir3/file $POOL 1
955 createmany -o $POOL_ROOT/dir3/$tfile- $numfiles ||
956 error "createmany $POOL_ROOT/dir3/$tfile- failed!"
957 for file in $POOL_ROOT/dir3/*; do
958 check_file_in_pool $file $POOL
965 run_test 14 "Round robin and QOS striping within a pool"
969 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
973 while [[ $i -lt $OSTCOUNT ]]; do
974 create_pool_nofail $POOL${i}
976 local tgt=$(printf "$FSNAME-OST%04x_UUID " $i)
977 add_pool $POOL${i} "$FSNAME-OST[$(printf %04x $i)]" "$tgt"
978 create_dir $POOL_ROOT/dir${i} $POOL${i}
979 createmany -o $POOL_ROOT/dir$i/$tfile $numfiles ||
980 error "createmany $POOL_ROOT/dir$i/$tfile failed!"
982 for file in $POOL_ROOT/dir$i/*; do
983 check_file_in_osts $file $i
991 run_test 15 "One directory per OST/pool"
995 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
999 create_pool_nofail $POOL
1001 add_pool $POOL $TGT_HALF "$TGT_UUID2"
1003 local dir=$POOL_ROOT/$tdir
1004 create_dir $dir $POOL
1006 for i in $(seq 1 10); do
1011 createmany -o $dir/$tfile $numfiles ||
1012 error "createmany $dir/$tfile failed!"
1014 for file in $dir/*; do
1015 check_file_in_pool $file $POOL
1018 rm -rf $POOL_ROOT/$tdir
1022 run_test 16 "Inheritance of pool properties"
1026 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1030 create_pool_nofail $POOL
1032 add_pool $POOL $TGT_ALL "$TGT_UUID"
1034 local dir=$POOL_ROOT/dir
1035 create_dir $dir $POOL
1037 createmany -o $dir/${tfile}1_ $numfiles ||
1038 error "createmany $dir/${tfile}1_ failed!"
1040 for file in $dir/*; do
1041 check_file_in_pool $file $POOL
1046 createmany -o $dir/${tfile}2_ $numfiles ||
1047 error "createmany $dir/${tfile}2_ failed!"
1052 run_test 17 "Referencing an empty pool"
1061 wait_delete_completed >/dev/null # give pending IO a chance to go to disk
1062 stat=$(createmany -o $cdir/${tfile} -$numsec | tail -1)
1063 files=$(echo $stat | cut -f 2 -d ' ')
1065 unlinkmany $cdir/${tfile} $files > /dev/null
1073 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1076 local plaindir=$POOL_ROOT/plaindir
1077 local pooldir=$POOL_ROOT/pooldir
1083 for i in $(seq 1 $iter); do
1084 echo "Create performance, iteration $i, $numsec seconds x 3"
1086 local files1=$(create_perf $plaindir $numsec)
1087 [[ $files1 -eq 0 ]] && error "Zero files created without pool"
1089 echo "iter $i: $files1 creates without pool"
1091 create_pool_nofail $POOL > /dev/null
1092 add_pool $POOL $TGT_ALL "$TGT_UUID" > /dev/null
1093 create_dir $pooldir $POOL
1094 local files2=$(create_perf $pooldir $numsec)
1095 [[ $files2 -eq 0 ]] && error "Zero files created with pool"
1097 echo "iter $i: $files2 creates with pool"
1099 destroy_pool $POOL > /dev/null
1100 local files3=$(create_perf $pooldir $numsec)
1101 [[ $files3 -eq 0 ]] &&
1102 error "Zero files created with missing pool"
1104 echo "iter $i: $files3 creates with missing pool"
1109 echo Avg files created in $numsec seconds without pool: $((f1 / iter))
1110 echo Avg files created in $numsec seconds with pool: $((f2 / iter))
1111 echo Avg files created in $numsec seconds missing pool: $((f3 / iter))
1113 # Set this high until we establish a baseline for what the degradation
1117 diff=$((($f1 - $f2) * 100 / $f1))
1118 echo "No pool / wide pool: $diff %."
1119 [ $diff -gt $max ] &&
1120 error_ignore bz23408 "Degradation with wide pool is $diff% > $max%"
1123 diff=$((($f1 - $f3) * 100 / $f1))
1124 echo "No pool / missing pool: $diff %."
1125 [ $diff -gt $max ] &&
1126 error_ignore bz23408 "Degradation with wide pool is $diff% > $max%"
1130 run_test 18 "File create in a directory which references a deleted pool"
1134 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1136 local dir1=$POOL_ROOT/dir1
1137 local dir2=$POOL_ROOT/dir2
1140 create_pool_nofail $POOL
1142 add_pool $POOL $TGT_HALF "$TGT_UUID2"
1144 create_dir $dir1 $POOL
1145 createmany -o $dir1/${tfile} $numfiles ||
1146 error "createmany $dir1/${tfile} failed!"
1147 for file in $dir1/*; do
1148 check_file_in_pool $file $POOL
1152 createmany -o $dir2/${tfile} $numfiles ||
1153 error "createmany $dir2/${tfile} failed!"
1154 for file in $dir2/*; do
1155 check_file_not_in_pool $file $POOL
1162 run_test 19 "Pools should not come into play when not specified"
1166 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1168 local dir1=$POOL_ROOT/dir1
1169 local dir2=$dir1/dir2
1170 local dir3=$dir1/dir3
1174 create_pool_nofail $POOL
1175 create_pool_nofail $POOL2
1177 add_pool $POOL $TGT_HALF "$TGT_UUID2"
1179 local start=$(printf %04x $((TGT_FIRST + 1)))
1180 TGT=$(for i in $(seq 0x$start 2 0x$TGT_MAX); do \
1181 printf "$FSNAME-OST%04x_UUID " $i; done)
1182 add_pool $POOL2 "$FSNAME-OST[$start-$TGT_MAX/2]" "$TGT"
1184 create_dir $dir1 $POOL
1185 create_file $dir1/file1 $POOL2
1186 create_dir $dir2 $POOL2
1189 $SETSTRIPE -c 1 $dir3 # No pool assignment
1191 $SETSTRIPE -c 1 $dir2/file4 # No pool assignment
1193 check_file_in_pool $dir1/file1 $POOL2
1194 check_file_in_pool $dir2/file2 $POOL2
1196 check_dir_not_in_pool $dir3 $POOL
1197 check_dir_not_in_pool $dir3 $POOL2
1199 check_file_not_in_pool $dir3/file3 $POOL
1200 check_file_not_in_pool $dir3/file3 $POOL2
1202 check_file_not_in_pool $dir2/file4 $POOL
1203 check_file_not_in_pool $dir2/file4 $POOL2
1209 run_test 20 "Different pools in a directory hierarchy."
1213 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1214 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return
1218 local dir=$POOL_ROOT/dir
1220 create_pool_nofail $POOL
1222 add_pool $POOL $TGT_HALF "$TGT_UUID2"
1224 create_dir $dir $POOL $OSTCOUNT
1225 create_file $dir/file1 $POOL $OSTCOUNT
1226 $GETSTRIPE -v $dir/file1
1227 check_file_in_pool $dir/file1 $POOL
1233 run_test 21 "OST pool with fewer OSTs than stripe count"
1241 for c in $(seq 1 10); do
1242 echo "Pool $pool, iteration $c"
1243 do_facet mgs lctl pool_add $FSNAME.$pool \
1244 OST[$TGT_FIRST-$TGT_MAX/$step] 2>/dev/null
1245 local TGT_SECOND=$(printf %04x $((TGT_FIRST + $step)))
1246 if [ $((16#$TGT_SECOND)) -le $((16#$TGT_MAX)) ]; then
1247 do_facet mgs lctl pool_remove $FSNAME.$pool \
1248 OST[$TGT_SECOND-$TGT_MAX/$step]
1251 echo loop for $pool complete
1256 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1257 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return
1261 create_pool_nofail $POOL
1262 add_pool $POOL "OST0000" "$FSNAME-OST0000_UUID "
1263 create_pool_nofail $POOL2
1264 add_pool $POOL2 "OST0000" "$FSNAME-OST0000_UUID "
1269 create_dir $POOL_ROOT $POOL
1270 createmany -o $POOL_ROOT/${tfile} $numfiles ||
1271 error "createmany $POOL_ROOT/${tfile} failed!"
1276 run_test 22 "Simultaneous manipulation of a pool"
1280 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1281 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return
1284 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS || {
1285 skip_env "User $RUNAS_ID does not exist - skipping"
1291 local BUNIT_SZ=1024 # min block quota unit(kB)
1292 local LIMIT=$((BUNIT_SZ * (OSTCOUNT + 1)))
1293 local dir=$POOL_ROOT/dir
1294 local file="$dir/$tfile-quota"
1296 create_pool_nofail $POOL
1298 local TGT=$(for i in $(seq 0x$TGT_FIRST 3 0x$TGT_MAX); do \
1299 printf "$FSNAME-OST%04x_UUID " $i; done)
1300 add_pool $POOL "$FSNAME-OST[$TGT_FIRST-$TGT_MAX/3]" "$TGT"
1301 create_dir $dir $POOL
1303 # XXX remove the interoperability code once we drop the old server
1304 # ( < 2.3.50) support.
1305 if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.50) ]; then
1306 $LFS quotaoff -ug $MOUNT
1307 $LFS quotacheck -ug $MOUNT
1309 do_facet mgs $LCTL conf_param $FSNAME.quota.ost=ug
1313 $LFS setquota -u $RUNAS_ID -b $LIMIT -B $LIMIT $dir
1315 $LFS quota -v -u $RUNAS_ID $dir
1317 $SETSTRIPE -c 1 -p $POOL $file
1318 chown $RUNAS_ID.$RUNAS_GID $file
1321 # This does two "dd" runs to ensure that the quota failure is returned
1322 # to userspace when we check. The first "dd" might otherwise complete
1323 # without error if it is only writing into cache.
1324 stat=$(LOCALE=C $RUNAS dd if=/dev/zero of=$file bs=$BUNIT_SZ \
1325 count=$((BUNIT_SZ*2)) 2>&1)
1326 echo $stat | grep "Disk quota exceeded" > /dev/null
1327 if [ $? -eq 0 ]; then
1328 $LFS quota -v -u $RUNAS_ID $dir
1329 cancel_lru_locks osc
1330 stat=$(LOCALE=C $RUNAS dd if=/dev/zero of=$file bs=$BUNIT_SZ \
1331 count=$BUNIT_SZ seek=$((BUNIT_SZ*2)) 2>&1)
1334 [[ $RC -eq 0 ]] && error "second dd did not fail."
1335 echo $stat | grep "Disk quota exceeded" > /dev/null
1336 [[ $? -eq 1 ]] && error "second dd did not fail with EDQUOT."
1338 log "first dd failed with EDQUOT."
1340 $LFS quota -v -u $RUNAS_ID $dir
1342 run_test 23a "OST pools and quota"
1346 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1347 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return 0
1350 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS || {
1351 skip_env "User $RUNAS_ID does not exist - skipping"
1357 local dir=$POOL_ROOT/dir
1358 local file="$dir/$tfile-quota"
1360 create_pool_nofail $POOL
1362 local TGT=$(for i in $(seq 0x$TGT_FIRST 3 0x$TGT_MAX); do \
1363 printf "$FSNAME-OST%04x_UUID " $i; done)
1364 add_pool $POOL "$FSNAME-OST[$TGT_FIRST-$TGT_MAX/3]" "$TGT"
1365 create_dir $dir $POOL
1367 local maxfree=$((1024 * 1024 * 30)) # 30G
1368 local AVAIL=$(lfs_df -p $POOL $dir | awk '/summary/ { print $4 }')
1369 [ $AVAIL -gt $maxfree ] &&
1370 skip_env "Filesystem space $AVAIL is larger than " \
1371 "$maxfree limit" && return 0
1373 echo "OSTCOUNT=$OSTCOUNT, OSTSIZE=$OSTSIZE, AVAIL=$AVAIL"
1374 echo "MAXFREE=$maxfree, SLOW=$SLOW"
1376 # XXX remove the interoperability code once we drop the old server
1377 # ( < 2.3.50) support.
1378 if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.50) ]; then
1379 $LFS quotaoff -ug $MOUNT
1381 do_facet mgs $LCTL conf_param $FSNAME.quota.ost=none
1385 chown $RUNAS_ID.$RUNAS_ID $dir
1389 local stime=$(date +%s)
1393 local maxtime=300 # minimum speed: 5GB / 300sec ~= 17MB/s
1394 while [ $RC -eq 0 ]; do
1396 stat=$(LOCALE=C $RUNAS2 dd if=/dev/zero of=${file}$i bs=1M \
1397 count=$((5 * 1024)) 2>&1)
1399 TOTAL=$((TOTAL + 1024 * 1024 * 5))
1400 echo "[$i iteration] $stat"
1401 echo "total written: $TOTAL"
1404 elapsed=$((etime - stime))
1405 echo "stime=$stime, etime=$etime, elapsed=$elapsed"
1407 if [ $RC -eq 1 ]; then
1408 echo $stat | grep -q "Disk quota exceeded"
1410 error "dd failed with EDQUOT with quota off"
1412 echo $stat | grep -q "No space left on device"
1414 error "dd did not fail with ENOSPC"
1415 elif [ $TOTAL -gt $AVAIL ]; then
1416 error "dd didn't fail with ENOSPC ($TOTAL > $AVAIL)"
1417 elif [ $i -eq 1 -a $elapsed -gt $maxtime ]; then
1418 log "The first 5G write used $elapsed (> $maxtime) " \
1419 "seconds, terminated"
1427 run_test 23b "OST pools and OOS"
1431 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1432 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return
1440 create_pool_nofail $POOL
1442 add_pool $POOL $TGT_ALL "$TGT_UUID"
1444 create_dir $POOL_ROOT/dir1 $POOL $OSTCOUNT
1446 mkdir $POOL_ROOT/dir2
1447 $SETSTRIPE -p $POOL -S 65536 -i 0 -c 1 $POOL_ROOT/dir2 ||
1448 error "$SETSTRIPE $POOL_ROOT/dir2 failed"
1450 mkdir $POOL_ROOT/dir3
1451 $SETSTRIPE -S 65536 -i 0 -c 1 $POOL_ROOT/dir3 ||
1452 error "$SETSTRIPE $POOL_ROOT/dir3 failed"
1454 mkdir $POOL_ROOT/dir4
1456 for i in 1 2 3 4; do
1457 dir=${POOL_ROOT}/dir${i}
1466 createmany -o $dir/${tfile} $numfiles ||
1467 error "createmany $dir/${tfile} failed!"
1468 res=$($GETSTRIPE -v $dir | grep "^stripe_count:")
1469 if [ $? -ne 0 ]; then
1470 res=$($GETSTRIPE -v $dir | grep "^(Default) ")
1471 pool=$(cut -f 9 -d ' ' <<< $res)
1472 index=$(cut -f 7 -d ' ' <<< $res)
1473 size=$(cut -f 5 -d ' ' <<< $res)
1474 count=$(cut -f 3 -d ' ' <<< $res)
1476 pool=$(cut -f 8 -d ' ' <<< $res)
1477 index=$(cut -f 6 -d ' ' <<< $res)
1478 size=$(cut -f 4 -d ' ' <<< $res)
1479 count=$(cut -f 2 -d ' ' <<< $res)
1482 for file in $dir/*; do
1483 if [ "$pool" != "" ]; then
1484 check_file_in_pool $file $pool
1486 pool1=$(file_pool $file)
1487 count1=$($GETSTRIPE -v $file | grep "^lmm_stripe_count:" |
1488 tr -d '[:blank:]' | cut -f 2 -d ':')
1489 size1=$($GETSTRIPE -v $file | grep "^lmm_stripe_size:" |
1490 tr -d '[:blank:]' | cut -f 2 -d ':')
1491 [[ "$pool" != "$pool1" ]] &&
1492 error "Pool name ($pool) not inherited in $file($pool1)"
1493 [[ "$count" != "$count1" ]] &&
1494 error "Stripe count ($count) not inherited in $file ($count1)"
1495 [[ "$size" != "$size1" ]] && [[ "$size" != "0" ]] &&
1496 error "Stripe size ($size) not inherited in $file ($size1)"
1504 run_test 24 "Independence of pool from other setstripe parameters"
1508 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1512 for i in $(seq 10); do
1513 create_pool_nofail $POOL$i
1514 do_facet mgs "lctl pool_add $FSNAME.$POOL$i OST0000; sync"
1515 wait_update $HOSTNAME "lctl get_param -n \
1516 lov.$FSNAME-*.pools.$POOL$i | sort -u |
1517 tr '\n' ' ' " "$FSNAME-OST0000_UUID " >/dev/null ||
1518 error "pool_add failed: $1; $2"
1520 facet_failover $SINGLEMDS ||
1521 error "failed to failover $SINGLEMDS"
1522 wait_osc_import_state $SINGLEMDS ost FULL
1526 # Veriy that the pool got created and is usable
1527 df $POOL_ROOT > /dev/null
1529 # Make sure OST0 can be striped on
1530 $SETSTRIPE -i 0 -c 1 $POOL_ROOT/$tfile
1531 STR=$($GETSTRIPE $POOL_ROOT/$tfile | grep 0x |
1532 cut -f2 | tr -d " ")
1533 rm $POOL_ROOT/$tfile
1534 if [[ "$STR" == "0" ]]; then
1535 echo "Creating a file in pool$i"
1536 create_file $POOL_ROOT/file$i $POOL$i || break
1537 check_file_in_pool $POOL_ROOT/file$i $POOL$i || break
1539 echo "OST 0 seems to be unavailable. Try later."
1545 run_test 25 "Create new pool and restart MDS"
1548 [[ $OSTCOUNT -le 2 ]] && skip_env "Need at least 3 OSTs" && return
1550 local dev=$(mdsdevname ${SINGLEMDS//mds/})
1551 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1555 create_pool_nofail $POOL2
1557 do_facet mgs "lctl pool_add $FSNAME.$POOL2 OST0000; sync"
1558 wait_update $HOSTNAME "lctl get_param -n \
1559 lov.$FSNAME-*.pools.$POOL2 | sort -u |
1560 grep $FSNAME-OST0000_UUID " "$FSNAME-OST0000_UUID" ||
1561 error "pool_add failed: $1; $2"
1563 do_facet mgs "lctl pool_add $FSNAME.$POOL2 OST0002; sync"
1564 wait_update $HOSTNAME "lctl get_param -n \
1565 lov.$FSNAME-*.pools.$POOL2 | sort -u |
1566 grep $FSNAME-OST0002_UUID" "$FSNAME-OST0002_UUID" ||
1567 error "pool_add failed: $1; $2"
1569 # Veriy that the pool got created and is usable
1571 echo "Creating files in $POOL2"
1573 for ((i = 0; i < 10; i++)); do
1574 #OBD_FAIL_MDS_OSC_CREATE_FAIL 0x147
1575 #Fail OST0000 to ensure objects create on
1576 #the other OST in the pool
1577 do_facet $SINGLEMDS lctl set_param fail_loc=0x147
1578 do_facet $SINGLEMDS lctl set_param fail_val=0
1579 create_file $POOL_ROOT/file$i $POOL2 1 -1 || break
1580 do_facet $SINGLEMDS lctl set_param fail_loc=0
1581 check_file_in_pool $POOL_ROOT/file$i $POOL2 || break
1585 run_test 26 "Choose other OSTs in the pool first in the creation remedy"
1590 cleanup_pools $FSNAME
1591 check_and_cleanup_lustre