3 # Run select tests by setting ONLY, or as arguments to the script.
4 # Skip specific tests by setting EXCEPT.
8 export PATH=$PWD/$SRCDIR:$SRCDIR:$PWD/$SRCDIR/../utils:$PATH:/sbin
11 ALWAYS_EXCEPT="$OST_POOLS_EXCEPT"
12 # bug number for skipped test: -
13 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
15 [ "$ALWAYS_EXCEPT$EXCEPT" ] &&
16 echo "Skipping tests: $(echo $ALWAYS_EXCEPT $EXCEPT)"
21 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
22 . $LUSTRE/tests/test-framework.sh
24 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
27 check_and_setup_lustre
30 [ "$SLOW" = "no" ] && EXCEPT_SLOW="18 23b"
37 MAXFREE=${MAXFREE:-$((2000000 * OSTCOUNT))}
41 POOL2=${POOL2:-${POOL}2}
42 POOL3=${POOL3:-${POOL}3}
43 NON_EXISTANT_POOL=nonexistantpool
44 NON_EXISTANT_FS=nonexistantfs
45 INVALID_POOL=some_invalid_pool_name
47 TGT_FIRST=$(printf %04x 0)
48 TGT_MAX=$(printf %04x $((TGT_COUNT-1)))
50 TGT_LIST=$(seq 0x$TGT_FIRST $TGT_STEP 0x$TGT_MAX)
51 TGT_LIST2=$(seq 0x$TGT_FIRST 2 0x$TGT_MAX)
53 TGT_ALL="$FSNAME-OST[$TGT_FIRST-$TGT_MAX/1]"
54 TGT_HALF="$FSNAME-OST[$TGT_FIRST-$TGT_MAX/2]"
56 TGT_UUID=$(for i in $TGT_LIST; do printf "$FSNAME-OST%04x_UUID " $i; done)
57 TGT_UUID2=$(for i in $TGT_LIST2; do printf "$FSNAME-OST%04x_UUID " $i; done)
62 local count=${3:-"-1"}
66 if [[ -n $idx ]]; then
67 $LFS setstripe -c $count -p $pool -i $idx $dir
69 $LFS setstripe -c $count -p $pool $dir
71 [[ $? -eq 0 ]] || error "$LFS setstripe -p $pool $dir failed"
72 [[ "$($LFS getstripe --pool $dir)" == "$pool" ]] ||
73 error "$dir not created in expected pool '$pool'"
79 local count=${3:-"-1"}
80 local index=${4:-"-1"}
82 $LFS setstripe -i $index -c $count -p $pool $file
83 [[ $? -eq 0 ]] || error "$LFS setstripe -p $pool $file failed"
84 [[ "$($LFS getstripe --pool $file)" == "$pool" ]] ||
85 error "$file not created in '$pool'"
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=$($LFS getstripe --pool $dir)
103 [ -n "$res" ] || error "dir '$dir' not in any pool"
105 [ "$res" == "$pool" ] ||
106 error "dir '$dir' in pool '$res' instead of '$pool'"
109 check_file_in_pool() {
113 local osts=$(osts_in_pool $pool)
114 local res=$($LFS getstripe --pool $file)
116 [ -n "$res" ] || error "file '$file' not in any pool"
118 [ "$res" == "$pool" ] ||
119 error "file '$file' in pool '$res' instead of '$pool'"
121 local osts=$(osts_in_pool $2)
122 check_file_in_osts "$file" "$osts" $count
125 check_file_in_osts() {
127 local ost_list=${2:-$TGT_LIST}
129 local res=$($LFS getstripe $file | awk '/0x/ { print $1 }')
133 found=$(echo :$ost_list: | tr " " ":" | grep :$i:)
134 if [[ "$found" == "" ]]; then
135 echo "ost list: $ost_list"
136 echo "striping: $res"
137 $LFS getstripe -v $file
138 error "$file not allocated from OSTs $ost_list."
142 local ost_count=$($LFS getstripe -c $file)
143 [[ -n "$count" ]] && [[ $ost_count -ne $count ]] &&
144 error "$file stripe count $count expected; got $ost_count" &&
149 check_file_not_in_pool() {
152 local res=$($LFS getstripe --pool $file)
154 [ "$res" != "$pool" ] || error "File '$file' is in pool: $res"
157 check_dir_not_in_pool() {
160 local res=$($LFS getstripe --pool $dir)
162 [ "$res" != "$pool" ] || error "Dir '$dir' is in pool: $res"
167 wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$pool" "" ||
168 error "Failed to remove targets from pool: $pool"
174 local tgt="${3}$(lctl get_param -n lov.$FSNAME-*.pools.$pool |
175 sort -u | tr '\n' ' ')"
177 do_facet mgs lctl pool_add $FSNAME.$pool $osts
179 [[ $RC -ne 0 ]] && return $RC
181 wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$pool |
182 sort -u | tr '\n' ' ' " "$tgt" >/dev/null || RC=1
183 [[ $RC -ne 0 ]] && error "pool_add failed: $1; $2"
187 create_pool_nofail() {
188 create_pool $FSNAME.$1
189 if [[ $? != 0 ]]; then
190 error "Pool creation of $1 failed"
195 create_pool $FSNAME.$1
196 if [[ $? == 0 ]]; then
197 error "Pool creation of $1 succeeded; should have failed"
202 # Destroy pools from previous test runs
203 for p in $(do_facet mgs lctl pool_list $FSNAME | grep $POOL); do
206 rm -rf $DIR/d0.${TESTSUITE}
214 trap "cleanup_tests $FSNAME" EXIT
218 remote_mds_nodsh && skip "remote MDS with nodsh" && exit 0
219 remote_ost_nodsh && skip "remote OST with nodsh" && exit 0
223 # Tests for new commands added
229 run_test 1a "Create a pool with a 1 character pool name"
233 create_pool_nofail ${POOL}12
234 destroy_pool ${POOL}12
236 run_test 1b "Create a pool with a 10 char pool name"
240 create_pool_nofail ${POOL}1234567
241 destroy_pool ${POOL}1234567
243 run_test 1c "Create a pool with a 15 char pool name"
247 create_pool_fail ${POOL}12345678
249 run_test 1d "Create a pool with a 16 char pool name; should fail"
253 local pool_name="$POOL"
254 for ((i = 1; i <= 991; i++)); do pool_name=${pool_name}"o"; done
255 create_pool_fail $pool_name
257 run_test 1e "Create a pool with a 1000 char pool name; should fail"
261 do_facet mgs lctl pool_new .$POOL 2>/dev/null
263 error "pool_new did not fail even though fs-name was missing"
265 run_test 1f "pool_new should fail if fs-name is missing"
269 do_facet mgs lctl pool_new $POOL 2>/dev/null
271 error "pool_new did not fail even though fs-name was missing"
273 run_test 1g "pool_new should fail if fs-name is missing"
277 do_facet mgs lctl pool_new ${FSNAME}. 2>/dev/null
279 error "pool_new did not fail even though pool name was missing"
281 run_test 1h "pool_new should fail if poolname is missing"
285 do_facet mgs lctl pool_new . 2>/dev/null
287 error "pool_new did not fail even if pool and fs-name were missing"
289 run_test 1i "pool_new should fail if poolname and fs-name are missing"
293 do_facet mgs lctl pool_new ${FSNAME},$POOL 2>/dev/null
295 error "pool_new did not fail even though pool name format was wrong"
297 run_test 1j "pool_new should fail if poolname format is wrong"
301 do_facet mgs lctl pool_new ${FSNAME}/$POOL 2>/dev/null
303 error "pool_new did not fail even though pool name format was wrong"
305 run_test 1k "pool_new should fail if poolname format is wrong"
309 create_pool_nofail $POOL2
310 do_facet mgs lctl pool_new ${FSNAME}.$POOL2 2>/dev/null
312 error "pool_new did not fail even though $POOL2 existed"
315 run_test 1m "pool_new did not fail even though $POOL2 existed"
319 create_pool_nofail ${POOL}1234567
321 add_pool ${POOL}1234567 "OST0000" "$FSNAME-OST0000_UUID "
322 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
323 create_dir $POOL_ROOT ${POOL}1234567
324 dd if=/dev/zero of=$POOL_ROOT/file bs=1M count=100
325 RC=$?; [[ $RC -eq 0 ]] ||
326 error "failed to write to $POOL_ROOT/file: $RC"
327 do_facet mgs lctl pool_remove $FSNAME.${POOL}1234567 OST0000
328 drain_pool ${POOL}1234567
330 destroy_pool ${POOL}1234567
332 run_test 1n "Pool with a 15 char pool name works well"
338 do_facet mgs lctl pool_add $FSNAME.$POOL $FSNAME-OST0000 2>/dev/null
340 error "pool_add did not fail even though $POOL did not exist"
342 run_test 2a "pool_add: non-existant pool $POOL"
346 do_facet mgs lctl pool_add $FSNAME.${POOL}1234567890 \
347 $FSNAME-OST0000 2>/dev/null
349 error "pool_add did not fail even though pool name was invalid."
351 run_test 2b "pool_add: Invalid pool name"
353 # Testing various combinations of OST name list
359 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
360 [[ $? -ne 0 ]] || destroy_pool $POOL
362 create_pool_nofail $POOL
365 do_facet mgs lctl pool_add $FSNAME.$POOL OST0000
366 RC=$?; [[ $RC -eq 0 ]] ||
367 error "pool_add failed. $FSNAME $POOL OST0000: $RC"
368 do_facet mgs lctl pool_remove $FSNAME.$POOL OST0000
372 do_facet mgs lctl pool_add $FSNAME.$POOL $FSNAME-OST0000
373 RC=$?; [[ $RC -eq 0 ]] ||
374 error "pool_add failed. $FSNAME $POOL $FSNAME-OST0000: $RC"
375 do_facet mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000
378 # 3. $FSNAME-OST0000_UUID
379 do_facet mgs lctl pool_add $FSNAME.$POOL $FSNAME-OST0000_UUID
380 RC=$?; [[ $RC -eq 0 ]] ||
381 error "pool_add failed. $FSNAME $POOL $FSNAME-OST0000_UUID: $RC"
382 do_facet mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000_UUID
385 # 4. $FSNAME-OST[0,1,2,3,]
387 for i in $TGT_LIST; do TGT=${TGT}$(printf "%04x," $i); done
389 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT
390 [[ $? -eq 0 ]] || error "pool_add failed. $FSNAME.$POOL $TGT. $RC"
391 do_facet mgs lctl pool_remove $FSNAME.$POOL $TGT
394 # 5. $FSNAME-OST[0-5/1]
395 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT_ALL
396 RC=$?; [[ $RC -eq 0 ]] ||
397 error "pool_add failed. $FSNAME $POOL" "$TGT_ALL $RC"
398 wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$POOL |
399 sort -u | tr '\n' ' ' " "$TGT_UUID" ||
400 error "Add to pool failed"
401 do_facet mgs lctl pool_remove $FSNAME.$POOL $TGT_ALL
406 run_test 2c "pool_add: OST index combinations"
413 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
414 [[ $? -ne 0 ]] || destroy_pool $POOL
416 create_pool_nofail $POOL
418 TGT=$(printf "$FSNAME-OST%04x_UUID " $OSTCOUNT)
419 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT
420 RC=$?; [[ $RC -ne 0 ]] ||
421 error "pool_add succeeded for an OST ($TGT) that does not exist."
425 run_test 2d "pool_add: OSTs that don't exist should be rejected"
433 $LCTL get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
434 [[ $? -ne 0 ]] || destroy_pool $POOL
436 create_pool_nofail $POOL
438 TGT="$FSNAME-OST0000_UUID "
439 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT
440 wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$POOL |
441 sort -u | tr '\n' ' ' " "$TGT" || error "Add to pool failed"
442 RESULT=$(do_facet mgs \
443 "LOCALE=C $LCTL pool_add $FSNAME.$POOL $TGT 2>&1")
448 error "pool_add succeeded for an OST that was already in the pool."
450 [[ $(grep "already in pool" <<< $RESULT) ]] ||
451 error "pool_add failed as expected but error message not as expected."
455 run_test 2e "pool_add: OST already in a pool should be rejected"
459 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
460 [[ $? -ne 0 ]] || destroy_pool $POOL
463 lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000 2>/dev/null
465 error "pool_remove did not fail even though pool did not exist."
467 run_test 3a "pool_remove: non-existant pool"
472 lctl pool_remove ${NON_EXISTANT_FS}.$POOL OST0000 2>/dev/null
474 error "pool_remove did not fail even though fsname did not exist."
476 run_test 3b "pool_remove: non-existant fsname"
480 do_facet mgs lctl pool_remove $FSNAME.p1234567891234567890 \
481 $FSNAME-OST0000 2>/dev/null
483 error "pool_remove did not fail even though pool name was invalid."
485 run_test 3c "pool_remove: Invalid pool name"
487 # Testing various combinations of OST name list
490 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
491 [[ $? -ne 0 ]] || destroy_pool $POOL
493 create_pool_nofail $POOL
494 do_facet mgs lctl pool_add $FSNAME.$POOL OST0000
495 do_facet mgs lctl pool_remove $FSNAME.$POOL OST0000
496 [[ $? -eq 0 ]] || error "pool_remove failed. $FSNAME $POOL OST0000"
499 do_facet mgs lctl pool_add $FSNAME.$POOL $FSNAME-OST0000
500 do_facet mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000
501 [[ $? -eq 0 ]] || error "pool_remove failed. $FSNAME $POOL $FSNAME-OST0000"
504 do_facet mgs lctl pool_add $FSNAME.$POOL $FSNAME-OST0000_UUID
505 do_facet mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000_UUID
507 error "pool_remove failed. $FSNAME $POOL $FSNAME-OST0000_UUID"
510 add_pool $POOL $TGT_ALL "$TGT_UUID"
511 do_facet mgs lctl pool_remove $FSNAME.$POOL $TGT_ALL
512 [[ $? -eq 0 ]] || error "pool_remove failed. $FSNAME $POOL" $TGT_ALL
517 run_test 3d "pool_remove: OST index combinations"
521 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
522 [[ $? -ne 0 ]] || destroy_pool $POOL
524 do_facet mgs lctl pool_destroy $FSNAME.$POOL 2>/dev/null
526 error "pool_destroy did not fail even though pool did not exist."
528 run_test 4a "pool_destroy: non-existant pool"
532 do_facet mgs lctl pool_destroy ${NON_EXISTANT_FS}.$POOL 2>/dev/null
534 error "pool_destroy did not fail even though filesystem did not exist."
536 run_test 4b "pool_destroy: non-existant fs-name"
540 create_pool_nofail $POOL
541 add_pool $POOL "OST0000" "$FSNAME-OST0000_UUID "
543 do_facet mgs lctl pool_destroy ${FSNAME}.$POOL
544 [[ $? -ne 0 ]] || error "pool_destroy succeeded with a non-empty pool."
547 run_test 4c "pool_destroy: non-empty pool"
552 $LCMD pool_list 2>/dev/null
554 error "pool_list did not fail even though fsname missing."
556 destroy_pool $POOL 2>/dev/null
557 destroy_pool $POOL2 2>/dev/null
559 create_pool_nofail $POOL
560 create_pool_nofail $POOL2
561 $LCMD pool_list $FSNAME
562 [[ $? -eq 0 ]] || error "pool_list $FSNAME failed."
564 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT_ALL
566 $LCMD pool_list $FSNAME.$POOL
567 [[ $? -eq 0 ]] || error "pool_list $FSNAME.$POOL failed."
569 $LCMD pool_list ${NON_EXISTANT_FS} 2>/dev/null
571 error "pool_list did not fail for fsname $NON_EXISTANT_FS"
573 $LCMD pool_list ${FSNAME}.$NON_EXISTANT_POOL 2>/dev/null
575 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=$(echo $$$RANDOM$RANDOM |
687 tr -dc 'a-zA-Z0-9' | fold -w $i |
689 echo set poolname to $POOLNAME
690 helper_test_7a $POOLNAME
693 run_test 7a "create various pool name"
698 do_facet mgs lctl pool_new qwerty
699 [ $? -ne 22 ] && error "can create a pool with no fsname"
702 do_facet mgs lctl pool_new $FSNAME.
703 [ $? -ne 22 ] && error "can create a pool with no name"
706 do_facet mgs lctl pool_new $FSNAME.0123456789^bdef
707 [ $? -ne 22 ] && error "can create a pool with an invalid name"
710 do_facet mgs lctl pool_new $FSNAME.0123456789abdefg
711 [ $? -ne 36 ] && error "can create a pool with a name too long"
715 run_test 7b "try to create pool name with invalid lengths or names"
719 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
723 # Create a pool with 15 letters
724 local pool=0123456789abcde
725 pool_add $pool || error "pool_add failed"
726 pool_add_targets $pool 0 1 || error "pool_add_targets failed"
728 # setstripe with the same pool name plus 1 letter
729 $SETSTRIPE -c 1 $DIR/$tdir/testfile1 --pool "${pool}X" && \
730 error "setstripe succedeed"
732 # setstripe with the same pool name minus 1 letter
733 $SETSTRIPE -c 1 $DIR/$tdir/testfile1 --pool "${pool%?}" && \
734 error "setstripe succedeed"
736 rm -f $DIR/$tdir/testfile1
738 destroy_pool_int $FSNAME.$pool
740 run_test 7c "create a valid pool name and setstripe with a bad one"
744 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
746 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return
748 create_pool_nofail $POOL
749 create_pool_nofail $POOL2
751 local start=$(printf %04x $((TGT_FIRST + 1)))
752 do_facet mgs lctl pool_add $FSNAME.$POOL2 \
753 $FSNAME-OST[$start-$TGT_MAX/2]
755 add_pool $POOL $TGT_HALF "$TGT_UUID2"
757 create_dir $POOL_ROOT/dir1 $POOL
758 create_dir $POOL_ROOT/dir2 $POOL2
761 createmany -o $POOL_ROOT/dir1/$tfile $numfiles ||
762 error "createmany $POOL_ROOT/dir1/$tfile failed!"
764 for file in $POOL_ROOT/dir1/*; do
765 check_file_in_pool $file $POOL
768 createmany -o $POOL_ROOT/dir2/$tfile $numfiles ||
769 error "createmany $POOL_ROOT/dir2/$tfile failed!"
770 for file in $POOL_ROOT/dir2/*; do
771 check_file_in_pool $file $POOL2
774 rm -rf $POOL_ROOT/dir?
778 run_test 11 "OSTs in overlapping/multiple pools"
782 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
784 [[ $OSTCOUNT -le 2 ]] && skip_env "Need at least 3 OSTs" && return
786 create_pool_nofail $POOL
787 create_pool_nofail $POOL2
789 local start=$(printf %04x $((TGT_FIRST + 1)))
790 do_facet mgs lctl pool_add $FSNAME.$POOL2 \
791 $FSNAME-OST[$start-$TGT_MAX/2]
793 add_pool $POOL $TGT_HALF "$TGT_UUID2"
795 echo creating some files in $POOL and $POOL2
797 create_dir $POOL_ROOT/dir1 $POOL
798 create_dir $POOL_ROOT/dir2 $POOL2
799 create_file $POOL_ROOT/file1 $POOL
800 create_file $POOL_ROOT/file2 $POOL2
802 echo Checking the files created
803 check_file_in_pool $POOL_ROOT/file1 $POOL
804 check_file_in_pool $POOL_ROOT/file2 $POOL2
806 echo Changing the pool membership
807 do_facet mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST[$TGT_FIRST]
808 do_facet mgs lctl pool_list $FSNAME.$POOL
809 FIRST_UUID=$(echo $TGT_UUID | awk '{print $1}')
810 add_pool $POOL2 $FSNAME-OST[$TGT_FIRST] "$FIRST_UUID "
811 do_facet mgs lctl pool_list $FSNAME.$POOL2
813 echo Checking the files again
814 check_dir_in_pool $POOL_ROOT/dir1 $POOL
815 check_dir_in_pool $POOL_ROOT/dir2 $POOL2
816 check_file_in_osts $POOL_ROOT/file1 "$TGT_LIST2"
817 check_file_in_osts $POOL_ROOT/file2 "$(seq 0x$start 2 0x$TGT_MAX)"
819 echo Creating some more files
820 create_dir $POOL_ROOT/dir3 $POOL
821 create_dir $POOL_ROOT/dir4 $POOL2
822 create_file $POOL_ROOT/file3 $POOL
823 create_file $POOL_ROOT/file4 $POOL2
825 echo Checking the new files
826 check_file_in_pool $POOL_ROOT/file3 $POOL
827 check_file_in_pool $POOL_ROOT/file4 $POOL2
831 run_test 12 "OST Pool Membership"
835 [[ $OSTCOUNT -le 2 ]] && skip_env "Need at least 3 OSTs" && return
837 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
841 create_pool_nofail $POOL
842 add_pool $POOL $TGT_ALL "$TGT_UUID"
844 create_dir $POOL_ROOT/dir1 $POOL -1
845 createmany -o $POOL_ROOT/dir1/$tfile $numfiles ||
846 error "createmany $POOL_ROOT/dir1/$tfile failed!"
847 for file in $POOL_ROOT/dir1/*; do
848 check_file_in_pool $file $POOL $OSTCOUNT
851 create_file $POOL_ROOT/dir1/file1 $POOL 1 $TGT_FIRST
852 create_file $POOL_ROOT/dir1/file2 $POOL 1 $((TGT_FIRST + 1))
853 create_file $POOL_ROOT/dir1/file3 $POOL 1 $((TGT_FIRST + 2))
854 check_file_in_osts $POOL_ROOT/dir1/file1 $((16#$TGT_FIRST))
855 check_file_in_osts $POOL_ROOT/dir1/file2 "$((TGT_FIRST + 1))"
856 check_file_in_osts $POOL_ROOT/dir1/file3 "$((TGT_FIRST + 2))"
858 create_dir $POOL_ROOT/dir2 $POOL $count
859 createmany -o $POOL_ROOT/dir2/$tfile- $numfiles ||
860 error "createmany $POOL_ROOT/dir2/$tfile- failed!"
861 for file in $POOL_ROOT/dir2/*; do
862 check_file_in_pool $file $POOL $count
865 create_dir $POOL_ROOT/dir3 $POOL $count $((TGT_FIRST + 1))
866 createmany -o $POOL_ROOT/dir3/$tfile- $numfiles ||
867 error "createmany $POOL_ROOT/dir3/$tfile- failed!"
868 for file in $POOL_ROOT/dir3/*; do
869 check_file_in_pool $file $POOL $count
872 create_dir $POOL_ROOT/dir4 $POOL 1
873 createmany -o $POOL_ROOT/dir4/$tfile- $numfiles ||
874 error "createmany $POOL_ROOT/dir4/$tfile- failed!"
875 for file in $POOL_ROOT/dir4/*; do
876 check_file_in_pool $file $POOL 1
879 create_dir $POOL_ROOT/dir5 $POOL 1 $((TGT_FIRST + 2))
880 createmany -o $POOL_ROOT/dir5/$tfile- $numfiles ||
881 error "createmany $POOL_ROOT/dir5/$tfile- failed!"
882 for file in $POOL_ROOT/dir5/*; do
883 check_file_in_pool $file $POOL 1
886 rm -rf $POOL_ROOT/dir[1-5]/
890 run_test 13 "Striping characteristics in a pool"
894 [[ $OSTCOUNT -le 2 ]] && skip_env "Need at least 3 OSTs" && return
896 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
900 [ $OSTSIZE -gt $((MAXFREE / OSTCOUNT)) ] &&
901 skip_env "OST size $OSTSIZE is larger than $((MAXFREE / OSTCOUNT))" &&
904 create_pool_nofail $POOL
905 create_pool_nofail $POOL2
907 add_pool $POOL $TGT_HALF "$TGT_UUID2"
908 add_pool $POOL2 "OST0000" "$FSNAME-OST0000_UUID "
910 create_dir $POOL_ROOT/dir1 $POOL 1
911 create_file $POOL_ROOT/dir1/file $POOL 1
912 local ost=$($LFS getstripe -i $POOL_ROOT/dir1/file)
914 while [[ $i -lt $numfiles ]]; do
916 [[ $ost -gt $((16#$TGT_MAX)) ]] && ost=$TGT_FIRST
918 # echo "Iteration: $i OST: $ost"
919 create_file $POOL_ROOT/dir1/file${i} $POOL 1
920 check_file_in_pool $POOL_ROOT/dir1/file${i} $POOL
924 # Fill up OST0 until it is nearly full.
925 # Create 9 files of size OST0_SIZE/10 each.
926 create_dir $POOL_ROOT/dir2 $POOL2 1
927 $LFS df $POOL_ROOT/dir2
928 OST0_SIZE=$($LFS df $POOL_ROOT/dir2 | awk '/\[OST:0\]/ { print $4 }')
929 FILE_SIZE=$((OST0_SIZE/1024/10))
930 echo "Filling OST0 with 9 files of ${FILE_SIZE}MB in $POOL_ROOT/dir2"
932 while [[ $i -lt 10 ]]; do
933 dd if=/dev/zero of=$POOL_ROOT/dir2/f${i} bs=1M count=$FILE_SIZE
936 sleep 1 # get new statfs info
937 $LFS df $POOL_ROOT/dir2
939 # OST $TGT_FIRST is no longer favored; but it may still be used.
940 create_dir $POOL_ROOT/dir3 $POOL 1
941 create_file $POOL_ROOT/dir3/file $POOL 1
942 createmany -o $POOL_ROOT/dir3/$tfile- $numfiles ||
943 error "createmany $POOL_ROOT/dir3/$tfile- failed!"
944 for file in $POOL_ROOT/dir3/*; do
945 check_file_in_pool $file $POOL
952 run_test 14 "Round robin and QOS striping within a pool"
956 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
960 while [[ $i -lt $OSTCOUNT ]]; do
961 create_pool_nofail $POOL${i}
963 local tgt=$(printf "$FSNAME-OST%04x_UUID " $i)
964 add_pool $POOL${i} "$FSNAME-OST[$(printf %04x $i)]" "$tgt"
965 create_dir $POOL_ROOT/dir${i} $POOL${i}
966 createmany -o $POOL_ROOT/dir$i/$tfile $numfiles ||
967 error "createmany $POOL_ROOT/dir$i/$tfile failed!"
969 for file in $POOL_ROOT/dir$i/*; do
970 check_file_in_osts $file $i
978 run_test 15 "One directory per OST/pool"
982 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
986 create_pool_nofail $POOL
988 add_pool $POOL $TGT_HALF "$TGT_UUID2"
990 local dir=$POOL_ROOT/$tdir
991 create_dir $dir $POOL
993 for i in $(seq 1 10); do
998 createmany -o $dir/$tfile $numfiles ||
999 error "createmany $dir/$tfile failed!"
1001 for file in $dir/*; do
1002 check_file_in_pool $file $POOL
1005 rm -rf $POOL_ROOT/$tdir
1009 run_test 16 "Inheritance of pool properties"
1013 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1017 create_pool_nofail $POOL
1019 add_pool $POOL $TGT_ALL "$TGT_UUID"
1021 local dir=$POOL_ROOT/dir
1022 create_dir $dir $POOL
1024 createmany -o $dir/${tfile}1_ $numfiles ||
1025 error "createmany $dir/${tfile}1_ failed!"
1027 for file in $dir/*; do
1028 check_file_in_pool $file $POOL
1033 createmany -o $dir/${tfile}2_ $numfiles ||
1034 error "createmany $dir/${tfile}2_ failed!"
1039 run_test 17 "Referencing an empty pool"
1048 wait_delete_completed >/dev/null # give pending IO a chance to go to disk
1049 stat=$(createmany -o $cdir/${tfile} -$numsec | tail -1)
1050 files=$(echo $stat | cut -f 2 -d ' ')
1052 unlinkmany $cdir/${tfile} $files > /dev/null
1060 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1063 local plaindir=$POOL_ROOT/plaindir
1064 local pooldir=$POOL_ROOT/pooldir
1070 for i in $(seq 1 $iter); do
1071 echo "Create performance, iteration $i, $numsec seconds x 3"
1073 local files1=$(create_perf $plaindir $numsec)
1074 [[ $files1 -eq 0 ]] && error "Zero files created without pool"
1076 echo "iter $i: $files1 creates without pool"
1078 create_pool_nofail $POOL > /dev/null
1079 add_pool $POOL $TGT_ALL "$TGT_UUID" > /dev/null
1080 create_dir $pooldir $POOL
1081 local files2=$(create_perf $pooldir $numsec)
1082 [[ $files2 -eq 0 ]] && error "Zero files created with pool"
1084 echo "iter $i: $files2 creates with pool"
1086 destroy_pool $POOL > /dev/null
1087 local files3=$(create_perf $pooldir $numsec)
1088 [[ $files3 -eq 0 ]] &&
1089 error "Zero files created with missing pool"
1091 echo "iter $i: $files3 creates with missing pool"
1096 echo Avg files created in $numsec seconds without pool: $((f1 / iter))
1097 echo Avg files created in $numsec seconds with pool: $((f2 / iter))
1098 echo Avg files created in $numsec seconds missing pool: $((f3 / iter))
1100 # Set this high until we establish a baseline for what the degradation
1104 diff=$((($f1 - $f2) * 100 / $f1))
1105 echo "No pool / wide pool: $diff %."
1106 [ $diff -gt $max ] &&
1107 error_ignore bz23408 "Degradation with wide pool is $diff% > $max%"
1110 diff=$((($f1 - $f3) * 100 / $f1))
1111 echo "No pool / missing pool: $diff %."
1112 [ $diff -gt $max ] &&
1113 error_ignore bz23408 "Degradation with wide pool is $diff% > $max%"
1117 run_test 18 "File create in a directory which references a deleted pool"
1121 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1123 local dir1=$POOL_ROOT/dir1
1124 local dir2=$POOL_ROOT/dir2
1127 create_pool_nofail $POOL
1129 add_pool $POOL $TGT_HALF "$TGT_UUID2"
1131 create_dir $dir1 $POOL
1132 createmany -o $dir1/${tfile} $numfiles ||
1133 error "createmany $dir1/${tfile} failed!"
1134 for file in $dir1/*; do
1135 check_file_in_pool $file $POOL
1139 createmany -o $dir2/${tfile} $numfiles ||
1140 error "createmany $dir2/${tfile} failed!"
1141 for file in $dir2/*; do
1142 check_file_not_in_pool $file $POOL
1149 run_test 19 "Pools should not come into play when not specified"
1153 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1155 local dir1=$POOL_ROOT/dir1
1156 local dir2=$dir1/dir2
1157 local dir3=$dir1/dir3
1161 create_pool_nofail $POOL
1162 create_pool_nofail $POOL2
1164 add_pool $POOL $TGT_HALF "$TGT_UUID2"
1166 local start=$(printf %04x $((TGT_FIRST + 1)))
1167 TGT=$(for i in $(seq 0x$start 2 0x$TGT_MAX); do \
1168 printf "$FSNAME-OST%04x_UUID " $i; done)
1169 add_pool $POOL2 "$FSNAME-OST[$start-$TGT_MAX/2]" "$TGT"
1171 create_dir $dir1 $POOL
1172 create_file $dir1/file1 $POOL2
1173 create_dir $dir2 $POOL2
1176 $SETSTRIPE -c 1 $dir3 # No pool assignment
1178 $SETSTRIPE -c 1 $dir2/file4 # No pool assignment
1180 check_file_in_pool $dir1/file1 $POOL2
1181 check_file_in_pool $dir2/file2 $POOL2
1183 check_dir_not_in_pool $dir3 $POOL
1184 check_dir_not_in_pool $dir3 $POOL2
1186 check_file_not_in_pool $dir3/file3 $POOL
1187 check_file_not_in_pool $dir3/file3 $POOL2
1189 check_file_not_in_pool $dir2/file4 $POOL
1190 check_file_not_in_pool $dir2/file4 $POOL2
1196 run_test 20 "Different pools in a directory hierarchy."
1200 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1201 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return
1205 local dir=$POOL_ROOT/dir
1207 create_pool_nofail $POOL
1209 add_pool $POOL $TGT_HALF "$TGT_UUID2"
1211 create_dir $dir $POOL $OSTCOUNT
1212 create_file $dir/file1 $POOL $OSTCOUNT
1213 $LFS getstripe -v $dir/file1
1214 check_file_in_pool $dir/file1 $POOL
1220 run_test 21 "OST pool with fewer OSTs than stripe count"
1228 for c in $(seq 1 10); do
1229 echo "Pool $pool, iteration $c"
1230 do_facet mgs lctl pool_add $FSNAME.$pool \
1231 OST[$TGT_FIRST-$TGT_MAX/$step] 2>/dev/null
1232 local TGT_SECOND=$(printf %04x $((TGT_FIRST + $step)))
1233 if [ $((16#$TGT_SECOND)) -le $((16#$TGT_MAX)) ]; then
1234 do_facet mgs lctl pool_remove $FSNAME.$pool \
1235 OST[$TGT_SECOND-$TGT_MAX/$step]
1238 echo loop for $pool complete
1243 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1244 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return
1248 create_pool_nofail $POOL
1249 add_pool $POOL "OST0000" "$FSNAME-OST0000_UUID "
1250 create_pool_nofail $POOL2
1251 add_pool $POOL2 "OST0000" "$FSNAME-OST0000_UUID "
1256 create_dir $POOL_ROOT $POOL
1257 createmany -o $POOL_ROOT/${tfile} $numfiles ||
1258 error "createmany $POOL_ROOT/${tfile} failed!"
1263 run_test 22 "Simultaneous manipulation of a pool"
1267 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1268 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return
1271 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS || {
1272 skip_env "User $RUNAS_ID does not exist - skipping"
1278 local BUNIT_SZ=1024 # min block quota unit(kB)
1279 local LIMIT=$((BUNIT_SZ * (OSTCOUNT + 1)))
1280 local dir=$POOL_ROOT/dir
1281 local file="$dir/$tfile-quota"
1283 create_pool_nofail $POOL
1285 local TGT=$(for i in $(seq 0x$TGT_FIRST 3 0x$TGT_MAX); do \
1286 printf "$FSNAME-OST%04x_UUID " $i; done)
1287 add_pool $POOL "$FSNAME-OST[$TGT_FIRST-$TGT_MAX/3]" "$TGT"
1288 create_dir $dir $POOL
1290 # XXX remove the interoperability code once we drop the old server
1291 # ( < 2.3.50) support.
1292 if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.50) ]; then
1293 $LFS quotaoff -ug $MOUNT
1294 $LFS quotacheck -ug $MOUNT
1296 do_facet mgs $LCTL conf_param $FSNAME.quota.ost=ug
1300 $LFS setquota -u $RUNAS_ID -b $LIMIT -B $LIMIT $dir
1302 $LFS quota -v -u $RUNAS_ID $dir
1304 $SETSTRIPE -c 1 -p $POOL $file
1305 chown $RUNAS_ID.$RUNAS_GID $file
1308 # This does two "dd" runs to ensure that the quota failure is returned
1309 # to userspace when we check. The first "dd" might otherwise complete
1310 # without error if it is only writing into cache.
1311 stat=$(LOCALE=C $RUNAS dd if=/dev/zero of=$file bs=$BUNIT_SZ \
1312 count=$((BUNIT_SZ*2)) 2>&1)
1313 echo $stat | grep "Disk quota exceeded" > /dev/null
1314 if [ $? -eq 0 ]; then
1315 $LFS quota -v -u $RUNAS_ID $dir
1316 cancel_lru_locks osc
1317 stat=$(LOCALE=C $RUNAS dd if=/dev/zero of=$file bs=$BUNIT_SZ \
1318 count=$BUNIT_SZ seek=$((BUNIT_SZ*2)) 2>&1)
1321 [[ $RC -eq 0 ]] && error "second dd did not fail."
1322 echo $stat | grep "Disk quota exceeded" > /dev/null
1323 [[ $? -eq 1 ]] && error "second dd did not fail with EDQUOT."
1325 log "first dd failed with EDQUOT."
1327 $LFS quota -v -u $RUNAS_ID $dir
1329 run_test 23a "OST pools and quota"
1333 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1334 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return 0
1337 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS || {
1338 skip_env "User $RUNAS_ID does not exist - skipping"
1344 local dir=$POOL_ROOT/dir
1345 local file="$dir/$tfile-quota"
1347 create_pool_nofail $POOL
1349 local TGT=$(for i in $(seq 0x$TGT_FIRST 3 0x$TGT_MAX); do \
1350 printf "$FSNAME-OST%04x_UUID " $i; done)
1351 add_pool $POOL "$FSNAME-OST[$TGT_FIRST-$TGT_MAX/3]" "$TGT"
1352 create_dir $dir $POOL
1354 local maxfree=$((1024 * 1024 * 30)) # 30G
1355 local AVAIL=$(lfs_df -p $POOL $dir | awk '/summary/ { print $4 }')
1356 [ $AVAIL -gt $maxfree ] &&
1357 skip_env "Filesystem space $AVAIL is larger than " \
1358 "$maxfree limit" && return 0
1360 echo "OSTCOUNT=$OSTCOUNT, OSTSIZE=$OSTSIZE, AVAIL=$AVAIL"
1361 echo "MAXFREE=$maxfree, SLOW=$SLOW"
1363 # XXX remove the interoperability code once we drop the old server
1364 # ( < 2.3.50) support.
1365 if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.50) ]; then
1366 $LFS quotaoff -ug $MOUNT
1368 do_facet mgs $LCTL conf_param $FSNAME.quota.ost=none
1372 chown $RUNAS_ID.$RUNAS_ID $dir
1376 local stime=$(date +%s)
1380 local maxtime=300 # minimum speed: 5GB / 300sec ~= 17MB/s
1381 while [ $RC -eq 0 ]; do
1383 stat=$(LOCALE=C $RUNAS2 dd if=/dev/zero of=${file}$i bs=1M \
1384 count=$((5 * 1024)) 2>&1)
1386 TOTAL=$((TOTAL + 1024 * 1024 * 5))
1387 echo "[$i iteration] $stat"
1388 echo "total written: $TOTAL"
1391 elapsed=$((etime - stime))
1392 echo "stime=$stime, etime=$etime, elapsed=$elapsed"
1394 if [ $RC -eq 1 ]; then
1395 echo $stat | grep -q "Disk quota exceeded"
1397 error "dd failed with EDQUOT with quota off"
1399 echo $stat | grep -q "No space left on device"
1401 error "dd did not fail with ENOSPC"
1402 elif [ $TOTAL -gt $AVAIL ]; then
1403 error "dd didn't fail with ENOSPC ($TOTAL > $AVAIL)"
1404 elif [ $i -eq 1 -a $elapsed -gt $maxtime ]; then
1405 log "The first 5G write used $elapsed (> $maxtime) " \
1406 "seconds, terminated"
1414 run_test 23b "OST pools and OOS"
1418 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1419 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return
1421 local server_version=$(lustre_version_code $SINGLEMDS)
1422 [[ $server_version -ge $(version_code 2.8.56) ]] ||
1423 { skip "Need server version newer than 2.8.55"; return 0; }
1431 create_pool_nofail $POOL
1433 add_pool $POOL $TGT_ALL "$TGT_UUID"
1435 create_dir $POOL_ROOT/dir1 $POOL $OSTCOUNT
1437 mkdir $POOL_ROOT/dir2
1438 $SETSTRIPE -p $POOL -S 65536 -i 0 -c 1 $POOL_ROOT/dir2 ||
1439 error "$SETSTRIPE $POOL_ROOT/dir2 failed"
1441 mkdir $POOL_ROOT/dir3
1442 $SETSTRIPE -S 65536 -i 0 -c 1 $POOL_ROOT/dir3 ||
1443 error "$SETSTRIPE $POOL_ROOT/dir3 failed"
1445 mkdir $POOL_ROOT/dir4
1447 for i in 1 2 3 4; do
1448 dir=${POOL_ROOT}/dir${i}
1457 createmany -o $dir/${tfile} $numfiles ||
1458 error "createmany $dir/${tfile} failed!"
1459 pool=$($LFS getstripe --pool $dir)
1460 index=$($LFS getstripe -i $dir)
1461 size=$($LFS getstripe -S $dir)
1462 count=$($LFS getstripe -c $dir)
1464 for file in $dir/*; do
1465 if [ "$pool" != "" ]; then
1466 check_file_in_pool $file $pool
1468 pool1=$($LFS getstripe --pool $file)
1469 count1=$($LFS getstripe -c $file)
1470 size1=$($LFS getstripe -S $file)
1471 [[ "$pool" != "$pool1" ]] &&
1472 error "Pool '$pool' not on $file:$pool1"
1473 [[ "$count" != "$count1" ]] &&
1474 error "Stripe count $count not on $file:$count1"
1475 [[ "$size" != "$size1" ]] && [[ "$size" != "0" ]] &&
1476 error "Stripe size $size not on $file:$size1"
1484 run_test 24 "Independence of pool from other setstripe parameters"
1488 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1492 for i in $(seq 10); do
1493 create_pool_nofail $POOL$i
1494 do_facet mgs "lctl pool_add $FSNAME.$POOL$i OST0000; sync"
1495 wait_update $HOSTNAME "lctl get_param -n \
1496 lov.$FSNAME-*.pools.$POOL$i | sort -u |
1497 tr '\n' ' ' " "$FSNAME-OST0000_UUID " >/dev/null ||
1498 error "pool_add failed: $1; $2"
1500 facet_failover $SINGLEMDS ||
1501 error "failed to failover $SINGLEMDS"
1502 wait_osc_import_state $SINGLEMDS ost FULL
1506 # Veriy that the pool got created and is usable
1507 df $POOL_ROOT > /dev/null
1510 # Make sure OST0 can be striped on
1511 $SETSTRIPE -i 0 -c 1 $POOL_ROOT/$tfile
1512 local STR=$($LFS getstripe -i $POOL_ROOT/$tfile)
1513 rm $POOL_ROOT/$tfile
1514 if [[ "$STR" == "0" ]]; then
1515 echo "Creating a file in pool$i"
1516 create_file $POOL_ROOT/file$i $POOL$i || break
1517 check_file_in_pool $POOL_ROOT/file$i $POOL$i || break
1519 echo "OST 0 seems to be unavailable. Try later."
1525 run_test 25 "Create new pool and restart MDS"
1528 [[ $OSTCOUNT -le 2 ]] && skip_env "Need at least 3 OSTs" && return
1530 local dev=$(mdsdevname ${SINGLEMDS//mds/})
1531 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1535 create_pool_nofail $POOL2
1537 do_facet mgs "lctl pool_add $FSNAME.$POOL2 OST0000; sync"
1538 wait_update $HOSTNAME "lctl get_param -n \
1539 lov.$FSNAME-*.pools.$POOL2 | sort -u |
1540 grep $FSNAME-OST0000_UUID " "$FSNAME-OST0000_UUID" ||
1541 error "pool_add failed: $1; $2"
1543 do_facet mgs "lctl pool_add $FSNAME.$POOL2 OST0002; sync"
1544 wait_update $HOSTNAME "lctl get_param -n \
1545 lov.$FSNAME-*.pools.$POOL2 | sort -u |
1546 grep $FSNAME-OST0002_UUID" "$FSNAME-OST0002_UUID" ||
1547 error "pool_add failed: $1; $2"
1549 # Veriy that the pool got created and is usable
1551 echo "Creating files in $POOL2"
1553 for ((i = 0; i < 10; i++)); do
1554 #OBD_FAIL_MDS_OSC_CREATE_FAIL 0x147
1555 #Fail OST0000 to ensure objects create on
1556 #the other OST in the pool
1557 do_facet $SINGLEMDS lctl set_param fail_loc=0x147
1558 do_facet $SINGLEMDS lctl set_param fail_val=0
1559 create_file $POOL_ROOT/file$i $POOL2 1 -1 || break
1560 do_facet $SINGLEMDS lctl set_param fail_loc=0
1561 check_file_in_pool $POOL_ROOT/file$i $POOL2 || break
1565 run_test 26 "Choose other OSTs in the pool first in the creation remedy"
1570 cleanup_pools $FSNAME
1571 check_and_cleanup_lustre