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 $(list_pool $FSNAME.$pool |
92 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 for OSTs to be added to the pool
182 for mds_id in $(seq $MDSCOUNT); do
183 local mdt_id=$((mds_id-1))
184 local lodname=$FSNAME-MDT$(printf "%04x" $mdt_id)-mdtlov
185 wait_update_facet mds$mds_id \
186 "lctl get_param -n lod.$lodname.pools.$pool |
187 sort -u | tr '\n' ' ' " "$tgt" >/dev/null ||
188 error "mds$mds_id:pool add failed $1; $2"
190 wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$pool |
191 sort -u | tr '\n' ' ' " "$tgt" >/dev/null ||
192 error "pool_add failed: $1; $2"
196 create_pool_nofail() {
197 create_pool $FSNAME.$1
198 [[ $? -ne 0 ]] && error "Pool creation of $1 failed"
203 create_pool $FSNAME.$1
205 error "Pool creation of $1 succeeded; should have failed"
214 remote_mds_nodsh && skip "remote MDS with nodsh" && exit 0
215 remote_ost_nodsh && skip "remote OST with nodsh" && exit 0
218 # Tests for new commands added
223 run_test 1a "Create a pool with a 1 character pool name"
226 create_pool_nofail ${POOL}12
227 destroy_pool ${POOL}12
229 run_test 1b "Create a pool with a 10 char pool name"
232 create_pool_nofail ${POOL}1234567
233 destroy_pool ${POOL}1234567
235 run_test 1c "Create a pool with a 15 char pool name"
238 create_pool_fail ${POOL}12345678
240 run_test 1d "Create a pool with a 16 char pool name; should fail"
243 local pool_name="$POOL"
244 for ((i = 1; i <= 991; i++)); do pool_name=${pool_name}"o"; done
245 create_pool_fail $pool_name
247 run_test 1e "Create a pool with a 1000 char pool name; should fail"
252 error "pool_new did not fail even though fs-name was missing"
254 run_test 1f "pool_new should fail if fs-name is missing"
259 error "pool_new did not fail even though fs-name was missing"
261 run_test 1g "pool_new should fail if fs-name is missing"
264 create_pool ${FSNAME}.
266 error "pool_new did not fail even though pool name was missing"
268 run_test 1h "pool_new should fail if poolname is missing"
273 error "pool_new did not fail even if pool/fs-name was missing"
275 run_test 1i "pool_new should fail if poolname and fs-name are missing"
278 create_pool ${FSNAME},$POOL
280 error "pool_new did not fail even if poolname format was wrong"
282 run_test 1j "pool_new should fail if poolname format is wrong"
285 create_pool ${FSNAME}/$POOL
287 error "pool_new did not fail even if poolname format was wrong"
289 run_test 1k "pool_new should fail if poolname format is wrong"
292 create_pool_nofail $POOL2
293 create_pool ${FSNAME}.$POOL2
295 error "pool_new did not fail even though $POOL2 existed"
298 run_test 1m "pool_new did not fail even though $POOL2 existed"
301 create_pool_nofail ${POOL}1234567
303 add_pool ${POOL}1234567 "OST0000" "$FSNAME-OST0000_UUID "
304 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
305 create_dir $POOL_ROOT ${POOL}1234567
306 dd if=/dev/zero of=$POOL_ROOT/file bs=1M count=100
307 RC=$?; [[ $RC -eq 0 ]] ||
308 error "failed to write to $POOL_ROOT/file: $RC"
309 do_facet mgs lctl pool_remove $FSNAME.${POOL}1234567 OST0000
310 drain_pool ${POOL}1234567
312 destroy_pool ${POOL}1234567
314 run_test 1n "Pool with a 15 char pool name works well"
319 do_facet mgs lctl pool_add $FSNAME.$POOL $FSNAME-OST0000 2>/dev/null
321 error "pool_add did not fail even though $POOL did not exist"
323 run_test 2a "pool_add: non-existant pool $POOL"
326 do_facet mgs lctl pool_add $FSNAME.${POOL}1234567890 \
327 $FSNAME-OST0000 2>/dev/null
329 error "pool_add did not fail even though pool name was invalid."
331 run_test 2b "pool_add: Invalid pool name"
333 # Testing various combinations of OST name list
338 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
339 [[ $? -ne 0 ]] || destroy_pool $POOL
341 create_pool_nofail $POOL
344 do_facet mgs lctl pool_add $FSNAME.$POOL OST0000
345 RC=$?; [[ $RC -eq 0 ]] ||
346 error "pool_add failed. $FSNAME $POOL OST0000: $RC"
347 do_facet mgs lctl pool_remove $FSNAME.$POOL OST0000
351 do_facet mgs lctl pool_add $FSNAME.$POOL $FSNAME-OST0000
352 RC=$?; [[ $RC -eq 0 ]] ||
353 error "pool_add failed. $FSNAME $POOL $FSNAME-OST0000: $RC"
354 do_facet mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000
357 # 3. $FSNAME-OST0000_UUID
358 do_facet mgs lctl pool_add $FSNAME.$POOL $FSNAME-OST0000_UUID
359 RC=$?; [[ $RC -eq 0 ]] ||
360 error "pool_add failed. $FSNAME $POOL $FSNAME-OST0000_UUID: $RC"
361 do_facet mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000_UUID
364 # 4. $FSNAME-OST[0,1,2,3,]
366 for i in $TGT_LIST; do TGT=${TGT}$(printf "%04x," $i); done
368 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT
369 [[ $? -eq 0 ]] || error "pool_add failed. $FSNAME.$POOL $TGT. $RC"
370 do_facet mgs lctl pool_remove $FSNAME.$POOL $TGT
373 # 5. $FSNAME-OST[0-5/1]
374 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT_ALL
375 RC=$?; [[ $RC -eq 0 ]] ||
376 error "pool_add failed. $FSNAME $POOL" "$TGT_ALL $RC"
377 wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$POOL |
378 sort -u | tr '\n' ' ' " "$TGT_UUID" ||
379 error "Add to pool failed"
380 do_facet mgs lctl pool_remove $FSNAME.$POOL $TGT_ALL
385 run_test 2c "pool_add: OST index combinations"
391 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
392 [[ $? -ne 0 ]] || destroy_pool $POOL
394 create_pool_nofail $POOL
396 TGT=$(printf "$FSNAME-OST%04x_UUID " $OSTCOUNT)
397 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT
398 RC=$?; [[ $RC -ne 0 ]] ||
399 error "pool_add succeeded for an OST ($TGT) that does not exist."
403 run_test 2d "pool_add: OSTs that don't exist should be rejected"
410 $LCTL get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
411 [[ $? -ne 0 ]] || destroy_pool $POOL
413 create_pool_nofail $POOL
415 TGT="$FSNAME-OST0000_UUID "
416 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT
417 wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$POOL |
418 sort -u | tr '\n' ' ' " "$TGT" || error "Add to pool failed"
419 RESULT=$(do_facet mgs \
420 "LOCALE=C $LCTL pool_add $FSNAME.$POOL $TGT 2>&1")
425 error "pool_add succeeded for an OST that was already in the pool."
427 [[ $(grep "already in pool" <<< $RESULT) ]] ||
428 error "pool_add failed as expected but error message not as expected."
432 run_test 2e "pool_add: OST already in a pool should be rejected"
435 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
436 [[ $? -ne 0 ]] || destroy_pool $POOL
439 lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000 2>/dev/null
441 error "pool_remove did not fail even though pool did not exist."
443 run_test 3a "pool_remove: non-existant pool"
447 lctl pool_remove ${NON_EXISTANT_FS}.$POOL OST0000 2>/dev/null
449 error "pool_remove did not fail even though fsname did not exist."
451 run_test 3b "pool_remove: non-existant fsname"
454 do_facet mgs lctl pool_remove $FSNAME.p1234567891234567890 \
455 $FSNAME-OST0000 2>/dev/null
457 error "pool_remove did not fail even though pool name was invalid."
459 run_test 3c "pool_remove: Invalid pool name"
461 # Testing various combinations of OST name list
463 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
464 [[ $? -ne 0 ]] || destroy_pool $POOL
466 create_pool_nofail $POOL
467 do_facet mgs lctl pool_add $FSNAME.$POOL OST0000
468 do_facet mgs lctl pool_remove $FSNAME.$POOL OST0000
469 [[ $? -eq 0 ]] || error "pool_remove failed. $FSNAME $POOL OST0000"
472 do_facet mgs lctl pool_add $FSNAME.$POOL $FSNAME-OST0000
473 do_facet mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000
474 [[ $? -eq 0 ]] || error "pool_remove failed. $FSNAME $POOL $FSNAME-OST0000"
477 do_facet mgs lctl pool_add $FSNAME.$POOL $FSNAME-OST0000_UUID
478 do_facet mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000_UUID
480 error "pool_remove failed. $FSNAME $POOL $FSNAME-OST0000_UUID"
483 add_pool $POOL $TGT_ALL "$TGT_UUID"
484 do_facet mgs lctl pool_remove $FSNAME.$POOL $TGT_ALL
485 [[ $? -eq 0 ]] || error "pool_remove failed. $FSNAME $POOL" $TGT_ALL
490 run_test 3d "pool_remove: OST index combinations"
493 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
494 [[ $? -ne 0 ]] || destroy_pool $POOL
496 do_facet mgs lctl pool_destroy $FSNAME.$POOL 2>/dev/null
498 error "pool_destroy did not fail even though pool did not exist."
500 run_test 4a "pool_destroy: non-existant pool"
503 do_facet mgs lctl pool_destroy ${NON_EXISTANT_FS}.$POOL 2>/dev/null
505 error "pool_destroy did not fail even though filesystem did not exist."
507 run_test 4b "pool_destroy: non-existant fs-name"
510 create_pool_nofail $POOL
511 add_pool $POOL "OST0000" "$FSNAME-OST0000_UUID "
513 do_facet mgs lctl pool_destroy ${FSNAME}.$POOL
514 [[ $? -ne 0 ]] || error "pool_destroy succeeded with a non-empty pool."
517 run_test 4c "pool_destroy: non-empty pool"
522 $LCMD pool_list 2>/dev/null
524 error "pool_list did not fail even though fsname missing."
526 destroy_pool $POOL 2>/dev/null
527 destroy_pool $POOL2 2>/dev/null
529 create_pool_nofail $POOL
530 create_pool_nofail $POOL2
531 $LCMD pool_list $FSNAME
532 [[ $? -eq 0 ]] || error "pool_list $FSNAME failed."
534 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT_ALL
536 $LCMD pool_list $FSNAME.$POOL
537 [[ $? -eq 0 ]] || error "pool_list $FSNAME.$POOL failed."
539 $LCMD pool_list ${NON_EXISTANT_FS} 2>/dev/null
541 error "pool_list did not fail for fsname $NON_EXISTANT_FS"
543 $LCMD pool_list ${FSNAME}.$NON_EXISTANT_POOL 2>/dev/null
545 error "pool_list did not fail for pool $NON_EXISTANT_POOL"
547 if [[ ! $(grep $SINGLEMDS <<< $LCMD) ]]; then
548 echo $LCMD pool_list $DIR
550 [[ $? -eq 0 ]] || error "pool_list failed for $DIR"
553 $LCMD pool_list ${DIR}/d1
554 [[ $? -eq 0 ]] || error "pool_list failed for ${DIR}/d1"
557 rm -rf ${DIR}nonexistant
558 $LCMD pool_list ${DIR}nonexistant 2>/dev/null
560 error "pool_list did not fail for invalid mountpoint ${DIR}nonexistant"
567 # Issue commands from client
570 run_test 5a "lfs pool_list from client"
573 sub_test_5 "do_facet $SINGLEMDS lctl"
575 run_test 5b "lctl pool_list from MDS"
578 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
579 local POOL_DIR=$POOL_ROOT/dir_tst
580 local POOL_FILE=$POOL_ROOT/file_tst
582 create_pool_nofail $POOL
584 do_facet $SINGLEMDS lctl pool_list $FSNAME
585 [[ $? -eq 0 ]] || error "pool_list $FSNAME failed."
587 add_pool $POOL $TGT_ALL "$TGT_UUID"
590 $SETSTRIPE -c -1 -p $POOL $POOL_DIR
591 [[ $? -eq 0 ]] || error "$SETSTRIPE -p $POOL failed."
592 check_dir_in_pool $POOL_DIR $POOL
594 # If an invalid pool name is specified, the command should fail
595 $SETSTRIPE -c 2 -p $INVALID_POOL $POOL_DIR 2>/dev/null
596 [[ $? -ne 0 ]] || error "setstripe to invalid pool did not fail."
598 # If the pool name does not exist, the command should fail
599 $SETSTRIPE -c 2 -p $NON_EXISTANT_POOL $POOL_DIR 2>/dev/null
600 [[ $? -ne 0 ]] || error "setstripe to non-existant pool did not fail."
602 # lfs setstripe should work as before if a pool name is not specified.
603 $SETSTRIPE -c -1 $POOL_DIR
604 [[ $? -eq 0 ]] || error "$SETSTRIPE -p $POOL_DIR failed."
605 $SETSTRIPE -c -1 $POOL_FILE
606 [[ $? -eq 0 ]] || error "$SETSTRIPE -p $POOL_FILE failed."
608 # lfs setstripe should fail if a start index that is outside the
610 create_pool_nofail $POOL2
611 add_pool $POOL2 "OST0000" "$FSNAME-OST0000_UUID "
612 $SETSTRIPE -i 1 -p $POOL2 $ROOT_POOL/$tfile 2>/dev/null
614 error "$SETSTRIPE with start index outside the pool did not fail."
616 run_test 6 "getstripe/setstripe"
620 # Create a pool, stripe a directory and file with it
623 pool_add $pool || error "pool_add failed"
624 pool_add_targets $pool 0 1 || error "pool_add_targets failed"
626 $SETSTRIPE -c 1 $DIR/$tdir/testfile1 --pool "$pool" || \
627 error "setstripe failed"
628 $SETSTRIPE -c 1 $DIR/$tdir/testfile2 --pool "$FSNAME.$pool" || \
629 error "setstripe failed"
631 mkdir $DIR/$tdir/testdir
632 $SETSTRIPE -c 1 $DIR/$tdir/testdir -p "$pool" || \
633 error "setstripe failed"
634 $SETSTRIPE -c 1 $DIR/$tdir/testdir -p "$FSNAME.$pool" || \
635 error "setstripe failed"
637 rm -f $DIR/$tdir/testfile1
638 rm -f $DIR/$tdir/testfile2
639 rmdir $DIR/$tdir/testdir
641 destroy_pool_int $FSNAME.$pool
646 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
650 # Generate pool with random name from 1 to 15 characters
652 POOLNAME=$(echo $$$RANDOM$RANDOM |
653 tr -dc 'a-zA-Z0-9' | fold -w $i |
655 echo set poolname to $POOLNAME
656 helper_test_7a $POOLNAME
659 run_test 7a "create various pool name"
665 [ $? -ne 22 ] && error "can create a pool with no fsname"
669 [ $? -ne 22 ] && error "can create a pool with no name"
672 create_pool $FSNAME.0123456789^bdef
673 [ $? -ne 22 ] && error "can create a pool with an invalid name"
676 create_pool $FSNAME.0123456789abdefg
677 [ $? -ne 36 ] && error "can create a pool with a name too long"
681 run_test 7b "try to create pool name with invalid lengths or names"
685 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
689 # Create a pool with 15 letters
690 local pool=0123456789abcde
691 pool_add $pool || error "pool_add failed"
692 pool_add_targets $pool 0 1 || error "pool_add_targets failed"
694 # setstripe with the same pool name plus 1 letter
695 $SETSTRIPE -c 1 $DIR/$tdir/testfile1 --pool "${pool}X" && \
696 error "setstripe succedeed"
698 # setstripe with the same pool name minus 1 letter
699 $SETSTRIPE -c 1 $DIR/$tdir/testfile1 --pool "${pool%?}" && \
700 error "setstripe succedeed"
702 rm -f $DIR/$tdir/testfile1
704 destroy_pool_int $FSNAME.$pool
706 run_test 7c "create a valid pool name and setstripe with a bad one"
709 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
711 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return
713 create_pool_nofail $POOL
714 create_pool_nofail $POOL2
716 local start=$(printf %04x $((TGT_FIRST + 1)))
717 do_facet mgs lctl pool_add $FSNAME.$POOL2 \
718 $FSNAME-OST[$start-$TGT_MAX/2]
720 add_pool $POOL $TGT_HALF "$TGT_UUID2"
722 create_dir $POOL_ROOT/dir1 $POOL
723 create_dir $POOL_ROOT/dir2 $POOL2
726 createmany -o $POOL_ROOT/dir1/$tfile $numfiles ||
727 error "createmany $POOL_ROOT/dir1/$tfile failed!"
729 for file in $POOL_ROOT/dir1/*; do
730 check_file_in_pool $file $POOL
733 createmany -o $POOL_ROOT/dir2/$tfile $numfiles ||
734 error "createmany $POOL_ROOT/dir2/$tfile failed!"
735 for file in $POOL_ROOT/dir2/*; do
736 check_file_in_pool $file $POOL2
739 rm -rf $POOL_ROOT/dir?
743 run_test 11 "OSTs in overlapping/multiple pools"
746 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
748 [[ $OSTCOUNT -le 2 ]] && skip_env "Need at least 3 OSTs" && return
750 create_pool_nofail $POOL
751 create_pool_nofail $POOL2
753 local start=$(printf %04x $((TGT_FIRST + 1)))
754 do_facet mgs lctl pool_add $FSNAME.$POOL2 \
755 $FSNAME-OST[$start-$TGT_MAX/2]
757 add_pool $POOL $TGT_HALF "$TGT_UUID2"
759 echo creating some files in $POOL and $POOL2
761 create_dir $POOL_ROOT/dir1 $POOL
762 create_dir $POOL_ROOT/dir2 $POOL2
763 create_file $POOL_ROOT/file1 $POOL
764 create_file $POOL_ROOT/file2 $POOL2
766 echo Checking the files created
767 check_file_in_pool $POOL_ROOT/file1 $POOL
768 check_file_in_pool $POOL_ROOT/file2 $POOL2
770 echo Changing the pool membership
771 do_facet mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST[$TGT_FIRST]
772 do_facet mgs lctl pool_list $FSNAME.$POOL
773 FIRST_UUID=$(echo $TGT_UUID | awk '{print $1}')
774 add_pool $POOL2 $FSNAME-OST[$TGT_FIRST] "$FIRST_UUID "
775 do_facet mgs lctl pool_list $FSNAME.$POOL2
777 echo Checking the files again
778 check_dir_in_pool $POOL_ROOT/dir1 $POOL
779 check_dir_in_pool $POOL_ROOT/dir2 $POOL2
780 check_file_in_osts $POOL_ROOT/file1 "$TGT_LIST2"
781 check_file_in_osts $POOL_ROOT/file2 "$(seq 0x$start 2 0x$TGT_MAX)"
783 echo Creating some more files
784 create_dir $POOL_ROOT/dir3 $POOL
785 create_dir $POOL_ROOT/dir4 $POOL2
786 create_file $POOL_ROOT/file3 $POOL
787 create_file $POOL_ROOT/file4 $POOL2
789 echo Checking the new files
790 check_file_in_pool $POOL_ROOT/file3 $POOL
791 check_file_in_pool $POOL_ROOT/file4 $POOL2
795 run_test 12 "OST Pool Membership"
798 [[ $OSTCOUNT -le 2 ]] && skip_env "Need at least 3 OSTs" && return
800 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
804 create_pool_nofail $POOL
805 add_pool $POOL $TGT_ALL "$TGT_UUID"
807 create_dir $POOL_ROOT/dir1 $POOL -1
808 createmany -o $POOL_ROOT/dir1/$tfile $numfiles ||
809 error "createmany $POOL_ROOT/dir1/$tfile failed!"
810 for file in $POOL_ROOT/dir1/*; do
811 check_file_in_pool $file $POOL $OSTCOUNT
814 create_file $POOL_ROOT/dir1/file1 $POOL 1 $TGT_FIRST
815 create_file $POOL_ROOT/dir1/file2 $POOL 1 $((TGT_FIRST + 1))
816 create_file $POOL_ROOT/dir1/file3 $POOL 1 $((TGT_FIRST + 2))
817 check_file_in_osts $POOL_ROOT/dir1/file1 $((16#$TGT_FIRST))
818 check_file_in_osts $POOL_ROOT/dir1/file2 "$((TGT_FIRST + 1))"
819 check_file_in_osts $POOL_ROOT/dir1/file3 "$((TGT_FIRST + 2))"
821 create_dir $POOL_ROOT/dir2 $POOL $count
822 createmany -o $POOL_ROOT/dir2/$tfile- $numfiles ||
823 error "createmany $POOL_ROOT/dir2/$tfile- failed!"
824 for file in $POOL_ROOT/dir2/*; do
825 check_file_in_pool $file $POOL $count
828 create_dir $POOL_ROOT/dir3 $POOL $count $((TGT_FIRST + 1))
829 createmany -o $POOL_ROOT/dir3/$tfile- $numfiles ||
830 error "createmany $POOL_ROOT/dir3/$tfile- failed!"
831 for file in $POOL_ROOT/dir3/*; do
832 check_file_in_pool $file $POOL $count
835 create_dir $POOL_ROOT/dir4 $POOL 1
836 createmany -o $POOL_ROOT/dir4/$tfile- $numfiles ||
837 error "createmany $POOL_ROOT/dir4/$tfile- failed!"
838 for file in $POOL_ROOT/dir4/*; do
839 check_file_in_pool $file $POOL 1
842 create_dir $POOL_ROOT/dir5 $POOL 1 $((TGT_FIRST + 2))
843 createmany -o $POOL_ROOT/dir5/$tfile- $numfiles ||
844 error "createmany $POOL_ROOT/dir5/$tfile- failed!"
845 for file in $POOL_ROOT/dir5/*; do
846 check_file_in_pool $file $POOL 1
849 rm -rf $POOL_ROOT/dir[1-5]/
853 run_test 13 "Striping characteristics in a pool"
856 [[ $OSTCOUNT -le 2 ]] && skip_env "Need at least 3 OSTs" && return
858 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
862 [ $OSTSIZE -gt $((MAXFREE / OSTCOUNT)) ] &&
863 skip_env "OST size $OSTSIZE is larger than $((MAXFREE / OSTCOUNT))" &&
866 create_pool_nofail $POOL
867 create_pool_nofail $POOL2
869 add_pool $POOL $TGT_HALF "$TGT_UUID2"
870 add_pool $POOL2 "OST0000" "$FSNAME-OST0000_UUID "
872 create_dir $POOL_ROOT/dir1 $POOL 1
873 create_file $POOL_ROOT/dir1/file $POOL 1
874 local ost=$($LFS getstripe -i $POOL_ROOT/dir1/file)
876 while [[ $i -lt $numfiles ]]; do
878 [[ $ost -gt $((16#$TGT_MAX)) ]] && ost=$TGT_FIRST
880 # echo "Iteration: $i OST: $ost"
881 create_file $POOL_ROOT/dir1/file${i} $POOL 1
882 check_file_in_pool $POOL_ROOT/dir1/file${i} $POOL
886 # Fill up OST0 until it is nearly full.
887 # Create 9 files of size OST0_SIZE/10 each.
888 create_dir $POOL_ROOT/dir2 $POOL2 1
889 $LFS df $POOL_ROOT/dir2
890 OST0_SIZE=$($LFS df $POOL_ROOT/dir2 | awk '/\[OST:0\]/ { print $4 }')
891 FILE_SIZE=$((OST0_SIZE/1024/10))
892 echo "Filling OST0 with 9 files of ${FILE_SIZE}MB in $POOL_ROOT/dir2"
894 while [[ $i -lt 10 ]]; do
895 dd if=/dev/zero of=$POOL_ROOT/dir2/f${i} bs=1M count=$FILE_SIZE
898 sleep 1 # get new statfs info
899 $LFS df $POOL_ROOT/dir2
901 # OST $TGT_FIRST is no longer favored; but it may still be used.
902 create_dir $POOL_ROOT/dir3 $POOL 1
903 create_file $POOL_ROOT/dir3/file $POOL 1
904 createmany -o $POOL_ROOT/dir3/$tfile- $numfiles ||
905 error "createmany $POOL_ROOT/dir3/$tfile- failed!"
906 for file in $POOL_ROOT/dir3/*; do
907 check_file_in_pool $file $POOL
914 run_test 14 "Round robin and QOS striping within a pool"
917 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
921 while [[ $i -lt $OSTCOUNT ]]; do
922 create_pool_nofail $POOL${i}
924 local tgt=$(printf "$FSNAME-OST%04x_UUID " $i)
925 add_pool $POOL${i} "$FSNAME-OST[$(printf %04x $i)]" "$tgt"
926 create_dir $POOL_ROOT/dir${i} $POOL${i}
927 createmany -o $POOL_ROOT/dir$i/$tfile $numfiles ||
928 error "createmany $POOL_ROOT/dir$i/$tfile failed!"
930 for file in $POOL_ROOT/dir$i/*; do
931 check_file_in_osts $file $i
939 run_test 15 "One directory per OST/pool"
942 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
946 create_pool_nofail $POOL
948 add_pool $POOL $TGT_HALF "$TGT_UUID2"
950 local dir=$POOL_ROOT/$tdir
951 create_dir $dir $POOL
953 for i in $(seq 1 10); do
958 createmany -o $dir/$tfile $numfiles ||
959 error "createmany $dir/$tfile failed!"
961 for file in $dir/*; do
962 check_file_in_pool $file $POOL
965 rm -rf $POOL_ROOT/$tdir
969 run_test 16 "Inheritance of pool properties"
972 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
976 create_pool_nofail $POOL
978 add_pool $POOL $TGT_ALL "$TGT_UUID"
980 local dir=$POOL_ROOT/dir
981 create_dir $dir $POOL
983 createmany -o $dir/${tfile}1_ $numfiles ||
984 error "createmany $dir/${tfile}1_ failed!"
986 for file in $dir/*; do
987 check_file_in_pool $file $POOL
992 createmany -o $dir/${tfile}2_ $numfiles ||
993 error "createmany $dir/${tfile}2_ failed!"
998 run_test 17 "Referencing an empty pool"
1007 wait_delete_completed >/dev/null # give pending IO a chance to go to disk
1008 stat=$(createmany -o $cdir/${tfile} -$numsec | tail -1)
1009 files=$(echo $stat | cut -f 2 -d ' ')
1011 unlinkmany $cdir/${tfile} $files > /dev/null
1018 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1021 local plaindir=$POOL_ROOT/plaindir
1022 local pooldir=$POOL_ROOT/pooldir
1028 for i in $(seq 1 $iter); do
1029 echo "Create performance, iteration $i, $numsec seconds x 3"
1031 local files1=$(create_perf $plaindir $numsec)
1032 [[ $files1 -eq 0 ]] && error "Zero files created without pool"
1034 echo "iter $i: $files1 creates without pool"
1036 create_pool_nofail $POOL > /dev/null
1037 add_pool $POOL $TGT_ALL "$TGT_UUID" > /dev/null
1038 create_dir $pooldir $POOL
1039 local files2=$(create_perf $pooldir $numsec)
1040 [[ $files2 -eq 0 ]] && error "Zero files created with pool"
1042 echo "iter $i: $files2 creates with pool"
1044 destroy_pool $POOL > /dev/null
1045 local files3=$(create_perf $pooldir $numsec)
1046 [[ $files3 -eq 0 ]] &&
1047 error "Zero files created with missing pool"
1049 echo "iter $i: $files3 creates with missing pool"
1054 echo Avg files created in $numsec seconds without pool: $((f1 / iter))
1055 echo Avg files created in $numsec seconds with pool: $((f2 / iter))
1056 echo Avg files created in $numsec seconds missing pool: $((f3 / iter))
1058 # Set this high until we establish a baseline for what the degradation
1062 diff=$((($f1 - $f2) * 100 / $f1))
1063 echo "No pool / wide pool: $diff %."
1064 [ $diff -gt $max ] &&
1065 error_ignore bz23408 "Degradation with wide pool is $diff% > $max%"
1068 diff=$((($f1 - $f3) * 100 / $f1))
1069 echo "No pool / missing pool: $diff %."
1070 [ $diff -gt $max ] &&
1071 error_ignore bz23408 "Degradation with wide pool is $diff% > $max%"
1075 run_test 18 "File create in a directory which references a deleted pool"
1078 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1080 local dir1=$POOL_ROOT/dir1
1081 local dir2=$POOL_ROOT/dir2
1084 create_pool_nofail $POOL
1086 add_pool $POOL $TGT_HALF "$TGT_UUID2"
1088 create_dir $dir1 $POOL
1089 createmany -o $dir1/${tfile} $numfiles ||
1090 error "createmany $dir1/${tfile} failed!"
1091 for file in $dir1/*; do
1092 check_file_in_pool $file $POOL
1096 createmany -o $dir2/${tfile} $numfiles ||
1097 error "createmany $dir2/${tfile} failed!"
1098 for file in $dir2/*; do
1099 check_file_not_in_pool $file $POOL
1106 run_test 19 "Pools should not come into play when not specified"
1109 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1111 local dir1=$POOL_ROOT/dir1
1112 local dir2=$dir1/dir2
1113 local dir3=$dir1/dir3
1117 create_pool_nofail $POOL
1118 create_pool_nofail $POOL2
1120 add_pool $POOL $TGT_HALF "$TGT_UUID2"
1122 local start=$(printf %04x $((TGT_FIRST + 1)))
1123 TGT=$(for i in $(seq 0x$start 2 0x$TGT_MAX); do \
1124 printf "$FSNAME-OST%04x_UUID " $i; done)
1125 add_pool $POOL2 "$FSNAME-OST[$start-$TGT_MAX/2]" "$TGT"
1127 create_dir $dir1 $POOL
1128 create_file $dir1/file1 $POOL2
1129 create_dir $dir2 $POOL2
1132 $SETSTRIPE -c 1 $dir3 # No pool assignment
1134 $SETSTRIPE -c 1 $dir2/file4 # No pool assignment
1136 check_file_in_pool $dir1/file1 $POOL2
1137 check_file_in_pool $dir2/file2 $POOL2
1139 check_dir_not_in_pool $dir3 $POOL
1140 check_dir_not_in_pool $dir3 $POOL2
1142 check_file_not_in_pool $dir3/file3 $POOL
1143 check_file_not_in_pool $dir3/file3 $POOL2
1145 check_file_not_in_pool $dir2/file4 $POOL
1146 check_file_not_in_pool $dir2/file4 $POOL2
1152 run_test 20 "Different pools in a directory hierarchy."
1155 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1156 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return
1160 local dir=$POOL_ROOT/dir
1162 create_pool_nofail $POOL
1164 add_pool $POOL $TGT_HALF "$TGT_UUID2"
1166 create_dir $dir $POOL $OSTCOUNT
1167 create_file $dir/file1 $POOL $OSTCOUNT
1168 $LFS getstripe -v $dir/file1
1169 check_file_in_pool $dir/file1 $POOL
1175 run_test 21 "OST pool with fewer OSTs than stripe count"
1183 for c in $(seq 1 10); do
1184 echo "Pool $pool, iteration $c"
1185 do_facet mgs lctl pool_add $FSNAME.$pool \
1186 OST[$TGT_FIRST-$TGT_MAX/$step] 2>/dev/null
1187 local TGT_SECOND=$(printf %04x $((TGT_FIRST + $step)))
1188 if [ $((16#$TGT_SECOND)) -le $((16#$TGT_MAX)) ]; then
1189 do_facet mgs lctl pool_remove $FSNAME.$pool \
1190 OST[$TGT_SECOND-$TGT_MAX/$step]
1193 echo loop for $pool complete
1197 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1198 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return
1202 create_pool_nofail $POOL
1203 add_pool $POOL "OST0000" "$FSNAME-OST0000_UUID "
1204 create_pool_nofail $POOL2
1205 add_pool $POOL2 "OST0000" "$FSNAME-OST0000_UUID "
1210 create_dir $POOL_ROOT $POOL
1211 createmany -o $POOL_ROOT/${tfile} $numfiles ||
1212 error "createmany $POOL_ROOT/${tfile} failed!"
1217 run_test 22 "Simultaneous manipulation of a pool"
1220 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1221 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return
1224 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS || {
1225 skip_env "User $RUNAS_ID does not exist - skipping"
1231 local BUNIT_SZ=1024 # min block quota unit(kB)
1232 local LIMIT=$((BUNIT_SZ * (OSTCOUNT + 1)))
1233 local dir=$POOL_ROOT/dir
1234 local file="$dir/$tfile-quota"
1236 create_pool_nofail $POOL
1238 local TGT=$(for i in $(seq 0x$TGT_FIRST 3 0x$TGT_MAX); do \
1239 printf "$FSNAME-OST%04x_UUID " $i; done)
1240 add_pool $POOL "$FSNAME-OST[$TGT_FIRST-$TGT_MAX/3]" "$TGT"
1241 create_dir $dir $POOL
1243 # XXX remove the interoperability code once we drop the old server
1244 # ( < 2.3.50) support.
1245 if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.50) ]; then
1246 $LFS quotaoff -ug $MOUNT
1247 $LFS quotacheck -ug $MOUNT
1249 do_facet mgs $LCTL conf_param $FSNAME.quota.ost=ug
1253 $LFS setquota -u $RUNAS_ID -b $LIMIT -B $LIMIT $dir
1255 $LFS quota -v -u $RUNAS_ID $dir
1257 $SETSTRIPE -c 1 -p $POOL $file
1258 chown $RUNAS_ID.$RUNAS_GID $file
1261 # This does two "dd" runs to ensure that the quota failure is returned
1262 # to userspace when we check. The first "dd" might otherwise complete
1263 # without error if it is only writing into cache.
1264 stat=$(LOCALE=C $RUNAS dd if=/dev/zero of=$file bs=$BUNIT_SZ \
1265 count=$((BUNIT_SZ*2)) 2>&1)
1266 echo $stat | grep "Disk quota exceeded" > /dev/null
1267 if [ $? -eq 0 ]; then
1268 $LFS quota -v -u $RUNAS_ID $dir
1269 cancel_lru_locks osc
1270 stat=$(LOCALE=C $RUNAS dd if=/dev/zero of=$file bs=$BUNIT_SZ \
1271 count=$BUNIT_SZ seek=$((BUNIT_SZ*2)) 2>&1)
1274 [[ $RC -eq 0 ]] && error "second dd did not fail."
1275 echo $stat | grep "Disk quota exceeded" > /dev/null
1276 [[ $? -eq 1 ]] && error "second dd did not fail with EDQUOT."
1278 log "first dd failed with EDQUOT."
1280 $LFS quota -v -u $RUNAS_ID $dir
1282 run_test 23a "OST pools and quota"
1285 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1286 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return 0
1289 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS || {
1290 skip_env "User $RUNAS_ID does not exist - skipping"
1296 local dir=$POOL_ROOT/dir
1297 local file="$dir/$tfile-quota"
1299 create_pool_nofail $POOL
1301 local TGT=$(for i in $(seq 0x$TGT_FIRST 3 0x$TGT_MAX); do \
1302 printf "$FSNAME-OST%04x_UUID " $i; done)
1303 add_pool $POOL "$FSNAME-OST[$TGT_FIRST-$TGT_MAX/3]" "$TGT"
1304 create_dir $dir $POOL
1306 local maxfree=$((1024 * 1024 * 30)) # 30G
1307 local AVAIL=$(lfs_df -p $POOL $dir | awk '/summary/ { print $4 }')
1308 [ $AVAIL -gt $maxfree ] &&
1309 skip_env "Filesystem space $AVAIL is larger than " \
1310 "$maxfree limit" && return 0
1312 echo "OSTCOUNT=$OSTCOUNT, OSTSIZE=$OSTSIZE, AVAIL=$AVAIL"
1313 echo "MAXFREE=$maxfree, SLOW=$SLOW"
1315 # XXX remove the interoperability code once we drop the old server
1316 # ( < 2.3.50) support.
1317 if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.50) ]; then
1318 $LFS quotaoff -ug $MOUNT
1320 do_facet mgs $LCTL conf_param $FSNAME.quota.ost=none
1324 chown $RUNAS_ID.$RUNAS_ID $dir
1328 local stime=$(date +%s)
1332 local maxtime=300 # minimum speed: 5GB / 300sec ~= 17MB/s
1333 while [ $RC -eq 0 ]; do
1335 stat=$(LOCALE=C $RUNAS2 dd if=/dev/zero of=${file}$i bs=1M \
1336 count=$((5 * 1024)) 2>&1)
1338 TOTAL=$((TOTAL + 1024 * 1024 * 5))
1339 echo "[$i iteration] $stat"
1340 echo "total written: $TOTAL"
1343 elapsed=$((etime - stime))
1344 echo "stime=$stime, etime=$etime, elapsed=$elapsed"
1346 if [ $RC -eq 1 ]; then
1347 echo $stat | grep -q "Disk quota exceeded"
1349 error "dd failed with EDQUOT with quota off"
1351 echo $stat | grep -q "No space left on device"
1353 error "dd did not fail with ENOSPC"
1354 elif [ $TOTAL -gt $AVAIL ]; then
1355 error "dd didn't fail with ENOSPC ($TOTAL > $AVAIL)"
1356 elif [ $i -eq 1 -a $elapsed -gt $maxtime ]; then
1357 log "The first 5G write used $elapsed (> $maxtime) " \
1358 "seconds, terminated"
1366 run_test 23b "OST pools and OOS"
1369 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1370 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return
1372 local server_version=$(lustre_version_code $SINGLEMDS)
1373 [[ $server_version -ge $(version_code 2.8.56) ]] ||
1374 { skip "Need server version newer than 2.8.55"; return 0; }
1382 create_pool_nofail $POOL
1384 add_pool $POOL $TGT_ALL "$TGT_UUID"
1386 create_dir $POOL_ROOT/dir1 $POOL $OSTCOUNT
1388 mkdir $POOL_ROOT/dir2
1389 $SETSTRIPE -p $POOL -S 65536 -i 0 -c 1 $POOL_ROOT/dir2 ||
1390 error "$SETSTRIPE $POOL_ROOT/dir2 failed"
1392 mkdir $POOL_ROOT/dir3
1393 $SETSTRIPE -S 65536 -i 0 -c 1 $POOL_ROOT/dir3 ||
1394 error "$SETSTRIPE $POOL_ROOT/dir3 failed"
1396 mkdir $POOL_ROOT/dir4
1398 for i in 1 2 3 4; do
1399 dir=${POOL_ROOT}/dir${i}
1408 createmany -o $dir/${tfile} $numfiles ||
1409 error "createmany $dir/${tfile} failed!"
1410 pool=$($LFS getstripe --pool $dir)
1411 index=$($LFS getstripe -i $dir)
1412 size=$($LFS getstripe -S $dir)
1413 count=$($LFS getstripe -c $dir)
1415 for file in $dir/*; do
1416 if [ "$pool" != "" ]; then
1417 check_file_in_pool $file $pool
1419 pool1=$($LFS getstripe --pool $file)
1420 count1=$($LFS getstripe -c $file)
1421 size1=$($LFS getstripe -S $file)
1422 [[ "$pool" != "$pool1" ]] &&
1423 error "Pool '$pool' not on $file:$pool1"
1424 [[ "$count" != "$count1" ]] &&
1425 error "Stripe count $count not on $file:$count1"
1426 [[ "$size" != "$size1" ]] && [[ "$size" != "0" ]] &&
1427 error "Stripe size $size not on $file:$size1"
1435 run_test 24 "Independence of pool from other setstripe parameters"
1438 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1442 for i in $(seq 10); do
1443 create_pool_nofail $POOL$i
1444 do_facet mgs "lctl pool_add $FSNAME.$POOL$i OST0000; sync"
1445 wait_update $HOSTNAME "lctl get_param -n \
1446 lov.$FSNAME-*.pools.$POOL$i | sort -u |
1447 tr '\n' ' ' " "$FSNAME-OST0000_UUID " >/dev/null ||
1448 error "pool_add failed: $1; $2"
1450 facet_failover $SINGLEMDS ||
1451 error "failed to failover $SINGLEMDS"
1452 wait_osc_import_state $SINGLEMDS ost FULL
1456 # Veriy that the pool got created and is usable
1457 df $POOL_ROOT > /dev/null
1460 # Make sure OST0 can be striped on
1461 $SETSTRIPE -i 0 -c 1 $POOL_ROOT/$tfile
1462 local STR=$($LFS getstripe -i $POOL_ROOT/$tfile)
1463 rm $POOL_ROOT/$tfile
1464 if [[ "$STR" == "0" ]]; then
1465 echo "Creating a file in pool$i"
1466 create_file $POOL_ROOT/file$i $POOL$i || break
1467 check_file_in_pool $POOL_ROOT/file$i $POOL$i || break
1469 echo "OST 0 seems to be unavailable. Try later."
1475 run_test 25 "Create new pool and restart MDS"
1478 [[ $OSTCOUNT -le 2 ]] && skip_env "Need at least 3 OSTs" && return
1479 local dev=$(mdsdevname ${SINGLEMDS//mds/})
1480 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1484 create_pool_nofail $POOL2
1486 do_facet mgs "lctl pool_add $FSNAME.$POOL2 OST0000; sync"
1487 wait_update $HOSTNAME "lctl get_param -n \
1488 lov.$FSNAME-*.pools.$POOL2 | sort -u |
1489 grep $FSNAME-OST0000_UUID " "$FSNAME-OST0000_UUID" ||
1490 error "pool_add failed: $1; $2"
1492 do_facet mgs "lctl pool_add $FSNAME.$POOL2 OST0002; sync"
1493 wait_update $HOSTNAME "lctl get_param -n \
1494 lov.$FSNAME-*.pools.$POOL2 | sort -u |
1495 grep $FSNAME-OST0002_UUID" "$FSNAME-OST0002_UUID" ||
1496 error "pool_add failed: $1; $2"
1498 # Veriy that the pool got created and is usable
1500 echo "Creating files in $POOL2"
1502 for ((i = 0; i < 10; i++)); do
1503 #OBD_FAIL_MDS_OSC_CREATE_FAIL 0x147
1504 #Fail OST0000 to ensure objects create on
1505 #the other OST in the pool
1506 do_facet $SINGLEMDS lctl set_param fail_loc=0x147
1507 do_facet $SINGLEMDS lctl set_param fail_val=0
1508 create_file $POOL_ROOT/file$i $POOL2 1 -1 || break
1509 do_facet $SINGLEMDS lctl set_param fail_loc=0
1510 check_file_in_pool $POOL_ROOT/file$i $POOL2 || break
1514 run_test 26 "Choose other OSTs in the pool first in the creation remedy"
1519 destroy_test_pools $FSNAME
1520 check_and_cleanup_lustre