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 mgs 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 mgs 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 mgs 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 mgs 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 mgs 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 mgs 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 mgs 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 mgs 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 mgs 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 mgs 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 mgs 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 mgs 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 mgs 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 mgs lctl pool_add $FSNAME.$POOL OST0000
370 RC=$?; [[ $RC -eq 0 ]] ||
371 error "pool_add failed. $FSNAME $POOL OST0000: $RC"
372 do_facet mgs lctl pool_remove $FSNAME.$POOL OST0000
376 do_facet mgs 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 mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000
382 # 3. $FSNAME-OST0000_UUID
383 do_facet mgs 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 mgs 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 mgs lctl pool_add $FSNAME.$POOL $TGT
394 [[ $? -eq 0 ]] || error "pool_add failed. $FSNAME.$POOL $TGT. $RC"
395 do_facet mgs lctl pool_remove $FSNAME.$POOL $TGT
398 # 5. $FSNAME-OST[0-5/1]
399 do_facet mgs 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" ||
404 error "Add to pool failed"
405 do_facet mgs lctl pool_remove $FSNAME.$POOL $TGT_ALL
410 run_test 2c "pool_add: OST index combinations"
417 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
418 [[ $? -ne 0 ]] || destroy_pool $POOL
420 create_pool_nofail $POOL
422 TGT=$(printf "$FSNAME-OST%04x_UUID " $OSTCOUNT)
423 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT
424 RC=$?; [[ $RC -ne 0 ]] ||
425 error "pool_add succeeded for an OST ($TGT) that does not exist."
429 run_test 2d "pool_add: OSTs that don't exist should be rejected"
437 $LCTL get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
438 [[ $? -ne 0 ]] || destroy_pool $POOL
440 create_pool_nofail $POOL
442 TGT="$FSNAME-OST0000_UUID "
443 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT
444 wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$POOL |
445 sort -u | tr '\n' ' ' " "$TGT" || error "Add to pool failed"
446 RESULT=$(do_facet mgs \
447 "LOCALE=C $LCTL pool_add $FSNAME.$POOL $TGT 2>&1")
452 error "pool_add succeeded for an OST that was already in the pool."
454 [[ $(grep "already in pool" <<< $RESULT) ]] ||
455 error "pool_add failed as expected but error message not as expected."
459 run_test 2e "pool_add: OST already in a pool should be rejected"
463 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
464 [[ $? -ne 0 ]] || destroy_pool $POOL
467 lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000 2>/dev/null
469 error "pool_remove did not fail even though pool did not exist."
471 run_test 3a "pool_remove: non-existant pool"
476 lctl pool_remove ${NON_EXISTANT_FS}.$POOL OST0000 2>/dev/null
478 error "pool_remove did not fail even though fsname did not exist."
480 run_test 3b "pool_remove: non-existant fsname"
484 do_facet mgs lctl pool_remove $FSNAME.p1234567891234567890 \
485 $FSNAME-OST0000 2>/dev/null
487 error "pool_remove did not fail even though pool name was invalid."
489 run_test 3c "pool_remove: Invalid pool name"
491 # Testing various combinations of OST name list
494 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
495 [[ $? -ne 0 ]] || destroy_pool $POOL
497 create_pool_nofail $POOL
498 do_facet mgs lctl pool_add $FSNAME.$POOL OST0000
499 do_facet mgs lctl pool_remove $FSNAME.$POOL OST0000
500 [[ $? -eq 0 ]] || error "pool_remove failed. $FSNAME $POOL OST0000"
503 do_facet mgs lctl pool_add $FSNAME.$POOL $FSNAME-OST0000
504 do_facet mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000
505 [[ $? -eq 0 ]] || error "pool_remove failed. $FSNAME $POOL $FSNAME-OST0000"
508 do_facet mgs lctl pool_add $FSNAME.$POOL $FSNAME-OST0000_UUID
509 do_facet mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000_UUID
511 error "pool_remove failed. $FSNAME $POOL $FSNAME-OST0000_UUID"
514 add_pool $POOL $TGT_ALL "$TGT_UUID"
515 do_facet mgs lctl pool_remove $FSNAME.$POOL $TGT_ALL
516 [[ $? -eq 0 ]] || error "pool_remove failed. $FSNAME $POOL" $TGT_ALL
521 run_test 3d "pool_remove: OST index combinations"
525 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
526 [[ $? -ne 0 ]] || destroy_pool $POOL
528 do_facet mgs lctl pool_destroy $FSNAME.$POOL 2>/dev/null
530 error "pool_destroy did not fail even though pool did not exist."
532 run_test 4a "pool_destroy: non-existant pool"
536 do_facet mgs lctl pool_destroy ${NON_EXISTANT_FS}.$POOL 2>/dev/null
538 error "pool_destroy did not fail even though filesystem did not exist."
540 run_test 4b "pool_destroy: non-existant fs-name"
544 create_pool_nofail $POOL
545 add_pool $POOL "OST0000" "$FSNAME-OST0000_UUID "
547 do_facet mgs lctl pool_destroy ${FSNAME}.$POOL
548 [[ $? -ne 0 ]] || error "pool_destroy succeeded with a non-empty pool."
551 run_test 4c "pool_destroy: non-empty pool"
556 $LCMD pool_list 2>/dev/null
558 error "pool_list did not fail even though fsname missing."
560 destroy_pool $POOL 2>/dev/null
561 destroy_pool $POOL2 2>/dev/null
563 create_pool_nofail $POOL
564 create_pool_nofail $POOL2
565 $LCMD pool_list $FSNAME
566 [[ $? -eq 0 ]] || error "pool_list $FSNAME failed."
568 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT_ALL
570 $LCMD pool_list $FSNAME.$POOL
571 [[ $? -eq 0 ]] || error "pool_list $FSNAME.$POOL failed."
573 $LCMD pool_list ${NON_EXISTANT_FS} 2>/dev/null
575 error "pool_list did not fail for fsname $NON_EXISTANT_FS"
577 $LCMD pool_list ${FSNAME}.$NON_EXISTANT_POOL 2>/dev/null
579 error "pool_list did not fail for pool $NON_EXISTANT_POOL"
581 if [[ ! $(grep $SINGLEMDS <<< $LCMD) ]]; then
582 echo $LCMD pool_list $DIR
584 [[ $? -eq 0 ]] || error "pool_list failed for $DIR"
587 $LCMD pool_list ${DIR}/d1
588 [[ $? -eq 0 ]] || error "pool_list failed for ${DIR}/d1"
591 rm -rf ${DIR}nonexistant
592 $LCMD pool_list ${DIR}nonexistant 2>/dev/null
594 error "pool_list did not fail for invalid mountpoint ${DIR}nonexistant"
602 # Issue commands from client
605 run_test 5a "lfs pool_list from client"
609 sub_test_5 "do_facet $SINGLEMDS lctl"
611 run_test 5b "lctl pool_list from MDS"
615 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
616 local POOL_DIR=$POOL_ROOT/dir_tst
617 local POOL_FILE=$POOL_ROOT/file_tst
619 create_pool_nofail $POOL
621 do_facet $SINGLEMDS lctl pool_list $FSNAME
622 [[ $? -eq 0 ]] || error "pool_list $FSNAME failed."
624 add_pool $POOL $TGT_ALL "$TGT_UUID"
627 $SETSTRIPE -c -1 -p $POOL $POOL_DIR
628 [[ $? -eq 0 ]] || error "$SETSTRIPE -p $POOL failed."
629 check_dir_in_pool $POOL_DIR $POOL
631 # If an invalid pool name is specified, the command should fail
632 $SETSTRIPE -c 2 -p $INVALID_POOL $POOL_DIR 2>/dev/null
633 [[ $? -ne 0 ]] || error "setstripe to invalid pool did not fail."
635 # If the pool name does not exist, the command should fail
636 $SETSTRIPE -c 2 -p $NON_EXISTANT_POOL $POOL_DIR 2>/dev/null
637 [[ $? -ne 0 ]] || error "setstripe to non-existant pool did not fail."
639 # lfs setstripe should work as before if a pool name is not specified.
640 $SETSTRIPE -c -1 $POOL_DIR
641 [[ $? -eq 0 ]] || error "$SETSTRIPE -p $POOL_DIR failed."
642 $SETSTRIPE -c -1 $POOL_FILE
643 [[ $? -eq 0 ]] || error "$SETSTRIPE -p $POOL_FILE failed."
645 # lfs setstripe should fail if a start index that is outside the
647 create_pool_nofail $POOL2
648 add_pool $POOL2 "OST0000" "$FSNAME-OST0000_UUID "
649 $SETSTRIPE -i 1 -p $POOL2 $ROOT_POOL/$tfile 2>/dev/null
651 error "$SETSTRIPE with start index outside the pool did not fail."
654 run_test 6 "getstripe/setstripe"
658 # Create a pool, stripe a directory and file with it
661 pool_add $pool || error "pool_add failed"
662 pool_add_targets $pool 0 1 || error "pool_add_targets failed"
664 $SETSTRIPE -c 1 $DIR/$tdir/testfile1 --pool "$pool" || \
665 error "setstripe failed"
666 $SETSTRIPE -c 1 $DIR/$tdir/testfile2 --pool "$FSNAME.$pool" || \
667 error "setstripe failed"
669 mkdir $DIR/$tdir/testdir
670 $SETSTRIPE -c 1 $DIR/$tdir/testdir -p "$pool" || \
671 error "setstripe failed"
672 $SETSTRIPE -c 1 $DIR/$tdir/testdir -p "$FSNAME.$pool" || \
673 error "setstripe failed"
675 rm -f $DIR/$tdir/testfile1
676 rm -f $DIR/$tdir/testfile2
677 rmdir $DIR/$tdir/testdir
679 destroy_pool_int $FSNAME.$pool
684 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
688 # Generate pool with random name from 1 to 15 characters
690 POOLNAME=$(echo $$$RANDOM$RANDOM |
691 tr -dc 'a-zA-Z0-9' | fold -w $i |
693 echo set poolname to $POOLNAME
694 helper_test_7a $POOLNAME
697 run_test 7a "create various pool name"
702 do_facet mgs lctl pool_new qwerty
703 [ $? -ne 22 ] && error "can create a pool with no fsname"
706 do_facet mgs lctl pool_new $FSNAME.
707 [ $? -ne 22 ] && error "can create a pool with no name"
710 do_facet mgs lctl pool_new $FSNAME.0123456789^bdef
711 [ $? -ne 22 ] && error "can create a pool with an invalid name"
714 do_facet mgs lctl pool_new $FSNAME.0123456789abdefg
715 [ $? -ne 36 ] && error "can create a pool with a name too long"
719 run_test 7b "try to create pool name with invalid lengths or names"
723 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
727 # Create a pool with 15 letters
728 local pool=0123456789abcde
729 pool_add $pool || error "pool_add failed"
730 pool_add_targets $pool 0 1 || error "pool_add_targets failed"
732 # setstripe with the same pool name plus 1 letter
733 $SETSTRIPE -c 1 $DIR/$tdir/testfile1 --pool "${pool}X" && \
734 error "setstripe succedeed"
736 # setstripe with the same pool name minus 1 letter
737 $SETSTRIPE -c 1 $DIR/$tdir/testfile1 --pool "${pool%?}" && \
738 error "setstripe succedeed"
740 rm -f $DIR/$tdir/testfile1
742 destroy_pool_int $FSNAME.$pool
744 run_test 7c "create a valid pool name and setstripe with a bad one"
748 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
750 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return
752 create_pool_nofail $POOL
753 create_pool_nofail $POOL2
755 local start=$(printf %04x $((TGT_FIRST + 1)))
756 do_facet mgs lctl pool_add $FSNAME.$POOL2 \
757 $FSNAME-OST[$start-$TGT_MAX/2]
759 add_pool $POOL $TGT_HALF "$TGT_UUID2"
761 create_dir $POOL_ROOT/dir1 $POOL
762 create_dir $POOL_ROOT/dir2 $POOL2
763 check_dir_in_pool $POOL_ROOT/dir1 $POOL
764 check_dir_in_pool $POOL_ROOT/dir1 $POOL
767 createmany -o $POOL_ROOT/dir1/$tfile $numfiles ||
768 error "createmany $POOL_ROOT/dir1/$tfile failed!"
770 for file in $POOL_ROOT/dir1/*; do
771 check_file_in_pool $file $POOL
774 createmany -o $POOL_ROOT/dir2/$tfile $numfiles ||
775 error "createmany $POOL_ROOT/dir2/$tfile failed!"
776 for file in $POOL_ROOT/dir2/*; do
777 check_file_in_pool $file $POOL2
780 rm -rf $POOL_ROOT/dir?
784 run_test 11 "OSTs in overlapping/multiple pools"
788 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
790 [[ $OSTCOUNT -le 2 ]] && skip_env "Need at least 3 OSTs" && return
792 create_pool_nofail $POOL
793 create_pool_nofail $POOL2
795 local start=$(printf %04x $((TGT_FIRST + 1)))
796 do_facet mgs lctl pool_add $FSNAME.$POOL2 \
797 $FSNAME-OST[$start-$TGT_MAX/2]
799 add_pool $POOL $TGT_HALF "$TGT_UUID2"
801 echo creating some files in $POOL and $POOL2
803 create_dir $POOL_ROOT/dir1 $POOL
804 create_dir $POOL_ROOT/dir2 $POOL2
805 create_file $POOL_ROOT/file1 $POOL
806 create_file $POOL_ROOT/file2 $POOL2
808 echo Checking the files created
809 check_dir_in_pool $POOL_ROOT/dir1 $POOL
810 check_dir_in_pool $POOL_ROOT/dir2 $POOL2
811 check_file_in_pool $POOL_ROOT/file1 $POOL
812 check_file_in_pool $POOL_ROOT/file2 $POOL2
814 echo Changing the pool membership
815 do_facet mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST[$TGT_FIRST]
816 do_facet mgs lctl pool_list $FSNAME.$POOL
817 FIRST_UUID=$(echo $TGT_UUID | awk '{print $1}')
818 add_pool $POOL2 $FSNAME-OST[$TGT_FIRST] "$FIRST_UUID "
819 do_facet mgs lctl pool_list $FSNAME.$POOL2
821 echo Checking the files again
822 check_dir_in_pool $POOL_ROOT/dir1 $POOL
823 check_dir_in_pool $POOL_ROOT/dir2 $POOL2
824 check_file_in_osts $POOL_ROOT/file1 "$TGT_LIST2"
825 check_file_in_osts $POOL_ROOT/file2 "$(seq 0x$start 2 0x$TGT_MAX)"
827 echo Creating some more files
828 create_dir $POOL_ROOT/dir3 $POOL
829 create_dir $POOL_ROOT/dir4 $POOL2
830 create_file $POOL_ROOT/file3 $POOL
831 create_file $POOL_ROOT/file4 $POOL2
833 echo Checking the new files
834 check_file_in_pool $POOL_ROOT/file3 $POOL
835 check_file_in_pool $POOL_ROOT/file4 $POOL2
839 run_test 12 "OST Pool Membership"
843 [[ $OSTCOUNT -le 2 ]] && skip_env "Need at least 3 OSTs" && return
845 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
849 create_pool_nofail $POOL
850 add_pool $POOL $TGT_ALL "$TGT_UUID"
852 create_dir $POOL_ROOT/dir1 $POOL -1
853 createmany -o $POOL_ROOT/dir1/$tfile $numfiles ||
854 error "createmany $POOL_ROOT/dir1/$tfile failed!"
855 for file in $POOL_ROOT/dir1/*; do
856 check_file_in_pool $file $POOL $OSTCOUNT
859 create_file $POOL_ROOT/dir1/file1 $POOL 1 $TGT_FIRST
860 create_file $POOL_ROOT/dir1/file2 $POOL 1 $((TGT_FIRST + 1))
861 create_file $POOL_ROOT/dir1/file3 $POOL 1 $((TGT_FIRST + 2))
862 check_file_in_pool $POOL_ROOT/dir1/file1 $POOL 1
863 check_file_in_pool $POOL_ROOT/dir1/file2 $POOL 1
864 create_file $POOL_ROOT/dir1/file3 $POOL 1 $((TGT_FIRST + 2))
865 check_file_in_osts $POOL_ROOT/dir1/file1 $((16#$TGT_FIRST))
866 check_file_in_osts $POOL_ROOT/dir1/file2 "$((TGT_FIRST + 1))"
867 check_file_in_osts $POOL_ROOT/dir1/file3 "$((TGT_FIRST + 2))"
869 create_dir $POOL_ROOT/dir2 $POOL $count
870 createmany -o $POOL_ROOT/dir2/$tfile- $numfiles ||
871 error "createmany $POOL_ROOT/dir2/$tfile- failed!"
872 for file in $POOL_ROOT/dir2/*; do
873 check_file_in_pool $file $POOL $count
876 create_dir $POOL_ROOT/dir3 $POOL $count $((TGT_FIRST + 1))
877 createmany -o $POOL_ROOT/dir3/$tfile- $numfiles ||
878 error "createmany $POOL_ROOT/dir3/$tfile- failed!"
879 for file in $POOL_ROOT/dir3/*; do
880 check_file_in_pool $file $POOL $count
883 create_dir $POOL_ROOT/dir4 $POOL 1
884 createmany -o $POOL_ROOT/dir4/$tfile- $numfiles ||
885 error "createmany $POOL_ROOT/dir4/$tfile- failed!"
886 for file in $POOL_ROOT/dir4/*; do
887 check_file_in_pool $file $POOL 1
890 create_dir $POOL_ROOT/dir5 $POOL 1 $((TGT_FIRST + 2))
891 createmany -o $POOL_ROOT/dir5/$tfile- $numfiles ||
892 error "createmany $POOL_ROOT/dir5/$tfile- failed!"
893 for file in $POOL_ROOT/dir5/*; do
894 check_file_in_pool $file $POOL 1
895 check_file_in_osts $file "$((TGT_FIRST + 2))"
898 rm -rf $POOL_ROOT/dir[1-5]/
902 run_test 13 "Striping characteristics in a pool"
906 [[ $OSTCOUNT -le 2 ]] && skip_env "Need at least 3 OSTs" && return
908 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
912 [ $OSTSIZE -gt $((MAXFREE / OSTCOUNT)) ] &&
913 skip_env "OST size $OSTSIZE is larger than $((MAXFREE / OSTCOUNT))" &&
916 create_pool_nofail $POOL
917 create_pool_nofail $POOL2
919 add_pool $POOL $TGT_HALF "$TGT_UUID2"
920 add_pool $POOL2 "OST0000" "$FSNAME-OST0000_UUID "
922 create_dir $POOL_ROOT/dir1 $POOL 1
923 create_file $POOL_ROOT/dir1/file $POOL 1
924 local OST=$($GETSTRIPE -i $POOL_ROOT/dir1/file)
926 while [[ $i -lt $numfiles ]]; do
928 [[ $OST -gt $((16#$TGT_MAX)) ]] && OST=$TGT_FIRST
930 # echo "Iteration: $i OST: $OST"
931 create_file $POOL_ROOT/dir1/file${i} $POOL 1
932 check_file_in_pool $POOL_ROOT/dir1/file${i} $POOL
936 # Fill up OST0 until it is nearly full.
937 # Create 9 files of size OST0_SIZE/10 each.
938 create_dir $POOL_ROOT/dir2 $POOL2 1
939 $LFS df $POOL_ROOT/dir2
940 OST0_SIZE=$($LFS df $POOL_ROOT/dir2 | awk '/\[OST:0\]/ { print $4 }')
941 FILE_SIZE=$((OST0_SIZE/1024/10))
942 echo "Filling OST0 with 9 files of ${FILE_SIZE}MB in $POOL_ROOT/dir2"
944 while [[ $i -lt 10 ]]; do
945 dd if=/dev/zero of=$POOL_ROOT/dir2/f${i} bs=1M count=$FILE_SIZE
948 sleep 1 # get new statfs info
949 $LFS df $POOL_ROOT/dir2
951 # OST $TGT_FIRST is no longer favored; but it may still be used.
952 create_dir $POOL_ROOT/dir3 $POOL 1
953 create_file $POOL_ROOT/dir3/file $POOL 1
954 createmany -o $POOL_ROOT/dir3/$tfile- $numfiles ||
955 error "createmany $POOL_ROOT/dir3/$tfile- failed!"
956 for file in $POOL_ROOT/dir3/*; do
957 check_file_in_pool $file $POOL
964 run_test 14 "Round robin and QOS striping within a pool"
968 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
972 while [[ $i -lt $OSTCOUNT ]]; do
973 create_pool_nofail $POOL${i}
975 local tgt=$(printf "$FSNAME-OST%04x_UUID " $i)
976 add_pool $POOL${i} "$FSNAME-OST[$(printf %04x $i)]" "$tgt"
977 create_dir $POOL_ROOT/dir${i} $POOL${i}
978 createmany -o $POOL_ROOT/dir$i/$tfile $numfiles ||
979 error "createmany $POOL_ROOT/dir$i/$tfile failed!"
981 for file in $POOL_ROOT/dir$i/*; do
982 check_file_in_osts $file $i
990 run_test 15 "One directory per OST/pool"
994 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
998 create_pool_nofail $POOL
1000 add_pool $POOL $TGT_HALF "$TGT_UUID2"
1002 local dir=$POOL_ROOT/$tdir
1003 create_dir $dir $POOL
1005 for i in $(seq 1 10); do
1010 createmany -o $dir/$tfile $numfiles ||
1011 error "createmany $dir/$tfile failed!"
1013 for file in $dir/*; do
1014 check_file_in_pool $file $POOL
1017 rm -rf $POOL_ROOT/$tdir
1021 run_test 16 "Inheritance of pool properties"
1025 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1029 create_pool_nofail $POOL
1031 add_pool $POOL $TGT_ALL "$TGT_UUID"
1033 local dir=$POOL_ROOT/dir
1034 create_dir $dir $POOL
1036 createmany -o $dir/${tfile}1_ $numfiles ||
1037 error "createmany $dir/${tfile}1_ failed!"
1039 for file in $dir/*; do
1040 check_file_in_pool $file $POOL
1045 createmany -o $dir/${tfile}2_ $numfiles ||
1046 error "createmany $dir/${tfile}2_ failed!"
1051 run_test 17 "Referencing an empty pool"
1060 wait_delete_completed >/dev/null # give pending IO a chance to go to disk
1061 stat=$(createmany -o $cdir/${tfile} -$numsec | tail -1)
1062 files=$(echo $stat | cut -f 2 -d ' ')
1064 unlinkmany $cdir/${tfile} $files > /dev/null
1072 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1075 local plaindir=$POOL_ROOT/plaindir
1076 local pooldir=$POOL_ROOT/pooldir
1082 for i in $(seq 1 $iter); do
1083 echo "Create performance, iteration $i, $numsec seconds x 3"
1085 local files1=$(create_perf $plaindir $numsec)
1086 [[ $files1 -eq 0 ]] && error "Zero files created without pool"
1088 echo "iter $i: $files1 creates without pool"
1090 create_pool_nofail $POOL > /dev/null
1091 add_pool $POOL $TGT_ALL "$TGT_UUID" > /dev/null
1092 create_dir $pooldir $POOL
1093 local files2=$(create_perf $pooldir $numsec)
1094 [[ $files2 -eq 0 ]] && error "Zero files created with pool"
1096 echo "iter $i: $files2 creates with pool"
1098 destroy_pool $POOL > /dev/null
1099 local files3=$(create_perf $pooldir $numsec)
1100 [[ $files3 -eq 0 ]] &&
1101 error "Zero files created with missing pool"
1103 echo "iter $i: $files3 creates with missing pool"
1108 echo Avg files created in $numsec seconds without pool: $((f1 / iter))
1109 echo Avg files created in $numsec seconds with pool: $((f2 / iter))
1110 echo Avg files created in $numsec seconds missing pool: $((f3 / iter))
1112 # Set this high until we establish a baseline for what the degradation
1116 diff=$((($f1 - $f2) * 100 / $f1))
1117 echo "No pool / wide pool: $diff %."
1118 [ $diff -gt $max ] &&
1119 error_ignore bz23408 "Degradation with wide pool is $diff% > $max%"
1122 diff=$((($f1 - $f3) * 100 / $f1))
1123 echo "No pool / missing pool: $diff %."
1124 [ $diff -gt $max ] &&
1125 error_ignore bz23408 "Degradation with wide pool is $diff% > $max%"
1129 run_test 18 "File create in a directory which references a deleted pool"
1133 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1135 local dir1=$POOL_ROOT/dir1
1136 local dir2=$POOL_ROOT/dir2
1139 create_pool_nofail $POOL
1141 add_pool $POOL $TGT_HALF "$TGT_UUID2"
1143 create_dir $dir1 $POOL
1144 createmany -o $dir1/${tfile} $numfiles ||
1145 error "createmany $dir1/${tfile} failed!"
1146 for file in $dir1/*; do
1147 check_file_in_pool $file $POOL
1151 createmany -o $dir2/${tfile} $numfiles ||
1152 error "createmany $dir2/${tfile} failed!"
1153 for file in $dir2/*; do
1154 check_file_not_in_pool $file $POOL
1161 run_test 19 "Pools should not come into play when not specified"
1165 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1167 local dir1=$POOL_ROOT/dir1
1168 local dir2=$dir1/dir2
1169 local dir3=$dir1/dir3
1173 create_pool_nofail $POOL
1174 create_pool_nofail $POOL2
1176 add_pool $POOL $TGT_HALF "$TGT_UUID2"
1178 local start=$(printf %04x $((TGT_FIRST + 1)))
1179 TGT=$(for i in $(seq 0x$start 2 0x$TGT_MAX); do \
1180 printf "$FSNAME-OST%04x_UUID " $i; done)
1181 add_pool $POOL2 "$FSNAME-OST[$start-$TGT_MAX/2]" "$TGT"
1183 create_dir $dir1 $POOL
1184 create_file $dir1/file1 $POOL2
1185 create_dir $dir2 $POOL2
1188 $SETSTRIPE -c 1 $dir3 # No pool assignment
1190 $SETSTRIPE -c 1 $dir2/file4 # No pool assignment
1192 check_file_in_pool $dir1/file1 $POOL2
1193 check_file_in_pool $dir2/file2 $POOL2
1195 check_dir_not_in_pool $dir3 $POOL
1196 check_dir_not_in_pool $dir3 $POOL2
1198 check_file_not_in_pool $dir3/file3 $POOL
1199 check_file_not_in_pool $dir3/file3 $POOL2
1201 check_file_not_in_pool $dir2/file4 $POOL
1202 check_file_not_in_pool $dir2/file4 $POOL2
1208 run_test 20 "Different pools in a directory hierarchy."
1212 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1213 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return
1217 local dir=$POOL_ROOT/dir
1219 create_pool_nofail $POOL
1221 add_pool $POOL $TGT_HALF "$TGT_UUID2"
1223 create_dir $dir $POOL $OSTCOUNT
1224 create_file $dir/file1 $POOL $OSTCOUNT
1225 $GETSTRIPE -v $dir/file1
1226 check_file_in_pool $dir/file1 $POOL
1232 run_test 21 "OST pool with fewer OSTs than stripe count"
1240 for c in $(seq 1 10); do
1241 echo "Pool $pool, iteration $c"
1242 do_facet mgs lctl pool_add $FSNAME.$pool \
1243 OST[$TGT_FIRST-$TGT_MAX/$step] 2>/dev/null
1244 local TGT_SECOND=$(printf %04x $((TGT_FIRST + $step)))
1245 if [ $((16#$TGT_SECOND)) -le $((16#$TGT_MAX)) ]; then
1246 do_facet mgs lctl pool_remove $FSNAME.$pool \
1247 OST[$TGT_SECOND-$TGT_MAX/$step]
1250 echo loop for $pool complete
1255 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1256 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return
1260 create_pool_nofail $POOL
1261 add_pool $POOL "OST0000" "$FSNAME-OST0000_UUID "
1262 create_pool_nofail $POOL2
1263 add_pool $POOL2 "OST0000" "$FSNAME-OST0000_UUID "
1268 create_dir $POOL_ROOT $POOL
1269 createmany -o $POOL_ROOT/${tfile} $numfiles ||
1270 error "createmany $POOL_ROOT/${tfile} failed!"
1275 run_test 22 "Simultaneous manipulation of a pool"
1279 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1280 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return
1283 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS || {
1284 skip_env "User $RUNAS_ID does not exist - skipping"
1290 local BUNIT_SZ=1024 # min block quota unit(kB)
1291 local LIMIT=$((BUNIT_SZ * (OSTCOUNT + 1)))
1292 local dir=$POOL_ROOT/dir
1293 local file="$dir/$tfile-quota"
1295 create_pool_nofail $POOL
1297 local TGT=$(for i in $(seq 0x$TGT_FIRST 3 0x$TGT_MAX); do \
1298 printf "$FSNAME-OST%04x_UUID " $i; done)
1299 add_pool $POOL "$FSNAME-OST[$TGT_FIRST-$TGT_MAX/3]" "$TGT"
1300 create_dir $dir $POOL
1302 # XXX remove the interoperability code once we drop the old server
1303 # ( < 2.3.50) support.
1304 if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.50) ]; then
1305 $LFS quotaoff -ug $MOUNT
1306 $LFS quotacheck -ug $MOUNT
1308 do_facet mgs $LCTL conf_param $FSNAME.quota.ost=ug
1312 $LFS setquota -u $RUNAS_ID -b $LIMIT -B $LIMIT $dir
1314 $LFS quota -v -u $RUNAS_ID $dir
1316 $SETSTRIPE -c 1 -p $POOL $file
1317 chown $RUNAS_ID.$RUNAS_GID $file
1320 # This does two "dd" runs to ensure that the quota failure is returned
1321 # to userspace when we check. The first "dd" might otherwise complete
1322 # without error if it is only writing into cache.
1323 stat=$(LOCALE=C $RUNAS dd if=/dev/zero of=$file bs=$BUNIT_SZ \
1324 count=$((BUNIT_SZ*2)) 2>&1)
1325 echo $stat | grep "Disk quota exceeded" > /dev/null
1326 if [ $? -eq 0 ]; then
1327 $LFS quota -v -u $RUNAS_ID $dir
1328 cancel_lru_locks osc
1329 stat=$(LOCALE=C $RUNAS dd if=/dev/zero of=$file bs=$BUNIT_SZ \
1330 count=$BUNIT_SZ seek=$((BUNIT_SZ*2)) 2>&1)
1333 [[ $RC -eq 0 ]] && error "second dd did not fail."
1334 echo $stat | grep "Disk quota exceeded" > /dev/null
1335 [[ $? -eq 1 ]] && error "second dd did not fail with EDQUOT."
1337 log "first dd failed with EDQUOT."
1339 $LFS quota -v -u $RUNAS_ID $dir
1341 run_test 23a "OST pools and quota"
1345 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1346 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return 0
1349 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS || {
1350 skip_env "User $RUNAS_ID does not exist - skipping"
1356 local dir=$POOL_ROOT/dir
1357 local file="$dir/$tfile-quota"
1359 create_pool_nofail $POOL
1361 local TGT=$(for i in $(seq 0x$TGT_FIRST 3 0x$TGT_MAX); do \
1362 printf "$FSNAME-OST%04x_UUID " $i; done)
1363 add_pool $POOL "$FSNAME-OST[$TGT_FIRST-$TGT_MAX/3]" "$TGT"
1364 create_dir $dir $POOL
1366 local maxfree=$((1024 * 1024 * 30)) # 30G
1367 local AVAIL=$(lfs_df -p $POOL $dir | awk '/summary/ { print $4 }')
1368 [ $AVAIL -gt $maxfree ] &&
1369 skip_env "Filesystem space $AVAIL is larger than " \
1370 "$maxfree limit" && return 0
1372 echo "OSTCOUNT=$OSTCOUNT, OSTSIZE=$OSTSIZE, AVAIL=$AVAIL"
1373 echo "MAXFREE=$maxfree, SLOW=$SLOW"
1375 # XXX remove the interoperability code once we drop the old server
1376 # ( < 2.3.50) support.
1377 if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.50) ]; then
1378 $LFS quotaoff -ug $MOUNT
1380 do_facet mgs $LCTL conf_param $FSNAME.quota.ost=none
1384 chown $RUNAS_ID.$RUNAS_ID $dir
1388 local stime=$(date +%s)
1392 local maxtime=300 # minimum speed: 5GB / 300sec ~= 17MB/s
1393 while [ $RC -eq 0 ]; do
1395 stat=$(LOCALE=C $RUNAS2 dd if=/dev/zero of=${file}$i bs=1M \
1396 count=$((5 * 1024)) 2>&1)
1398 TOTAL=$((TOTAL + 1024 * 1024 * 5))
1399 echo "[$i iteration] $stat"
1400 echo "total written: $TOTAL"
1403 elapsed=$((etime - stime))
1404 echo "stime=$stime, etime=$etime, elapsed=$elapsed"
1406 if [ $RC -eq 1 ]; then
1407 echo $stat | grep -q "Disk quota exceeded"
1409 error "dd failed with EDQUOT with quota off"
1411 echo $stat | grep -q "No space left on device"
1413 error "dd did not fail with ENOSPC"
1414 elif [ $TOTAL -gt $AVAIL ]; then
1415 error "dd didn't fail with ENOSPC ($TOTAL > $AVAIL)"
1416 elif [ $i -eq 1 -a $elapsed -gt $maxtime ]; then
1417 log "The first 5G write used $elapsed (> $maxtime) " \
1418 "seconds, terminated"
1426 run_test 23b "OST pools and OOS"
1430 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1431 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return
1439 create_pool_nofail $POOL
1441 add_pool $POOL $TGT_ALL "$TGT_UUID"
1443 create_dir $POOL_ROOT/dir1 $POOL $OSTCOUNT
1445 mkdir $POOL_ROOT/dir2
1446 $SETSTRIPE -p $POOL -S 65536 -i 0 -c 1 $POOL_ROOT/dir2 ||
1447 error "$SETSTRIPE $POOL_ROOT/dir2 failed"
1449 mkdir $POOL_ROOT/dir3
1450 $SETSTRIPE -S 65536 -i 0 -c 1 $POOL_ROOT/dir3 ||
1451 error "$SETSTRIPE $POOL_ROOT/dir3 failed"
1453 mkdir $POOL_ROOT/dir4
1455 for i in 1 2 3 4; do
1456 dir=${POOL_ROOT}/dir${i}
1465 createmany -o $dir/${tfile} $numfiles ||
1466 error "createmany $dir/${tfile} failed!"
1467 res=$($GETSTRIPE -v $dir | grep "^stripe_count:")
1468 if [ $? -ne 0 ]; then
1469 res=$($GETSTRIPE -v $dir | grep "^(Default) ")
1470 pool=$(cut -f 9 -d ' ' <<< $res)
1471 index=$(cut -f 7 -d ' ' <<< $res)
1472 size=$(cut -f 5 -d ' ' <<< $res)
1473 count=$(cut -f 3 -d ' ' <<< $res)
1475 pool=$(cut -f 8 -d ' ' <<< $res)
1476 index=$(cut -f 6 -d ' ' <<< $res)
1477 size=$(cut -f 4 -d ' ' <<< $res)
1478 count=$(cut -f 2 -d ' ' <<< $res)
1481 for file in $dir/*; do
1482 if [ "$pool" != "" ]; then
1483 check_file_in_pool $file $pool
1485 pool1=$(file_pool $file)
1486 count1=$($GETSTRIPE -v $file | grep "^lmm_stripe_count:" |
1487 tr -d '[:blank:]' | cut -f 2 -d ':')
1488 size1=$($GETSTRIPE -v $file | grep "^lmm_stripe_size:" |
1489 tr -d '[:blank:]' | cut -f 2 -d ':')
1490 [[ "$pool" != "$pool1" ]] &&
1491 error "Pool name ($pool) not inherited in $file($pool1)"
1492 [[ "$count" != "$count1" ]] &&
1493 error "Stripe count ($count) not inherited in $file ($count1)"
1494 [[ "$size" != "$size1" ]] && [[ "$size" != "0" ]] &&
1495 error "Stripe size ($size) not inherited in $file ($size1)"
1503 run_test 24 "Independence of pool from other setstripe parameters"
1507 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1511 for i in $(seq 10); do
1512 create_pool_nofail $POOL$i
1513 do_facet mgs "lctl pool_add $FSNAME.$POOL$i OST0000; sync"
1514 wait_update $HOSTNAME "lctl get_param -n \
1515 lov.$FSNAME-*.pools.$POOL$i | sort -u |
1516 tr '\n' ' ' " "$FSNAME-OST0000_UUID " >/dev/null ||
1517 error "pool_add failed: $1; $2"
1519 facet_failover $SINGLEMDS ||
1520 error "failed to failover $SINGLEMDS"
1521 wait_osc_import_state $SINGLEMDS ost FULL
1525 # Veriy that the pool got created and is usable
1526 df $POOL_ROOT > /dev/null
1528 # Make sure OST0 can be striped on
1529 $SETSTRIPE -i 0 -c 1 $POOL_ROOT/$tfile
1530 STR=$($GETSTRIPE $POOL_ROOT/$tfile | grep 0x |
1531 cut -f2 | tr -d " ")
1532 rm $POOL_ROOT/$tfile
1533 if [[ "$STR" == "0" ]]; then
1534 echo "Creating a file in pool$i"
1535 create_file $POOL_ROOT/file$i $POOL$i || break
1536 check_file_in_pool $POOL_ROOT/file$i $POOL$i || break
1538 echo "OST 0 seems to be unavailable. Try later."
1544 run_test 25 "Create new pool and restart MDS"
1547 [[ $OSTCOUNT -le 2 ]] && skip_env "Need at least 3 OSTs" && return
1549 local dev=$(mdsdevname ${SINGLEMDS//mds/})
1550 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1554 create_pool_nofail $POOL2
1556 do_facet mgs "lctl pool_add $FSNAME.$POOL2 OST0000; sync"
1557 wait_update $HOSTNAME "lctl get_param -n \
1558 lov.$FSNAME-*.pools.$POOL2 | sort -u |
1559 grep $FSNAME-OST0000_UUID " "$FSNAME-OST0000_UUID" ||
1560 error "pool_add failed: $1; $2"
1562 do_facet mgs "lctl pool_add $FSNAME.$POOL2 OST0002; sync"
1563 wait_update $HOSTNAME "lctl get_param -n \
1564 lov.$FSNAME-*.pools.$POOL2 | sort -u |
1565 grep $FSNAME-OST0002_UUID" "$FSNAME-OST0002_UUID" ||
1566 error "pool_add failed: $1; $2"
1568 # Veriy that the pool got created and is usable
1570 echo "Creating files in $POOL2"
1572 for ((i = 0; i < 10; i++)); do
1573 #OBD_FAIL_MDS_OSC_CREATE_FAIL 0x147
1574 #Fail OST0000 to ensure objects create on
1575 #the other OST in the pool
1576 do_facet $SINGLEMDS lctl set_param fail_loc=0x147
1577 do_facet $SINGLEMDS lctl set_param fail_val=0
1578 create_file $POOL_ROOT/file$i $POOL2 1 -1 || break
1579 do_facet $SINGLEMDS lctl set_param fail_loc=0
1580 check_file_in_pool $POOL_ROOT/file$i $POOL2 || break
1584 run_test 26 "Choose other OSTs in the pool first in the creation remedy"
1589 cleanup_pools $FSNAME
1590 check_and_cleanup_lustre