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
29 if ! combined_mgs_mds; then
30 do_facet mgs "mkdir -p $MOUNT"
31 zconf_mount $mgs_HOST $MOUNT $MOUNT_OPTS ||
32 error "unable to mount $MOUNT on the MGS"
40 MAXFREE=${MAXFREE:-$((2000000 * OSTCOUNT))}
44 POOL2=${POOL2:-${POOL}2}
45 POOL3=${POOL3:-${POOL}3}
46 NON_EXISTANT_POOL=nonexistantpool
47 NON_EXISTANT_FS=nonexistantfs
48 INVALID_POOL=some_invalid_pool_name
50 TGT_FIRST=$(printf %04x 0)
51 TGT_MAX=$(printf %04x $((TGT_COUNT-1)))
53 TGT_LIST=$(seq 0x$TGT_FIRST $TGT_STEP 0x$TGT_MAX)
54 TGT_LIST2=$(seq 0x$TGT_FIRST 2 0x$TGT_MAX)
56 TGT_ALL="$FSNAME-OST[$TGT_FIRST-$TGT_MAX/1]"
57 TGT_HALF="$FSNAME-OST[$TGT_FIRST-$TGT_MAX/2]"
59 TGT_UUID=$(for i in $TGT_LIST; do printf "$FSNAME-OST%04x_UUID " $i; done)
60 TGT_UUID2=$(for i in $TGT_LIST2; do printf "$FSNAME-OST%04x_UUID " $i; done)
65 local count=${3:-"-1"}
69 if [[ -n $idx ]]; then
70 $LFS setstripe -c $count -p $pool -i $idx $dir
72 $LFS setstripe -c $count -p $pool $dir
74 [[ $? -eq 0 ]] || error "$LFS setstripe -p $pool $dir failed"
75 [[ "$($LFS getstripe --pool $dir)" == "$pool" ]] ||
76 error "$dir not created in expected pool '$pool'"
82 local count=${3:-"-1"}
83 local index=${4:-"-1"}
85 $LFS setstripe -i $index -c $count -p $pool $file
86 [[ $? -eq 0 ]] || error "$LFS setstripe -p $pool $file failed"
87 [[ "$($LFS getstripe --pool $file)" == "$pool" ]] ||
88 error "$file not created in '$pool'"
94 for i in $(list_pool $FSNAME.$pool |
95 sed -e 's/_UUID$//;s/^.*-OST//'); do
96 res="$res $(printf "%d" 0x$i)"
101 check_dir_in_pool() {
104 local res=$($LFS getstripe --pool $dir)
106 [ -n "$res" ] || error "dir '$dir' not in any pool"
108 [ "$res" == "$pool" ] ||
109 error "dir '$dir' in pool '$res' instead of '$pool'"
112 check_file_in_pool() {
116 local osts=$(osts_in_pool $pool)
117 local res=$($LFS getstripe --pool $file)
119 [ -n "$res" ] || error "file '$file' not in any pool"
121 [ "$res" == "$pool" ] ||
122 error "file '$file' in pool '$res' instead of '$pool'"
124 local osts=$(osts_in_pool $2)
125 check_file_in_osts "$file" "$osts" $count
128 check_file_in_osts() {
130 local ost_list=${2:-$TGT_LIST}
132 local res=$($LFS getstripe $file | awk '/0x/ { print $1 }')
136 found=$(echo :$ost_list: | tr " " ":" | grep :$i:)
137 if [[ "$found" == "" ]]; then
138 echo "ost list: $ost_list"
139 echo "striping: $res"
140 $LFS getstripe -v $file
141 error "$file not allocated from OSTs $ost_list."
145 local ost_count=$($LFS getstripe -c $file)
146 [[ -n "$count" ]] && [[ $ost_count -ne $count ]] &&
147 error "$file stripe count $count expected; got $ost_count" &&
152 check_file_not_in_pool() {
155 local res=$($LFS getstripe --pool $file)
157 [ "$res" != "$pool" ] || error "File '$file' is in pool: $res"
160 check_dir_not_in_pool() {
163 local res=$($LFS getstripe --pool $dir)
165 [ "$res" != "$pool" ] || error "Dir '$dir' is in pool: $res"
170 wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$pool" "" ||
171 error "Failed to remove targets from pool: $pool"
177 local tgt="${3}$(lctl get_param -n lov.$FSNAME-*.pools.$pool |
178 sort -u | tr '\n' ' ')"
180 do_facet mgs lctl pool_add $FSNAME.$pool $osts
182 [[ $RC -ne 0 ]] && return $RC
184 # wait for OSTs to be added to the pool
185 for mds_id in $(seq $MDSCOUNT); do
186 local mdt_id=$((mds_id-1))
187 local lodname=$FSNAME-MDT$(printf "%04x" $mdt_id)-mdtlov
188 wait_update_facet mds$mds_id \
189 "lctl get_param -n lod.$lodname.pools.$pool |
190 sort -u | tr '\n' ' ' " "$tgt" >/dev/null ||
191 error "mds$mds_id:pool add failed $1; $2"
193 wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$pool |
194 sort -u | tr '\n' ' ' " "$tgt" >/dev/null ||
195 error "pool_add failed: $1; $2"
199 create_pool_nofail() {
200 create_pool $FSNAME.$1
201 [[ $? -ne 0 ]] && error "Pool creation of $1 failed"
206 create_pool $FSNAME.$1
208 error "Pool creation of $1 succeeded; should have failed"
217 remote_mds_nodsh && skip "remote MDS with nodsh"
218 remote_ost_nodsh && skip "remote OST with nodsh"
221 # Tests for new commands added
226 run_test 1a "Create a pool with a 1 character pool name"
229 create_pool_nofail ${POOL}12
230 destroy_pool ${POOL}12
232 run_test 1b "Create a pool with a 10 char pool name"
235 create_pool_nofail ${POOL}1234567
236 destroy_pool ${POOL}1234567
238 run_test 1c "Create a pool with a 15 char pool name"
241 create_pool_fail ${POOL}12345678
243 run_test 1d "Create a pool with a 16 char pool name; should fail"
246 local pool_name="$POOL"
247 for ((i = 1; i <= 991; i++)); do pool_name=${pool_name}"o"; done
248 create_pool_fail $pool_name
250 run_test 1e "Create a pool with a 1000 char pool name; should fail"
255 error "pool_new did not fail even though fs-name was missing"
257 run_test 1f "pool_new should fail if fs-name is missing"
262 error "pool_new did not fail even though fs-name was missing"
264 run_test 1g "pool_new should fail if fs-name is missing"
267 create_pool ${FSNAME}.
269 error "pool_new did not fail even though pool name was missing"
271 run_test 1h "pool_new should fail if poolname is missing"
276 error "pool_new did not fail even if pool/fs-name was missing"
278 run_test 1i "pool_new should fail if poolname and fs-name are missing"
281 create_pool ${FSNAME},$POOL
283 error "pool_new did not fail even if poolname format was wrong"
285 run_test 1j "pool_new should fail if poolname format is wrong"
288 create_pool ${FSNAME}/$POOL
290 error "pool_new did not fail even if poolname format was wrong"
292 run_test 1k "pool_new should fail if poolname format is wrong"
295 create_pool_nofail $POOL2
296 create_pool ${FSNAME}.$POOL2
298 error "pool_new did not fail even though $POOL2 existed"
301 run_test 1m "pool_new did not fail even though $POOL2 existed"
304 create_pool_nofail ${POOL}1234567
306 add_pool ${POOL}1234567 "OST0000" "$FSNAME-OST0000_UUID "
307 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
308 create_dir $POOL_ROOT ${POOL}1234567
309 dd if=/dev/zero of=$POOL_ROOT/file bs=1M count=100
310 RC=$?; [[ $RC -eq 0 ]] ||
311 error "failed to write to $POOL_ROOT/file: $RC"
312 do_facet mgs lctl pool_remove $FSNAME.${POOL}1234567 OST0000
313 drain_pool ${POOL}1234567
315 destroy_pool ${POOL}1234567
317 run_test 1n "Pool with a 15 char pool name works well"
322 do_facet mgs lctl pool_add $FSNAME.$POOL $FSNAME-OST0000 2>/dev/null
324 error "pool_add did not fail even though $POOL did not exist"
326 run_test 2a "pool_add: non-existant pool $POOL"
329 do_facet mgs lctl pool_add $FSNAME.${POOL}1234567890 \
330 $FSNAME-OST0000 2>/dev/null
332 error "pool_add did not fail even though pool name was invalid."
334 run_test 2b "pool_add: Invalid pool name"
336 # Testing various combinations of OST name list
341 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
342 [[ $? -ne 0 ]] || destroy_pool $POOL
344 create_pool_nofail $POOL
347 do_facet mgs lctl pool_add $FSNAME.$POOL OST0000
348 RC=$?; [[ $RC -eq 0 ]] ||
349 error "pool_add failed. $FSNAME $POOL OST0000: $RC"
350 do_facet mgs lctl pool_remove $FSNAME.$POOL OST0000
354 do_facet mgs lctl pool_add $FSNAME.$POOL $FSNAME-OST0000
355 RC=$?; [[ $RC -eq 0 ]] ||
356 error "pool_add failed. $FSNAME $POOL $FSNAME-OST0000: $RC"
357 do_facet mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000
360 # 3. $FSNAME-OST0000_UUID
361 do_facet mgs lctl pool_add $FSNAME.$POOL $FSNAME-OST0000_UUID
362 RC=$?; [[ $RC -eq 0 ]] ||
363 error "pool_add failed. $FSNAME $POOL $FSNAME-OST0000_UUID: $RC"
364 do_facet mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000_UUID
367 # 4. $FSNAME-OST[0,1,2,3,]
369 for i in $TGT_LIST; do TGT=${TGT}$(printf "%04x," $i); done
371 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT
372 [[ $? -eq 0 ]] || error "pool_add failed. $FSNAME.$POOL $TGT. $RC"
373 do_facet mgs lctl pool_remove $FSNAME.$POOL $TGT
376 # 5. $FSNAME-OST[0-5/1]
377 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT_ALL
378 RC=$?; [[ $RC -eq 0 ]] ||
379 error "pool_add failed. $FSNAME $POOL" "$TGT_ALL $RC"
380 wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$POOL |
381 sort -u | tr '\n' ' ' " "$TGT_UUID" ||
382 error "Add to pool failed"
383 do_facet mgs lctl pool_remove $FSNAME.$POOL $TGT_ALL
388 run_test 2c "pool_add: OST index combinations"
394 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
395 [[ $? -ne 0 ]] || destroy_pool $POOL
397 create_pool_nofail $POOL
399 TGT=$(printf "$FSNAME-OST%04x_UUID " $OSTCOUNT)
400 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT
401 RC=$?; [[ $RC -ne 0 ]] ||
402 error "pool_add succeeded for an OST ($TGT) that does not exist."
406 run_test 2d "pool_add: OSTs that don't exist should be rejected"
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="$FSNAME-OST0000_UUID "
419 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT
420 wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$POOL |
421 sort -u | tr '\n' ' ' " "$TGT" || error "Add to pool failed"
422 RESULT=$(do_facet mgs \
423 "LOCALE=C $LCTL pool_add $FSNAME.$POOL $TGT 2>&1")
428 error "pool_add succeeded for an OST that was already in the pool."
430 [[ $(grep "already in pool" <<< $RESULT) ]] ||
431 error "pool_add failed as expected but error message not as expected."
435 run_test 2e "pool_add: OST already in a pool should be rejected"
438 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
439 [[ $? -ne 0 ]] || destroy_pool $POOL
442 lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000 2>/dev/null
444 error "pool_remove did not fail even though pool did not exist."
446 run_test 3a "pool_remove: non-existant pool"
450 lctl pool_remove ${NON_EXISTANT_FS}.$POOL OST0000 2>/dev/null
452 error "pool_remove did not fail even though fsname did not exist."
454 run_test 3b "pool_remove: non-existant fsname"
457 do_facet mgs lctl pool_remove $FSNAME.p1234567891234567890 \
458 $FSNAME-OST0000 2>/dev/null
460 error "pool_remove did not fail even though pool name was invalid."
462 run_test 3c "pool_remove: Invalid pool name"
464 # Testing various combinations of OST name list
466 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
467 [[ $? -ne 0 ]] || destroy_pool $POOL
469 create_pool_nofail $POOL
470 do_facet mgs lctl pool_add $FSNAME.$POOL OST0000
471 do_facet mgs lctl pool_remove $FSNAME.$POOL OST0000
472 [[ $? -eq 0 ]] || error "pool_remove failed. $FSNAME $POOL OST0000"
475 do_facet mgs lctl pool_add $FSNAME.$POOL $FSNAME-OST0000
476 do_facet mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000
477 [[ $? -eq 0 ]] || error "pool_remove failed. $FSNAME $POOL $FSNAME-OST0000"
480 do_facet mgs lctl pool_add $FSNAME.$POOL $FSNAME-OST0000_UUID
481 do_facet mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000_UUID
483 error "pool_remove failed. $FSNAME $POOL $FSNAME-OST0000_UUID"
486 add_pool $POOL $TGT_ALL "$TGT_UUID"
487 do_facet mgs lctl pool_remove $FSNAME.$POOL $TGT_ALL
488 [[ $? -eq 0 ]] || error "pool_remove failed. $FSNAME $POOL" $TGT_ALL
493 run_test 3d "pool_remove: OST index combinations"
496 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
497 [[ $? -ne 0 ]] || destroy_pool $POOL
499 do_facet mgs lctl pool_destroy $FSNAME.$POOL 2>/dev/null
501 error "pool_destroy did not fail even though pool did not exist."
503 run_test 4a "pool_destroy: non-existant pool"
506 do_facet mgs lctl pool_destroy ${NON_EXISTANT_FS}.$POOL 2>/dev/null
508 error "pool_destroy did not fail even though filesystem did not exist."
510 run_test 4b "pool_destroy: non-existant fs-name"
513 create_pool_nofail $POOL
514 add_pool $POOL "OST0000" "$FSNAME-OST0000_UUID "
516 do_facet mgs lctl pool_destroy ${FSNAME}.$POOL
517 [[ $? -ne 0 ]] || error "pool_destroy succeeded with a non-empty pool."
520 run_test 4c "pool_destroy: non-empty pool"
525 $LCMD pool_list 2>/dev/null
527 error "pool_list did not fail even though fsname missing."
529 destroy_pool $POOL 2>/dev/null
530 destroy_pool $POOL2 2>/dev/null
532 create_pool_nofail $POOL
533 create_pool_nofail $POOL2
534 $LCMD pool_list $FSNAME
535 [[ $? -eq 0 ]] || error "pool_list $FSNAME failed."
537 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT_ALL
539 $LCMD pool_list $FSNAME.$POOL
540 [[ $? -eq 0 ]] || error "pool_list $FSNAME.$POOL failed."
542 $LCMD pool_list ${NON_EXISTANT_FS} 2>/dev/null
544 error "pool_list did not fail for fsname $NON_EXISTANT_FS"
546 $LCMD pool_list ${FSNAME}.$NON_EXISTANT_POOL 2>/dev/null
548 error "pool_list did not fail for pool $NON_EXISTANT_POOL"
550 if [[ ! $(grep $SINGLEMDS <<< $LCMD) ]]; then
551 echo $LCMD pool_list $DIR
553 [[ $? -eq 0 ]] || error "pool_list failed for $DIR"
556 $LCMD pool_list ${DIR}/d1
557 [[ $? -eq 0 ]] || error "pool_list failed for ${DIR}/d1"
560 rm -rf ${DIR}nonexistant
561 $LCMD pool_list ${DIR}nonexistant 2>/dev/null
563 error "pool_list did not fail for invalid mountpoint ${DIR}nonexistant"
570 # Issue commands from client
573 run_test 5a "lfs pool_list from client"
576 sub_test_5 "do_facet $SINGLEMDS lctl"
578 run_test 5b "lctl pool_list from MDS"
581 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
582 local POOL_DIR=$POOL_ROOT/dir_tst
583 local POOL_FILE=$POOL_ROOT/file_tst
585 create_pool_nofail $POOL
587 do_facet $SINGLEMDS lctl pool_list $FSNAME
588 [[ $? -eq 0 ]] || error "pool_list $FSNAME failed."
590 add_pool $POOL $TGT_ALL "$TGT_UUID"
593 $LFS setstripe -c -1 -p $POOL $POOL_DIR
594 [[ $? -eq 0 ]] || error "$LFS setstripe -p $POOL failed."
595 check_dir_in_pool $POOL_DIR $POOL
597 # If an invalid pool name is specified, the command should fail
598 $LFS setstripe -c 2 -p $INVALID_POOL $POOL_DIR 2>/dev/null
599 [[ $? -ne 0 ]] || error "setstripe to invalid pool did not fail."
601 # If the pool name does not exist, the command should fail
602 $LFS setstripe -c 2 -p $NON_EXISTANT_POOL $POOL_DIR 2>/dev/null
603 [[ $? -ne 0 ]] || error "setstripe to non-existant pool did not fail."
605 # lfs setstripe should work as before if a pool name is not specified.
606 $LFS setstripe -c -1 $POOL_DIR
607 [[ $? -eq 0 ]] || error "$LFS setstripe -c -1 $POOL_DIR failed."
608 $LFS setstripe -c -1 $POOL_FILE
609 [[ $? -eq 0 ]] || error "$LFS setstripe -c -1 $POOL_FILE failed."
611 # lfs setstripe should fail if a start index that is outside the
613 create_pool_nofail $POOL2
614 add_pool $POOL2 "OST0000" "$FSNAME-OST0000_UUID "
615 $LFS setstripe -i 1 -p $POOL2 $ROOT_POOL/$tfile 2>/dev/null
617 error "$LFS setstripe with start index outside the pool did not fail."
619 run_test 6 "getstripe/setstripe"
623 # Create a pool, stripe a directory and file with it
626 pool_add $pool || error "pool_add failed"
627 pool_add_targets $pool 0 1 || error "pool_add_targets failed"
629 $LFS setstripe -c 1 $DIR/$tdir/testfile1 --pool "$pool" ||
630 error "setstripe failed"
631 $LFS setstripe -c 1 $DIR/$tdir/testfile2 --pool "$FSNAME.$pool" ||
632 error "setstripe failed"
634 mkdir $DIR/$tdir/testdir
635 $LFS setstripe -c 1 $DIR/$tdir/testdir -p "$pool" ||
636 error "setstripe failed"
637 $LFS setstripe -c 1 $DIR/$tdir/testdir -p "$FSNAME.$pool" ||
638 error "setstripe failed"
640 rm -f $DIR/$tdir/testfile1
641 rm -f $DIR/$tdir/testfile2
642 rmdir $DIR/$tdir/testdir
644 destroy_pool_int $FSNAME.$pool
649 [ $OSTCOUNT -lt 2 ] && skip_env "needs >= 2 OSTs"
653 # Generate pool with random name from 1 to 15 characters
655 POOLNAME=$(echo $$$RANDOM$RANDOM |
656 tr -dc 'a-zA-Z0-9' | fold -w $i |
658 echo set poolname to $POOLNAME
659 helper_test_7a $POOLNAME
662 run_test 7a "create various pool name"
668 [ $? -ne 22 ] && error "can create a pool with no fsname"
672 [ $? -ne 22 ] && error "can create a pool with no name"
675 create_pool $FSNAME.0123456789^bdef
676 [ $? -ne 22 ] && error "can create a pool with an invalid name"
679 create_pool $FSNAME.0123456789abdefg
680 [ $? -ne 36 ] && error "can create a pool with a name too long"
684 run_test 7b "try to create pool name with invalid lengths or names"
688 [ $OSTCOUNT -lt 2 ] && skip_env "needs >= 2 OSTs"
692 # Create a pool with 15 letters
693 local pool=0123456789abcde
694 pool_add $pool || error "pool_add failed"
695 pool_add_targets $pool 0 1 || error "pool_add_targets failed"
697 # setstripe with the same pool name plus 1 letter
698 $LFS setstripe -c 1 $DIR/$tdir/testfile1 --pool "${pool}X" &&
699 error "setstripe succedeed"
701 # setstripe with the same pool name minus 1 letter
702 $LFS setstripe -c 1 $DIR/$tdir/testfile1 --pool "${pool%?}" &&
703 error "setstripe succedeed"
705 rm -f $DIR/$tdir/testfile1
707 destroy_pool_int $FSNAME.$pool
709 run_test 7c "create a valid pool name and setstripe with a bad one"
712 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
714 [[ $OSTCOUNT -le 1 ]] && skip_env "needs >= 2 OSTs"
716 create_pool_nofail $POOL
717 create_pool_nofail $POOL2
719 local start=$(printf %04x $((TGT_FIRST + 1)))
720 do_facet mgs lctl pool_add $FSNAME.$POOL2 \
721 $FSNAME-OST[$start-$TGT_MAX/2]
723 add_pool $POOL $TGT_HALF "$TGT_UUID2"
725 create_dir $POOL_ROOT/dir1 $POOL
726 create_dir $POOL_ROOT/dir2 $POOL2
729 createmany -o $POOL_ROOT/dir1/$tfile $numfiles ||
730 error "createmany $POOL_ROOT/dir1/$tfile failed!"
732 for file in $POOL_ROOT/dir1/*; do
733 check_file_in_pool $file $POOL
736 createmany -o $POOL_ROOT/dir2/$tfile $numfiles ||
737 error "createmany $POOL_ROOT/dir2/$tfile failed!"
738 for file in $POOL_ROOT/dir2/*; do
739 check_file_in_pool $file $POOL2
742 rm -rf $POOL_ROOT/dir?
746 run_test 11 "OSTs in overlapping/multiple pools"
749 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
751 [[ $OSTCOUNT -le 2 ]] && skip_env "needs >=3 OSTs"
753 create_pool_nofail $POOL
754 create_pool_nofail $POOL2
756 local start=$(printf %04x $((TGT_FIRST + 1)))
757 do_facet mgs lctl pool_add $FSNAME.$POOL2 \
758 $FSNAME-OST[$start-$TGT_MAX/2]
760 add_pool $POOL $TGT_HALF "$TGT_UUID2"
762 echo creating some files in $POOL and $POOL2
764 create_dir $POOL_ROOT/dir1 $POOL
765 create_dir $POOL_ROOT/dir2 $POOL2
766 create_file $POOL_ROOT/file1 $POOL
767 create_file $POOL_ROOT/file2 $POOL2
769 echo Checking the files created
770 check_file_in_pool $POOL_ROOT/file1 $POOL
771 check_file_in_pool $POOL_ROOT/file2 $POOL2
773 echo Changing the pool membership
774 do_facet mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST[$TGT_FIRST]
775 do_facet mgs lctl pool_list $FSNAME.$POOL
776 FIRST_UUID=$(echo $TGT_UUID | awk '{print $1}')
777 add_pool $POOL2 $FSNAME-OST[$TGT_FIRST] "$FIRST_UUID "
778 do_facet mgs lctl pool_list $FSNAME.$POOL2
780 echo Checking the files again
781 check_dir_in_pool $POOL_ROOT/dir1 $POOL
782 check_dir_in_pool $POOL_ROOT/dir2 $POOL2
783 check_file_in_osts $POOL_ROOT/file1 "$TGT_LIST2"
784 check_file_in_osts $POOL_ROOT/file2 "$(seq 0x$start 2 0x$TGT_MAX)"
786 echo Creating some more files
787 create_dir $POOL_ROOT/dir3 $POOL
788 create_dir $POOL_ROOT/dir4 $POOL2
789 create_file $POOL_ROOT/file3 $POOL
790 create_file $POOL_ROOT/file4 $POOL2
792 echo Checking the new files
793 check_file_in_pool $POOL_ROOT/file3 $POOL
794 check_file_in_pool $POOL_ROOT/file4 $POOL2
798 run_test 12 "OST Pool Membership"
801 [[ $OSTCOUNT -le 2 ]] && skip_env "needs >= 3 OSTs"
803 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
807 create_pool_nofail $POOL
808 add_pool $POOL $TGT_ALL "$TGT_UUID"
810 create_dir $POOL_ROOT/dir1 $POOL -1
811 createmany -o $POOL_ROOT/dir1/$tfile $numfiles ||
812 error "createmany $POOL_ROOT/dir1/$tfile failed!"
813 for file in $POOL_ROOT/dir1/*; do
814 check_file_in_pool $file $POOL $OSTCOUNT
817 create_file $POOL_ROOT/dir1/file1 $POOL 1 $TGT_FIRST
818 create_file $POOL_ROOT/dir1/file2 $POOL 1 $((TGT_FIRST + 1))
819 create_file $POOL_ROOT/dir1/file3 $POOL 1 $((TGT_FIRST + 2))
820 check_file_in_osts $POOL_ROOT/dir1/file1 $((16#$TGT_FIRST))
821 check_file_in_osts $POOL_ROOT/dir1/file2 "$((TGT_FIRST + 1))"
822 check_file_in_osts $POOL_ROOT/dir1/file3 "$((TGT_FIRST + 2))"
824 create_dir $POOL_ROOT/dir2 $POOL $count
825 createmany -o $POOL_ROOT/dir2/$tfile- $numfiles ||
826 error "createmany $POOL_ROOT/dir2/$tfile- failed!"
827 for file in $POOL_ROOT/dir2/*; do
828 check_file_in_pool $file $POOL $count
831 create_dir $POOL_ROOT/dir3 $POOL $count $((TGT_FIRST + 1))
832 createmany -o $POOL_ROOT/dir3/$tfile- $numfiles ||
833 error "createmany $POOL_ROOT/dir3/$tfile- failed!"
834 for file in $POOL_ROOT/dir3/*; do
835 check_file_in_pool $file $POOL $count
838 create_dir $POOL_ROOT/dir4 $POOL 1
839 createmany -o $POOL_ROOT/dir4/$tfile- $numfiles ||
840 error "createmany $POOL_ROOT/dir4/$tfile- failed!"
841 for file in $POOL_ROOT/dir4/*; do
842 check_file_in_pool $file $POOL 1
845 create_dir $POOL_ROOT/dir5 $POOL 1 $((TGT_FIRST + 2))
846 createmany -o $POOL_ROOT/dir5/$tfile- $numfiles ||
847 error "createmany $POOL_ROOT/dir5/$tfile- failed!"
848 for file in $POOL_ROOT/dir5/*; do
849 check_file_in_pool $file $POOL 1
852 rm -rf $POOL_ROOT/dir[1-5]/
856 run_test 13 "Striping characteristics in a pool"
859 [[ $OSTCOUNT -le 2 ]] && skip_env "needs >= 3 OSTs"
861 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
865 [ $OSTSIZE -gt $((MAXFREE / OSTCOUNT)) ] &&
866 skip_env "OST size $OSTSIZE is larger than $((MAXFREE / OSTCOUNT))"
868 create_pool_nofail $POOL
869 create_pool_nofail $POOL2
871 add_pool $POOL $TGT_HALF "$TGT_UUID2"
872 add_pool $POOL2 "OST0000" "$FSNAME-OST0000_UUID "
874 create_dir $POOL_ROOT/dir1 $POOL 1
875 create_file $POOL_ROOT/dir1/file $POOL 1
876 local ost=$($LFS getstripe -i $POOL_ROOT/dir1/file)
878 while [[ $i -lt $numfiles ]]; do
880 [[ $ost -gt $((16#$TGT_MAX)) ]] && ost=$TGT_FIRST
882 # echo "Iteration: $i OST: $ost"
883 create_file $POOL_ROOT/dir1/file${i} $POOL 1
884 check_file_in_pool $POOL_ROOT/dir1/file${i} $POOL
888 # Fill up OST0 until it is nearly full.
889 # Create 9 files of size OST0_SIZE/10 each.
890 create_dir $POOL_ROOT/dir2 $POOL2 1
891 $LFS df $POOL_ROOT/dir2
892 OST0_SIZE=$($LFS df $POOL_ROOT/dir2 | awk '/\[OST:0\]/ { print $4 }')
893 FILE_SIZE=$((OST0_SIZE/1024/10))
894 echo "Filling OST0 with 9 files of ${FILE_SIZE}MB in $POOL_ROOT/dir2"
896 while [[ $i -lt 10 ]]; do
897 dd if=/dev/zero of=$POOL_ROOT/dir2/f${i} bs=1M count=$FILE_SIZE
900 sleep 1 # get new statfs info
901 $LFS df $POOL_ROOT/dir2
903 # OST $TGT_FIRST is no longer favored; but it may still be used.
904 create_dir $POOL_ROOT/dir3 $POOL 1
905 create_file $POOL_ROOT/dir3/file $POOL 1
906 createmany -o $POOL_ROOT/dir3/$tfile- $numfiles ||
907 error "createmany $POOL_ROOT/dir3/$tfile- failed!"
908 for file in $POOL_ROOT/dir3/*; do
909 check_file_in_pool $file $POOL
916 run_test 14 "Round robin and QOS striping within a pool"
919 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
923 while [[ $i -lt $OSTCOUNT ]]; do
924 create_pool_nofail $POOL${i}
926 local tgt=$(printf "$FSNAME-OST%04x_UUID " $i)
927 add_pool $POOL${i} "$FSNAME-OST[$(printf %04x $i)]" "$tgt"
928 create_dir $POOL_ROOT/dir${i} $POOL${i}
929 createmany -o $POOL_ROOT/dir$i/$tfile $numfiles ||
930 error "createmany $POOL_ROOT/dir$i/$tfile failed!"
932 for file in $POOL_ROOT/dir$i/*; do
933 check_file_in_osts $file $i
941 run_test 15 "One directory per OST/pool"
944 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
948 create_pool_nofail $POOL
950 add_pool $POOL $TGT_HALF "$TGT_UUID2"
952 local dir=$POOL_ROOT/$tdir
953 create_dir $dir $POOL
955 for i in $(seq 1 10); do
960 createmany -o $dir/$tfile $numfiles ||
961 error "createmany $dir/$tfile failed!"
963 for file in $dir/*; do
964 check_file_in_pool $file $POOL
967 rm -rf $POOL_ROOT/$tdir
971 run_test 16 "Inheritance of pool properties"
974 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
978 create_pool_nofail $POOL
980 add_pool $POOL $TGT_ALL "$TGT_UUID"
982 local dir=$POOL_ROOT/dir
983 create_dir $dir $POOL
985 createmany -o $dir/${tfile}1_ $numfiles ||
986 error "createmany $dir/${tfile}1_ failed!"
988 for file in $dir/*; do
989 check_file_in_pool $file $POOL
994 createmany -o $dir/${tfile}2_ $numfiles ||
995 error "createmany $dir/${tfile}2_ failed!"
1000 run_test 17 "Referencing an empty pool"
1009 wait_delete_completed >/dev/null # give pending IO a chance to go to disk
1010 stat=$(createmany -o $cdir/${tfile} -$numsec | tail -1)
1011 files=$(echo $stat | cut -f 2 -d ' ')
1013 unlinkmany $cdir/${tfile} $files > /dev/null
1020 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1023 local plaindir=$POOL_ROOT/plaindir
1024 local pooldir=$POOL_ROOT/pooldir
1030 for i in $(seq 1 $iter); do
1031 echo "Create performance, iteration $i, $numsec seconds x 3"
1033 local files1=$(create_perf $plaindir $numsec)
1034 [[ $files1 -eq 0 ]] && error "Zero files created without pool"
1036 echo "iter $i: $files1 creates without pool"
1038 create_pool_nofail $POOL > /dev/null
1039 add_pool $POOL $TGT_ALL "$TGT_UUID" > /dev/null
1040 create_dir $pooldir $POOL
1041 local files2=$(create_perf $pooldir $numsec)
1042 [[ $files2 -eq 0 ]] && error "Zero files created with pool"
1044 echo "iter $i: $files2 creates with pool"
1046 destroy_pool $POOL > /dev/null
1047 local files3=$(create_perf $pooldir $numsec)
1048 [[ $files3 -eq 0 ]] &&
1049 error "Zero files created with missing pool"
1051 echo "iter $i: $files3 creates with missing pool"
1056 echo Avg files created in $numsec seconds without pool: $((f1 / iter))
1057 echo Avg files created in $numsec seconds with pool: $((f2 / iter))
1058 echo Avg files created in $numsec seconds missing pool: $((f3 / iter))
1060 # Set this high until we establish a baseline for what the degradation
1064 diff=$((($f1 - $f2) * 100 / $f1))
1065 echo "No pool / wide pool: $diff %."
1066 [ $diff -gt $max ] &&
1067 error_ignore bz23408 "Degradation with wide pool is $diff% > $max%"
1070 diff=$((($f1 - $f3) * 100 / $f1))
1071 echo "No pool / missing pool: $diff %."
1072 [ $diff -gt $max ] &&
1073 error_ignore bz23408 "Degradation with wide pool is $diff% > $max%"
1077 run_test 18 "File create in a directory which references a deleted pool"
1080 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1082 local dir1=$POOL_ROOT/dir1
1083 local dir2=$POOL_ROOT/dir2
1086 create_pool_nofail $POOL
1088 add_pool $POOL $TGT_HALF "$TGT_UUID2"
1090 create_dir $dir1 $POOL
1091 createmany -o $dir1/${tfile} $numfiles ||
1092 error "createmany $dir1/${tfile} failed!"
1093 for file in $dir1/*; do
1094 check_file_in_pool $file $POOL
1098 createmany -o $dir2/${tfile} $numfiles ||
1099 error "createmany $dir2/${tfile} failed!"
1100 for file in $dir2/*; do
1101 check_file_not_in_pool $file $POOL
1108 run_test 19 "Pools should not come into play when not specified"
1111 [[ $OSTCOUNT -ge 2 ]] || skip_env "needs >= 2 OSTs"
1113 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1115 local dir1=$POOL_ROOT/dir1
1116 local dir2=$dir1/dir2
1117 local dir3=$dir1/dir3
1121 create_pool_nofail $POOL
1122 create_pool_nofail $POOL2
1124 add_pool $POOL $TGT_HALF "$TGT_UUID2"
1126 local start=$(printf %04x $((TGT_FIRST + 1)))
1127 TGT=$(for i in $(seq 0x$start 2 0x$TGT_MAX); do \
1128 printf "$FSNAME-OST%04x_UUID " $i; done)
1129 add_pool $POOL2 "$FSNAME-OST[$start-$TGT_MAX/2]" "$TGT"
1131 create_dir $dir1 $POOL
1132 create_file $dir1/file1 $POOL2 # Should replace $dir1 pool with $POOL2
1133 create_dir $dir2 $POOL2
1134 touch $dir2/file2 # Should inherit $POOL2 from $dir2
1135 mkdir $dir3 # Should inherit $POOL from $dir1
1136 $LFS setstripe -c 1 $dir3 # Should remain existing $POOL
1137 touch $dir3/file3 # Should inherit $POOL from $dir3
1138 $LFS setstripe -c 1 $dir2/file4 # Should inherit $POOL2 from dir2
1139 $LFS setstripe -S 64K $dir1/file5 # Should inderit $POOL from $dir1
1141 check_file_in_pool $dir1/file1 $POOL2
1142 check_file_in_pool $dir2/file2 $POOL2
1143 check_dir_not_in_pool $dir3 $POOL2
1144 check_file_not_in_pool $dir3/file3 $POOL2
1145 check_file_not_in_pool $dir2/file4 $POOL
1146 check_file_not_in_pool $dir1/file5 $POOL2
1148 if [ $(lustre_version_code mds1) -ge $(version_code 2.10.54) ]; then
1149 check_dir_in_pool $dir3 $POOL
1150 check_file_in_pool $dir3/file3 $POOL
1151 check_file_in_pool $dir2/file4 $POOL2
1152 check_file_in_pool $dir1/file5 $POOL
1159 run_test 20 "Different pools in a directory hierarchy."
1162 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1163 [[ $OSTCOUNT -le 1 ]] && skip_env "needs >= 2 OSTs"
1167 local dir=$POOL_ROOT/dir
1169 create_pool_nofail $POOL
1171 add_pool $POOL $TGT_HALF "$TGT_UUID2"
1173 create_dir $dir $POOL $OSTCOUNT
1174 create_file $dir/file1 $POOL $OSTCOUNT
1175 $LFS getstripe -v $dir/file1
1176 check_file_in_pool $dir/file1 $POOL
1182 run_test 21 "OST pool with fewer OSTs than stripe count"
1190 for c in $(seq 1 10); do
1191 echo "Pool $pool, iteration $c"
1192 do_facet mgs lctl pool_add $FSNAME.$pool \
1193 OST[$TGT_FIRST-$TGT_MAX/$step] 2>/dev/null
1194 local TGT_SECOND=$(printf %04x $((TGT_FIRST + $step)))
1195 if [ $((16#$TGT_SECOND)) -le $((16#$TGT_MAX)) ]; then
1196 do_facet mgs lctl pool_remove $FSNAME.$pool \
1197 OST[$TGT_SECOND-$TGT_MAX/$step]
1200 echo loop for $pool complete
1204 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1205 [[ $OSTCOUNT -le 1 ]] && skip_env "needs >= 2 OSTs"
1209 create_pool_nofail $POOL
1210 add_pool $POOL "OST0000" "$FSNAME-OST0000_UUID "
1211 create_pool_nofail $POOL2
1212 add_pool $POOL2 "OST0000" "$FSNAME-OST0000_UUID "
1217 create_dir $POOL_ROOT $POOL
1218 createmany -o $POOL_ROOT/${tfile} $numfiles ||
1219 error "createmany $POOL_ROOT/${tfile} failed!"
1224 run_test 22 "Simultaneous manipulation of a pool"
1227 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1228 [[ $OSTCOUNT -le 1 ]] && skip_env "needs >= 2 OSTs"
1231 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS ||
1232 skip_env "User $RUNAS_ID does not exist - skipping"
1236 local BUNIT_SZ=1024 # min block quota unit(kB)
1237 local LIMIT=$((BUNIT_SZ * (OSTCOUNT + 1)))
1238 local dir=$POOL_ROOT/dir
1239 local file="$dir/$tfile-quota"
1241 create_pool_nofail $POOL
1243 local TGT=$(for i in $(seq 0x$TGT_FIRST 3 0x$TGT_MAX); do \
1244 printf "$FSNAME-OST%04x_UUID " $i; done)
1245 add_pool $POOL "$FSNAME-OST[$TGT_FIRST-$TGT_MAX/3]" "$TGT"
1246 create_dir $dir $POOL
1248 # XXX remove the interoperability code once we drop the old server
1249 # ( < 2.3.50) support.
1250 if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.50) ]; then
1251 $LFS quotaoff -ug $MOUNT
1252 $LFS quotacheck -ug $MOUNT
1254 if [[ $PERM_CMD == *"set_param -P"* ]]; then
1255 do_facet mgs $PERM_CMD \
1256 osd-*.$FSNAME-OST*.quota_slave.enable=ug
1258 do_facet mgs $PERM_CMD $FSNAME.quota.ost=ug
1263 $LFS setquota -u $RUNAS_ID -b $LIMIT -B $LIMIT $dir
1265 $LFS quota -v -u $RUNAS_ID $dir
1267 $LFS setstripe -c 1 -p $POOL $file
1268 chown $RUNAS_ID.$RUNAS_GID $file
1271 # This does two "dd" runs to ensure that the quota failure is returned
1272 # to userspace when we check. The first "dd" might otherwise complete
1273 # without error if it is only writing into cache.
1274 stat=$(LOCALE=C $RUNAS dd if=/dev/zero of=$file bs=$BUNIT_SZ \
1275 count=$((BUNIT_SZ*2)) 2>&1)
1276 echo $stat | grep "Disk quota exceeded" > /dev/null
1277 if [ $? -eq 0 ]; then
1278 $LFS quota -v -u $RUNAS_ID $dir
1279 cancel_lru_locks osc
1280 stat=$(LOCALE=C $RUNAS dd if=/dev/zero of=$file bs=$BUNIT_SZ \
1281 count=$BUNIT_SZ seek=$((BUNIT_SZ*2)) 2>&1)
1284 [[ $RC -eq 0 ]] && error "second dd did not fail."
1285 echo $stat | grep "Disk quota exceeded" > /dev/null
1286 [[ $? -eq 1 ]] && error "second dd did not fail with EDQUOT."
1288 log "first dd failed with EDQUOT."
1290 $LFS quota -v -u $RUNAS_ID $dir
1292 run_test 23a "OST pools and quota"
1295 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1296 [[ $OSTCOUNT -le 1 ]] && skip_env "needs >= 2 OSTs"
1299 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS || {
1300 skip_env "User $RUNAS_ID does not exist - skipping"
1305 local dir=$POOL_ROOT/dir
1306 local file="$dir/$tfile-quota"
1308 create_pool_nofail $POOL
1310 local TGT=$(for i in $(seq 0x$TGT_FIRST 3 0x$TGT_MAX); do \
1311 printf "$FSNAME-OST%04x_UUID " $i; done)
1312 add_pool $POOL "$FSNAME-OST[$TGT_FIRST-$TGT_MAX/3]" "$TGT"
1313 create_dir $dir $POOL
1315 local maxfree=$((1024 * 1024 * 30)) # 30G
1316 local AVAIL=$(lfs_df -p $POOL $dir | awk '/summary/ { print $4 }')
1317 [ $AVAIL -gt $maxfree ] &&
1318 skip_env "Filesystem space $AVAIL is larger than " \
1321 echo "OSTCOUNT=$OSTCOUNT, OSTSIZE=$OSTSIZE, AVAIL=$AVAIL"
1322 echo "MAXFREE=$maxfree, SLOW=$SLOW"
1324 # XXX remove the interoperability code once we drop the old server
1325 # ( < 2.3.50) support.
1326 if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.50) ]; then
1327 $LFS quotaoff -ug $MOUNT
1329 if [[ $PERM_CMD == *"set_param -P"* ]]; then
1330 do_facet mgs $PERM_CMD \
1331 osd-*.$FSNAME-OST*.quota_slave.enable=none
1333 do_facet mgs $PERM_CMD $FSNAME.quota.ost=none
1338 chown $RUNAS_ID.$RUNAS_ID $dir
1342 local stime=$(date +%s)
1346 local maxtime=300 # minimum speed: 5GB / 300sec ~= 17MB/s
1347 while [ $RC -eq 0 ]; do
1349 stat=$(LOCALE=C $RUNAS2 dd if=/dev/zero of=${file}$i bs=1M \
1350 count=$((5 * 1024)) 2>&1)
1352 TOTAL=$((TOTAL + 1024 * 1024 * 5))
1353 echo "[$i iteration] $stat"
1354 echo "total written: $TOTAL"
1357 elapsed=$((etime - stime))
1358 echo "stime=$stime, etime=$etime, elapsed=$elapsed"
1360 if [ $RC -eq 1 ]; then
1361 echo $stat | grep -q "Disk quota exceeded"
1363 error "dd failed with EDQUOT with quota off"
1365 echo $stat | grep -q "No space left on device"
1367 error "dd did not fail with ENOSPC"
1368 elif [ $TOTAL -gt $AVAIL ]; then
1369 error "dd didn't fail with ENOSPC ($TOTAL > $AVAIL)"
1370 elif [ $i -eq 1 -a $elapsed -gt $maxtime ]; then
1371 log "The first 5G write used $elapsed (> $maxtime) " \
1372 "seconds, terminated"
1380 run_test 23b "OST pools and OOS"
1383 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1384 [[ $OSTCOUNT -le 1 ]] && skip_env "needs >= 2 OSTs"
1386 local server_version=$(lustre_version_code $SINGLEMDS)
1387 [[ $server_version -ge $(version_code 2.8.56) ]] ||
1388 skip "Need server version newer than 2.8.55"
1396 create_pool_nofail $POOL
1398 add_pool $POOL $TGT_ALL "$TGT_UUID"
1400 create_dir $POOL_ROOT/dir1 $POOL $OSTCOUNT
1402 mkdir $POOL_ROOT/dir2
1403 $LFS setstripe -p $POOL -S 65536 -i 0 -c 1 $POOL_ROOT/dir2 ||
1404 error "$LFS setstripe $POOL_ROOT/dir2 failed"
1406 mkdir $POOL_ROOT/dir3
1407 $LFS setstripe -S 65536 -i 0 -c 1 $POOL_ROOT/dir3 ||
1408 error "$LFS setstripe $POOL_ROOT/dir3 failed"
1410 mkdir $POOL_ROOT/dir4
1412 for i in 1 2 3 4; do
1413 dir=${POOL_ROOT}/dir${i}
1422 createmany -o $dir/${tfile} $numfiles ||
1423 error "createmany $dir/${tfile} failed!"
1424 pool=$($LFS getstripe --pool $dir)
1425 index=$($LFS getstripe -i $dir)
1426 size=$($LFS getstripe -S $dir)
1427 count=$($LFS getstripe -c $dir)
1429 for file in $dir/*; do
1430 if [ "$pool" != "" ]; then
1431 check_file_in_pool $file $pool
1433 pool1=$($LFS getstripe --pool $file)
1434 count1=$($LFS getstripe -c $file)
1435 size1=$($LFS getstripe -S $file)
1436 [[ "$pool" != "$pool1" ]] &&
1437 error "Pool '$pool' not on $file:$pool1"
1438 [[ "$count" != "$count1" ]] &&
1439 [[ "$count" != "-1" ]] &&
1440 error "Stripe count $count not on"\
1442 [[ "$count1" != "$OSTCOUNT" ]] &&
1443 [[ "$count" = "-1" ]] &&
1444 error "Stripe count $count1 not on"\
1446 [[ "$size" != "$size1" ]] && [[ "$size" != "0" ]] &&
1447 error "Stripe size $size not on $file:$size1"
1455 run_test 24 "Independence of pool from other setstripe parameters"
1458 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1462 for i in $(seq 10); do
1463 create_pool_nofail $POOL$i
1464 do_facet mgs "lctl pool_add $FSNAME.$POOL$i OST0000; sync"
1465 wait_update $HOSTNAME "lctl get_param -n \
1466 lov.$FSNAME-*.pools.$POOL$i | sort -u |
1467 tr '\n' ' ' " "$FSNAME-OST0000_UUID " >/dev/null ||
1468 error "pool_add failed: $1; $2"
1470 facet_failover $SINGLEMDS ||
1471 error "failed to failover $SINGLEMDS"
1472 wait_osc_import_state $SINGLEMDS ost FULL
1476 # Veriy that the pool got created and is usable
1477 df $POOL_ROOT > /dev/null
1480 # Make sure OST0 can be striped on
1481 $LFS setstripe -i 0 -c 1 $POOL_ROOT/$tfile
1482 local STR=$($LFS getstripe -i $POOL_ROOT/$tfile)
1483 rm $POOL_ROOT/$tfile
1484 if [[ "$STR" == "0" ]]; then
1485 echo "Creating a file in pool$i"
1486 create_file $POOL_ROOT/file$i $POOL$i || break
1487 check_file_in_pool $POOL_ROOT/file$i $POOL$i || break
1489 echo "OST 0 seems to be unavailable. Try later."
1495 run_test 25 "Create new pool and restart MDS"
1498 [[ $OSTCOUNT -le 2 ]] && skip_env "needs >= 3 OSTs"
1499 local dev=$(mdsdevname ${SINGLEMDS//mds/})
1500 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1504 create_pool_nofail $POOL2
1506 do_facet mgs "lctl pool_add $FSNAME.$POOL2 OST0000; sync"
1507 wait_update $HOSTNAME "lctl get_param -n \
1508 lov.$FSNAME-*.pools.$POOL2 | sort -u |
1509 grep $FSNAME-OST0000_UUID " "$FSNAME-OST0000_UUID" ||
1510 error "pool_add failed: $1; $2"
1512 do_facet mgs "lctl pool_add $FSNAME.$POOL2 OST0002; sync"
1513 wait_update $HOSTNAME "lctl get_param -n \
1514 lov.$FSNAME-*.pools.$POOL2 | sort -u |
1515 grep $FSNAME-OST0002_UUID" "$FSNAME-OST0002_UUID" ||
1516 error "pool_add failed: $1; $2"
1518 # Veriy that the pool got created and is usable
1520 echo "Creating files in $POOL2"
1522 for ((i = 0; i < 10; i++)); do
1523 #OBD_FAIL_MDS_OSC_CREATE_FAIL 0x147
1524 #Fail OST0000 to ensure objects create on
1525 #the other OST in the pool
1526 do_facet $SINGLEMDS lctl set_param fail_loc=0x147
1527 do_facet $SINGLEMDS lctl set_param fail_val=0
1528 create_file $POOL_ROOT/file$i $POOL2 1 -1 || break
1529 do_facet $SINGLEMDS lctl set_param fail_loc=0
1530 check_file_in_pool $POOL_ROOT/file$i $POOL2 || break
1534 run_test 26 "Choose other OSTs in the pool first in the creation remedy"
1537 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs"
1541 local count=$OSTCOUNT
1543 create_pool_nofail $POOL
1544 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT_ALL
1545 osts=$(list_pool $FSNAME.$POOL)
1546 for ost in ${osts}; do
1548 if [[ $count -eq 0 ]]; then
1549 #define OBD_FAIL_OST_LIST_ASSERT 0x239
1550 do_facet $SINGLEMDS \
1551 $LCTL set_param fail_loc=0x239 fail_val=10
1552 list_pool $FSNAME.$POOL &
1555 do_facet $SINGLEMDS $LCTL set_param fail_loc=0
1556 do_facet mgs $LCTL pool_remove $FSNAME.$POOL $ost
1558 do_facet $SINGLEMDS $LCTL set_param fail_val=0
1560 do_facet mgs $LCTL pool_remove $FSNAME.$POOL $ost
1565 run_test 27 "Race pool_list and pool_remove"
1570 destroy_test_pools $FSNAME
1571 if ! combined_mgs_mds; then
1572 zconf_umount $mgs_HOST $MOUNT
1573 do_facet mgs "rm -rf $MOUNT"
1575 check_and_cleanup_lustre