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"
36 [ "$SLOW" = "no" ] && EXCEPT_SLOW="18 23b"
43 MAXFREE=${MAXFREE:-$((2000000 * OSTCOUNT))}
47 POOL2=${POOL2:-${POOL}2}
48 POOL3=${POOL3:-${POOL}3}
49 NON_EXISTANT_POOL=nonexistantpool
50 NON_EXISTANT_FS=nonexistantfs
51 INVALID_POOL=some_invalid_pool_name
53 TGT_FIRST=$(printf %04x 0)
54 TGT_MAX=$(printf %04x $((TGT_COUNT-1)))
56 TGT_LIST=$(seq 0x$TGT_FIRST $TGT_STEP 0x$TGT_MAX)
57 TGT_LIST2=$(seq 0x$TGT_FIRST 2 0x$TGT_MAX)
59 TGT_ALL="$FSNAME-OST[$TGT_FIRST-$TGT_MAX/1]"
60 TGT_HALF="$FSNAME-OST[$TGT_FIRST-$TGT_MAX/2]"
62 TGT_UUID=$(for i in $TGT_LIST; do printf "$FSNAME-OST%04x_UUID " $i; done)
63 TGT_UUID2=$(for i in $TGT_LIST2; do printf "$FSNAME-OST%04x_UUID " $i; done)
68 local count=${3:-"-1"}
72 if [[ -n $idx ]]; then
73 $LFS setstripe -c $count -p $pool -i $idx $dir
75 $LFS setstripe -c $count -p $pool $dir
77 [[ $? -eq 0 ]] || error "$LFS setstripe -p $pool $dir failed"
78 [[ "$($LFS getstripe --pool $dir)" == "$pool" ]] ||
79 error "$dir not created in expected pool '$pool'"
85 local count=${3:-"-1"}
86 local index=${4:-"-1"}
88 $LFS setstripe -i $index -c $count -p $pool $file
89 [[ $? -eq 0 ]] || error "$LFS setstripe -p $pool $file failed"
90 [[ "$($LFS getstripe --pool $file)" == "$pool" ]] ||
91 error "$file not created in '$pool'"
97 for i in $(list_pool $FSNAME.$pool |
98 sed -e 's/_UUID$//;s/^.*-OST//'); do
99 res="$res $(printf "%d" 0x$i)"
104 check_dir_in_pool() {
107 local res=$($LFS getstripe --pool $dir)
109 [ -n "$res" ] || error "dir '$dir' not in any pool"
111 [ "$res" == "$pool" ] ||
112 error "dir '$dir' in pool '$res' instead of '$pool'"
115 check_file_in_pool() {
119 local osts=$(osts_in_pool $pool)
120 local res=$($LFS getstripe --pool $file)
122 [ -n "$res" ] || error "file '$file' not in any pool"
124 [ "$res" == "$pool" ] ||
125 error "file '$file' in pool '$res' instead of '$pool'"
127 local osts=$(osts_in_pool $2)
128 check_file_in_osts "$file" "$osts" $count
131 check_file_in_osts() {
133 local ost_list=${2:-$TGT_LIST}
135 local res=$($LFS getstripe $file | awk '/0x/ { print $1 }')
139 found=$(echo :$ost_list: | tr " " ":" | grep :$i:)
140 if [[ "$found" == "" ]]; then
141 echo "ost list: $ost_list"
142 echo "striping: $res"
143 $LFS getstripe -v $file
144 error "$file not allocated from OSTs $ost_list."
148 local ost_count=$($LFS getstripe -c $file)
149 [[ -n "$count" ]] && [[ $ost_count -ne $count ]] &&
150 error "$file stripe count $count expected; got $ost_count" &&
155 check_file_not_in_pool() {
158 local res=$($LFS getstripe --pool $file)
160 [ "$res" != "$pool" ] || error "File '$file' is in pool: $res"
163 check_dir_not_in_pool() {
166 local res=$($LFS getstripe --pool $dir)
168 [ "$res" != "$pool" ] || error "Dir '$dir' is in pool: $res"
173 wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$pool" "" ||
174 error "Failed to remove targets from pool: $pool"
180 local tgt="${3}$(lctl get_param -n lov.$FSNAME-*.pools.$pool |
181 sort -u | tr '\n' ' ')"
183 do_facet mgs lctl pool_add $FSNAME.$pool $osts
185 [[ $RC -ne 0 ]] && return $RC
187 # wait for OSTs to be added to the pool
188 for mds_id in $(seq $MDSCOUNT); do
189 local mdt_id=$((mds_id-1))
190 local lodname=$FSNAME-MDT$(printf "%04x" $mdt_id)-mdtlov
191 wait_update_facet mds$mds_id \
192 "lctl get_param -n lod.$lodname.pools.$pool |
193 sort -u | tr '\n' ' ' " "$tgt" >/dev/null ||
194 error "mds$mds_id:pool add failed $1; $2"
196 wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$pool |
197 sort -u | tr '\n' ' ' " "$tgt" >/dev/null ||
198 error "pool_add failed: $1; $2"
202 create_pool_nofail() {
203 create_pool $FSNAME.$1
204 [[ $? -ne 0 ]] && error "Pool creation of $1 failed"
209 create_pool $FSNAME.$1
211 error "Pool creation of $1 succeeded; should have failed"
220 remote_mds_nodsh && skip "remote MDS with nodsh"
221 remote_ost_nodsh && skip "remote OST with nodsh"
224 # Tests for new commands added
229 run_test 1a "Create a pool with a 1 character pool name"
232 create_pool_nofail ${POOL}12
233 destroy_pool ${POOL}12
235 run_test 1b "Create a pool with a 10 char pool name"
238 create_pool_nofail ${POOL}1234567
239 destroy_pool ${POOL}1234567
241 run_test 1c "Create a pool with a 15 char pool name"
244 create_pool_fail ${POOL}12345678
246 run_test 1d "Create a pool with a 16 char pool name; should fail"
249 local pool_name="$POOL"
250 for ((i = 1; i <= 991; i++)); do pool_name=${pool_name}"o"; done
251 create_pool_fail $pool_name
253 run_test 1e "Create a pool with a 1000 char pool name; should fail"
258 error "pool_new did not fail even though fs-name was missing"
260 run_test 1f "pool_new should fail if fs-name is missing"
265 error "pool_new did not fail even though fs-name was missing"
267 run_test 1g "pool_new should fail if fs-name is missing"
270 create_pool ${FSNAME}.
272 error "pool_new did not fail even though pool name was missing"
274 run_test 1h "pool_new should fail if poolname is missing"
279 error "pool_new did not fail even if pool/fs-name was missing"
281 run_test 1i "pool_new should fail if poolname and fs-name are missing"
284 create_pool ${FSNAME},$POOL
286 error "pool_new did not fail even if poolname format was wrong"
288 run_test 1j "pool_new should fail if poolname format is wrong"
291 create_pool ${FSNAME}/$POOL
293 error "pool_new did not fail even if poolname format was wrong"
295 run_test 1k "pool_new should fail if poolname format is wrong"
298 create_pool_nofail $POOL2
299 create_pool ${FSNAME}.$POOL2
301 error "pool_new did not fail even though $POOL2 existed"
304 run_test 1m "pool_new did not fail even though $POOL2 existed"
307 create_pool_nofail ${POOL}1234567
309 add_pool ${POOL}1234567 "OST0000" "$FSNAME-OST0000_UUID "
310 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
311 create_dir $POOL_ROOT ${POOL}1234567
312 dd if=/dev/zero of=$POOL_ROOT/file bs=1M count=100
313 RC=$?; [[ $RC -eq 0 ]] ||
314 error "failed to write to $POOL_ROOT/file: $RC"
315 do_facet mgs lctl pool_remove $FSNAME.${POOL}1234567 OST0000
316 drain_pool ${POOL}1234567
318 destroy_pool ${POOL}1234567
320 run_test 1n "Pool with a 15 char pool name works well"
325 do_facet mgs lctl pool_add $FSNAME.$POOL $FSNAME-OST0000 2>/dev/null
327 error "pool_add did not fail even though $POOL did not exist"
329 run_test 2a "pool_add: non-existant pool $POOL"
332 do_facet mgs lctl pool_add $FSNAME.${POOL}1234567890 \
333 $FSNAME-OST0000 2>/dev/null
335 error "pool_add did not fail even though pool name was invalid."
337 run_test 2b "pool_add: Invalid pool name"
339 # Testing various combinations of OST name list
344 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
345 [[ $? -ne 0 ]] || destroy_pool $POOL
347 create_pool_nofail $POOL
350 do_facet mgs lctl pool_add $FSNAME.$POOL OST0000
351 RC=$?; [[ $RC -eq 0 ]] ||
352 error "pool_add failed. $FSNAME $POOL OST0000: $RC"
353 do_facet mgs lctl pool_remove $FSNAME.$POOL OST0000
357 do_facet mgs lctl pool_add $FSNAME.$POOL $FSNAME-OST0000
358 RC=$?; [[ $RC -eq 0 ]] ||
359 error "pool_add failed. $FSNAME $POOL $FSNAME-OST0000: $RC"
360 do_facet mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000
363 # 3. $FSNAME-OST0000_UUID
364 do_facet mgs lctl pool_add $FSNAME.$POOL $FSNAME-OST0000_UUID
365 RC=$?; [[ $RC -eq 0 ]] ||
366 error "pool_add failed. $FSNAME $POOL $FSNAME-OST0000_UUID: $RC"
367 do_facet mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000_UUID
370 # 4. $FSNAME-OST[0,1,2,3,]
372 for i in $TGT_LIST; do TGT=${TGT}$(printf "%04x," $i); done
374 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT
375 [[ $? -eq 0 ]] || error "pool_add failed. $FSNAME.$POOL $TGT. $RC"
376 do_facet mgs lctl pool_remove $FSNAME.$POOL $TGT
379 # 5. $FSNAME-OST[0-5/1]
380 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT_ALL
381 RC=$?; [[ $RC -eq 0 ]] ||
382 error "pool_add failed. $FSNAME $POOL" "$TGT_ALL $RC"
383 wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$POOL |
384 sort -u | tr '\n' ' ' " "$TGT_UUID" ||
385 error "Add to pool failed"
386 do_facet mgs lctl pool_remove $FSNAME.$POOL $TGT_ALL
391 run_test 2c "pool_add: OST index combinations"
397 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
398 [[ $? -ne 0 ]] || destroy_pool $POOL
400 create_pool_nofail $POOL
402 TGT=$(printf "$FSNAME-OST%04x_UUID " $OSTCOUNT)
403 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT
404 RC=$?; [[ $RC -ne 0 ]] ||
405 error "pool_add succeeded for an OST ($TGT) that does not exist."
409 run_test 2d "pool_add: OSTs that don't exist should be rejected"
416 $LCTL get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
417 [[ $? -ne 0 ]] || destroy_pool $POOL
419 create_pool_nofail $POOL
421 TGT="$FSNAME-OST0000_UUID "
422 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT
423 wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$POOL |
424 sort -u | tr '\n' ' ' " "$TGT" || error "Add to pool failed"
425 RESULT=$(do_facet mgs \
426 "LOCALE=C $LCTL pool_add $FSNAME.$POOL $TGT 2>&1")
431 error "pool_add succeeded for an OST that was already in the pool."
433 [[ $(grep "already in pool" <<< $RESULT) ]] ||
434 error "pool_add failed as expected but error message not as expected."
438 run_test 2e "pool_add: OST already in a pool should be rejected"
441 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
442 [[ $? -ne 0 ]] || destroy_pool $POOL
445 lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000 2>/dev/null
447 error "pool_remove did not fail even though pool did not exist."
449 run_test 3a "pool_remove: non-existant pool"
453 lctl pool_remove ${NON_EXISTANT_FS}.$POOL OST0000 2>/dev/null
455 error "pool_remove did not fail even though fsname did not exist."
457 run_test 3b "pool_remove: non-existant fsname"
460 do_facet mgs lctl pool_remove $FSNAME.p1234567891234567890 \
461 $FSNAME-OST0000 2>/dev/null
463 error "pool_remove did not fail even though pool name was invalid."
465 run_test 3c "pool_remove: Invalid pool name"
467 # Testing various combinations of OST name list
469 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
470 [[ $? -ne 0 ]] || destroy_pool $POOL
472 create_pool_nofail $POOL
473 do_facet mgs lctl pool_add $FSNAME.$POOL OST0000
474 do_facet mgs lctl pool_remove $FSNAME.$POOL OST0000
475 [[ $? -eq 0 ]] || error "pool_remove failed. $FSNAME $POOL OST0000"
478 do_facet mgs lctl pool_add $FSNAME.$POOL $FSNAME-OST0000
479 do_facet mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000
480 [[ $? -eq 0 ]] || error "pool_remove failed. $FSNAME $POOL $FSNAME-OST0000"
483 do_facet mgs lctl pool_add $FSNAME.$POOL $FSNAME-OST0000_UUID
484 do_facet mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000_UUID
486 error "pool_remove failed. $FSNAME $POOL $FSNAME-OST0000_UUID"
489 add_pool $POOL $TGT_ALL "$TGT_UUID"
490 do_facet mgs lctl pool_remove $FSNAME.$POOL $TGT_ALL
491 [[ $? -eq 0 ]] || error "pool_remove failed. $FSNAME $POOL" $TGT_ALL
496 run_test 3d "pool_remove: OST index combinations"
499 lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null
500 [[ $? -ne 0 ]] || destroy_pool $POOL
502 do_facet mgs lctl pool_destroy $FSNAME.$POOL 2>/dev/null
504 error "pool_destroy did not fail even though pool did not exist."
506 run_test 4a "pool_destroy: non-existant pool"
509 do_facet mgs lctl pool_destroy ${NON_EXISTANT_FS}.$POOL 2>/dev/null
511 error "pool_destroy did not fail even though filesystem did not exist."
513 run_test 4b "pool_destroy: non-existant fs-name"
516 create_pool_nofail $POOL
517 add_pool $POOL "OST0000" "$FSNAME-OST0000_UUID "
519 do_facet mgs lctl pool_destroy ${FSNAME}.$POOL
520 [[ $? -ne 0 ]] || error "pool_destroy succeeded with a non-empty pool."
523 run_test 4c "pool_destroy: non-empty pool"
528 $LCMD pool_list 2>/dev/null
530 error "pool_list did not fail even though fsname missing."
532 destroy_pool $POOL 2>/dev/null
533 destroy_pool $POOL2 2>/dev/null
535 create_pool_nofail $POOL
536 create_pool_nofail $POOL2
537 $LCMD pool_list $FSNAME
538 [[ $? -eq 0 ]] || error "pool_list $FSNAME failed."
540 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT_ALL
542 $LCMD pool_list $FSNAME.$POOL
543 [[ $? -eq 0 ]] || error "pool_list $FSNAME.$POOL failed."
545 $LCMD pool_list ${NON_EXISTANT_FS} 2>/dev/null
547 error "pool_list did not fail for fsname $NON_EXISTANT_FS"
549 $LCMD pool_list ${FSNAME}.$NON_EXISTANT_POOL 2>/dev/null
551 error "pool_list did not fail for pool $NON_EXISTANT_POOL"
553 if [[ ! $(grep $SINGLEMDS <<< $LCMD) ]]; then
554 echo $LCMD pool_list $DIR
556 [[ $? -eq 0 ]] || error "pool_list failed for $DIR"
559 $LCMD pool_list ${DIR}/d1
560 [[ $? -eq 0 ]] || error "pool_list failed for ${DIR}/d1"
563 rm -rf ${DIR}nonexistant
564 $LCMD pool_list ${DIR}nonexistant 2>/dev/null
566 error "pool_list did not fail for invalid mountpoint ${DIR}nonexistant"
573 # Issue commands from client
576 run_test 5a "lfs pool_list from client"
579 sub_test_5 "do_facet $SINGLEMDS lctl"
581 run_test 5b "lctl pool_list from MDS"
584 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
585 local POOL_DIR=$POOL_ROOT/dir_tst
586 local POOL_FILE=$POOL_ROOT/file_tst
588 create_pool_nofail $POOL
590 do_facet $SINGLEMDS lctl pool_list $FSNAME
591 [[ $? -eq 0 ]] || error "pool_list $FSNAME failed."
593 add_pool $POOL $TGT_ALL "$TGT_UUID"
596 $SETSTRIPE -c -1 -p $POOL $POOL_DIR
597 [[ $? -eq 0 ]] || error "$SETSTRIPE -p $POOL failed."
598 check_dir_in_pool $POOL_DIR $POOL
600 # If an invalid pool name is specified, the command should fail
601 $SETSTRIPE -c 2 -p $INVALID_POOL $POOL_DIR 2>/dev/null
602 [[ $? -ne 0 ]] || error "setstripe to invalid pool did not fail."
604 # If the pool name does not exist, the command should fail
605 $SETSTRIPE -c 2 -p $NON_EXISTANT_POOL $POOL_DIR 2>/dev/null
606 [[ $? -ne 0 ]] || error "setstripe to non-existant pool did not fail."
608 # lfs setstripe should work as before if a pool name is not specified.
609 $SETSTRIPE -c -1 $POOL_DIR
610 [[ $? -eq 0 ]] || error "$SETSTRIPE -c -1 $POOL_DIR failed."
611 $SETSTRIPE -c -1 $POOL_FILE
612 [[ $? -eq 0 ]] || error "$SETSTRIPE -c -1 $POOL_FILE failed."
614 # lfs setstripe should fail if a start index that is outside the
616 create_pool_nofail $POOL2
617 add_pool $POOL2 "OST0000" "$FSNAME-OST0000_UUID "
618 $SETSTRIPE -i 1 -p $POOL2 $ROOT_POOL/$tfile 2>/dev/null
620 error "$SETSTRIPE with start index outside the pool did not fail."
622 run_test 6 "getstripe/setstripe"
626 # Create a pool, stripe a directory and file with it
629 pool_add $pool || error "pool_add failed"
630 pool_add_targets $pool 0 1 || error "pool_add_targets failed"
632 $SETSTRIPE -c 1 $DIR/$tdir/testfile1 --pool "$pool" ||
633 error "setstripe failed"
634 $SETSTRIPE -c 1 $DIR/$tdir/testfile2 --pool "$FSNAME.$pool" ||
635 error "setstripe failed"
637 mkdir $DIR/$tdir/testdir
638 $SETSTRIPE -c 1 $DIR/$tdir/testdir -p "$pool" ||
639 error "setstripe failed"
640 $SETSTRIPE -c 1 $DIR/$tdir/testdir -p "$FSNAME.$pool" ||
641 error "setstripe failed"
643 rm -f $DIR/$tdir/testfile1
644 rm -f $DIR/$tdir/testfile2
645 rmdir $DIR/$tdir/testdir
647 destroy_pool_int $FSNAME.$pool
652 [ $OSTCOUNT -lt 2 ] && skip_env "needs >= 2 OSTs"
656 # Generate pool with random name from 1 to 15 characters
658 POOLNAME=$(echo $$$RANDOM$RANDOM |
659 tr -dc 'a-zA-Z0-9' | fold -w $i |
661 echo set poolname to $POOLNAME
662 helper_test_7a $POOLNAME
665 run_test 7a "create various pool name"
671 [ $? -ne 22 ] && error "can create a pool with no fsname"
675 [ $? -ne 22 ] && error "can create a pool with no name"
678 create_pool $FSNAME.0123456789^bdef
679 [ $? -ne 22 ] && error "can create a pool with an invalid name"
682 create_pool $FSNAME.0123456789abdefg
683 [ $? -ne 36 ] && error "can create a pool with a name too long"
687 run_test 7b "try to create pool name with invalid lengths or names"
691 [ $OSTCOUNT -lt 2 ] && skip_env "needs >= 2 OSTs"
695 # Create a pool with 15 letters
696 local pool=0123456789abcde
697 pool_add $pool || error "pool_add failed"
698 pool_add_targets $pool 0 1 || error "pool_add_targets failed"
700 # setstripe with the same pool name plus 1 letter
701 $SETSTRIPE -c 1 $DIR/$tdir/testfile1 --pool "${pool}X" && \
702 error "setstripe succedeed"
704 # setstripe with the same pool name minus 1 letter
705 $SETSTRIPE -c 1 $DIR/$tdir/testfile1 --pool "${pool%?}" && \
706 error "setstripe succedeed"
708 rm -f $DIR/$tdir/testfile1
710 destroy_pool_int $FSNAME.$pool
712 run_test 7c "create a valid pool name and setstripe with a bad one"
715 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
717 [[ $OSTCOUNT -le 1 ]] && skip_env "needs >= 2 OSTs"
719 create_pool_nofail $POOL
720 create_pool_nofail $POOL2
722 local start=$(printf %04x $((TGT_FIRST + 1)))
723 do_facet mgs lctl pool_add $FSNAME.$POOL2 \
724 $FSNAME-OST[$start-$TGT_MAX/2]
726 add_pool $POOL $TGT_HALF "$TGT_UUID2"
728 create_dir $POOL_ROOT/dir1 $POOL
729 create_dir $POOL_ROOT/dir2 $POOL2
732 createmany -o $POOL_ROOT/dir1/$tfile $numfiles ||
733 error "createmany $POOL_ROOT/dir1/$tfile failed!"
735 for file in $POOL_ROOT/dir1/*; do
736 check_file_in_pool $file $POOL
739 createmany -o $POOL_ROOT/dir2/$tfile $numfiles ||
740 error "createmany $POOL_ROOT/dir2/$tfile failed!"
741 for file in $POOL_ROOT/dir2/*; do
742 check_file_in_pool $file $POOL2
745 rm -rf $POOL_ROOT/dir?
749 run_test 11 "OSTs in overlapping/multiple pools"
752 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
754 [[ $OSTCOUNT -le 2 ]] && skip_env "needs >=3 OSTs"
756 create_pool_nofail $POOL
757 create_pool_nofail $POOL2
759 local start=$(printf %04x $((TGT_FIRST + 1)))
760 do_facet mgs lctl pool_add $FSNAME.$POOL2 \
761 $FSNAME-OST[$start-$TGT_MAX/2]
763 add_pool $POOL $TGT_HALF "$TGT_UUID2"
765 echo creating some files in $POOL and $POOL2
767 create_dir $POOL_ROOT/dir1 $POOL
768 create_dir $POOL_ROOT/dir2 $POOL2
769 create_file $POOL_ROOT/file1 $POOL
770 create_file $POOL_ROOT/file2 $POOL2
772 echo Checking the files created
773 check_file_in_pool $POOL_ROOT/file1 $POOL
774 check_file_in_pool $POOL_ROOT/file2 $POOL2
776 echo Changing the pool membership
777 do_facet mgs lctl pool_remove $FSNAME.$POOL $FSNAME-OST[$TGT_FIRST]
778 do_facet mgs lctl pool_list $FSNAME.$POOL
779 FIRST_UUID=$(echo $TGT_UUID | awk '{print $1}')
780 add_pool $POOL2 $FSNAME-OST[$TGT_FIRST] "$FIRST_UUID "
781 do_facet mgs lctl pool_list $FSNAME.$POOL2
783 echo Checking the files again
784 check_dir_in_pool $POOL_ROOT/dir1 $POOL
785 check_dir_in_pool $POOL_ROOT/dir2 $POOL2
786 check_file_in_osts $POOL_ROOT/file1 "$TGT_LIST2"
787 check_file_in_osts $POOL_ROOT/file2 "$(seq 0x$start 2 0x$TGT_MAX)"
789 echo Creating some more files
790 create_dir $POOL_ROOT/dir3 $POOL
791 create_dir $POOL_ROOT/dir4 $POOL2
792 create_file $POOL_ROOT/file3 $POOL
793 create_file $POOL_ROOT/file4 $POOL2
795 echo Checking the new files
796 check_file_in_pool $POOL_ROOT/file3 $POOL
797 check_file_in_pool $POOL_ROOT/file4 $POOL2
801 run_test 12 "OST Pool Membership"
804 [[ $OSTCOUNT -le 2 ]] && skip_env "needs >= 3 OSTs"
806 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
810 create_pool_nofail $POOL
811 add_pool $POOL $TGT_ALL "$TGT_UUID"
813 create_dir $POOL_ROOT/dir1 $POOL -1
814 createmany -o $POOL_ROOT/dir1/$tfile $numfiles ||
815 error "createmany $POOL_ROOT/dir1/$tfile failed!"
816 for file in $POOL_ROOT/dir1/*; do
817 check_file_in_pool $file $POOL $OSTCOUNT
820 create_file $POOL_ROOT/dir1/file1 $POOL 1 $TGT_FIRST
821 create_file $POOL_ROOT/dir1/file2 $POOL 1 $((TGT_FIRST + 1))
822 create_file $POOL_ROOT/dir1/file3 $POOL 1 $((TGT_FIRST + 2))
823 check_file_in_osts $POOL_ROOT/dir1/file1 $((16#$TGT_FIRST))
824 check_file_in_osts $POOL_ROOT/dir1/file2 "$((TGT_FIRST + 1))"
825 check_file_in_osts $POOL_ROOT/dir1/file3 "$((TGT_FIRST + 2))"
827 create_dir $POOL_ROOT/dir2 $POOL $count
828 createmany -o $POOL_ROOT/dir2/$tfile- $numfiles ||
829 error "createmany $POOL_ROOT/dir2/$tfile- failed!"
830 for file in $POOL_ROOT/dir2/*; do
831 check_file_in_pool $file $POOL $count
834 create_dir $POOL_ROOT/dir3 $POOL $count $((TGT_FIRST + 1))
835 createmany -o $POOL_ROOT/dir3/$tfile- $numfiles ||
836 error "createmany $POOL_ROOT/dir3/$tfile- failed!"
837 for file in $POOL_ROOT/dir3/*; do
838 check_file_in_pool $file $POOL $count
841 create_dir $POOL_ROOT/dir4 $POOL 1
842 createmany -o $POOL_ROOT/dir4/$tfile- $numfiles ||
843 error "createmany $POOL_ROOT/dir4/$tfile- failed!"
844 for file in $POOL_ROOT/dir4/*; do
845 check_file_in_pool $file $POOL 1
848 create_dir $POOL_ROOT/dir5 $POOL 1 $((TGT_FIRST + 2))
849 createmany -o $POOL_ROOT/dir5/$tfile- $numfiles ||
850 error "createmany $POOL_ROOT/dir5/$tfile- failed!"
851 for file in $POOL_ROOT/dir5/*; do
852 check_file_in_pool $file $POOL 1
855 rm -rf $POOL_ROOT/dir[1-5]/
859 run_test 13 "Striping characteristics in a pool"
862 [[ $OSTCOUNT -le 2 ]] && skip_env "needs >= 3 OSTs"
864 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
868 [ $OSTSIZE -gt $((MAXFREE / OSTCOUNT)) ] &&
869 skip_env "OST size $OSTSIZE is larger than $((MAXFREE / OSTCOUNT))"
871 create_pool_nofail $POOL
872 create_pool_nofail $POOL2
874 add_pool $POOL $TGT_HALF "$TGT_UUID2"
875 add_pool $POOL2 "OST0000" "$FSNAME-OST0000_UUID "
877 create_dir $POOL_ROOT/dir1 $POOL 1
878 create_file $POOL_ROOT/dir1/file $POOL 1
879 local ost=$($LFS getstripe -i $POOL_ROOT/dir1/file)
881 while [[ $i -lt $numfiles ]]; do
883 [[ $ost -gt $((16#$TGT_MAX)) ]] && ost=$TGT_FIRST
885 # echo "Iteration: $i OST: $ost"
886 create_file $POOL_ROOT/dir1/file${i} $POOL 1
887 check_file_in_pool $POOL_ROOT/dir1/file${i} $POOL
891 # Fill up OST0 until it is nearly full.
892 # Create 9 files of size OST0_SIZE/10 each.
893 create_dir $POOL_ROOT/dir2 $POOL2 1
894 $LFS df $POOL_ROOT/dir2
895 OST0_SIZE=$($LFS df $POOL_ROOT/dir2 | awk '/\[OST:0\]/ { print $4 }')
896 FILE_SIZE=$((OST0_SIZE/1024/10))
897 echo "Filling OST0 with 9 files of ${FILE_SIZE}MB in $POOL_ROOT/dir2"
899 while [[ $i -lt 10 ]]; do
900 dd if=/dev/zero of=$POOL_ROOT/dir2/f${i} bs=1M count=$FILE_SIZE
903 sleep 1 # get new statfs info
904 $LFS df $POOL_ROOT/dir2
906 # OST $TGT_FIRST is no longer favored; but it may still be used.
907 create_dir $POOL_ROOT/dir3 $POOL 1
908 create_file $POOL_ROOT/dir3/file $POOL 1
909 createmany -o $POOL_ROOT/dir3/$tfile- $numfiles ||
910 error "createmany $POOL_ROOT/dir3/$tfile- failed!"
911 for file in $POOL_ROOT/dir3/*; do
912 check_file_in_pool $file $POOL
919 run_test 14 "Round robin and QOS striping within a pool"
922 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
926 while [[ $i -lt $OSTCOUNT ]]; do
927 create_pool_nofail $POOL${i}
929 local tgt=$(printf "$FSNAME-OST%04x_UUID " $i)
930 add_pool $POOL${i} "$FSNAME-OST[$(printf %04x $i)]" "$tgt"
931 create_dir $POOL_ROOT/dir${i} $POOL${i}
932 createmany -o $POOL_ROOT/dir$i/$tfile $numfiles ||
933 error "createmany $POOL_ROOT/dir$i/$tfile failed!"
935 for file in $POOL_ROOT/dir$i/*; do
936 check_file_in_osts $file $i
944 run_test 15 "One directory per OST/pool"
947 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
951 create_pool_nofail $POOL
953 add_pool $POOL $TGT_HALF "$TGT_UUID2"
955 local dir=$POOL_ROOT/$tdir
956 create_dir $dir $POOL
958 for i in $(seq 1 10); do
963 createmany -o $dir/$tfile $numfiles ||
964 error "createmany $dir/$tfile failed!"
966 for file in $dir/*; do
967 check_file_in_pool $file $POOL
970 rm -rf $POOL_ROOT/$tdir
974 run_test 16 "Inheritance of pool properties"
977 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
981 create_pool_nofail $POOL
983 add_pool $POOL $TGT_ALL "$TGT_UUID"
985 local dir=$POOL_ROOT/dir
986 create_dir $dir $POOL
988 createmany -o $dir/${tfile}1_ $numfiles ||
989 error "createmany $dir/${tfile}1_ failed!"
991 for file in $dir/*; do
992 check_file_in_pool $file $POOL
997 createmany -o $dir/${tfile}2_ $numfiles ||
998 error "createmany $dir/${tfile}2_ failed!"
1003 run_test 17 "Referencing an empty pool"
1012 wait_delete_completed >/dev/null # give pending IO a chance to go to disk
1013 stat=$(createmany -o $cdir/${tfile} -$numsec | tail -1)
1014 files=$(echo $stat | cut -f 2 -d ' ')
1016 unlinkmany $cdir/${tfile} $files > /dev/null
1023 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1026 local plaindir=$POOL_ROOT/plaindir
1027 local pooldir=$POOL_ROOT/pooldir
1033 for i in $(seq 1 $iter); do
1034 echo "Create performance, iteration $i, $numsec seconds x 3"
1036 local files1=$(create_perf $plaindir $numsec)
1037 [[ $files1 -eq 0 ]] && error "Zero files created without pool"
1039 echo "iter $i: $files1 creates without pool"
1041 create_pool_nofail $POOL > /dev/null
1042 add_pool $POOL $TGT_ALL "$TGT_UUID" > /dev/null
1043 create_dir $pooldir $POOL
1044 local files2=$(create_perf $pooldir $numsec)
1045 [[ $files2 -eq 0 ]] && error "Zero files created with pool"
1047 echo "iter $i: $files2 creates with pool"
1049 destroy_pool $POOL > /dev/null
1050 local files3=$(create_perf $pooldir $numsec)
1051 [[ $files3 -eq 0 ]] &&
1052 error "Zero files created with missing pool"
1054 echo "iter $i: $files3 creates with missing pool"
1059 echo Avg files created in $numsec seconds without pool: $((f1 / iter))
1060 echo Avg files created in $numsec seconds with pool: $((f2 / iter))
1061 echo Avg files created in $numsec seconds missing pool: $((f3 / iter))
1063 # Set this high until we establish a baseline for what the degradation
1067 diff=$((($f1 - $f2) * 100 / $f1))
1068 echo "No pool / wide pool: $diff %."
1069 [ $diff -gt $max ] &&
1070 error_ignore bz23408 "Degradation with wide pool is $diff% > $max%"
1073 diff=$((($f1 - $f3) * 100 / $f1))
1074 echo "No pool / missing pool: $diff %."
1075 [ $diff -gt $max ] &&
1076 error_ignore bz23408 "Degradation with wide pool is $diff% > $max%"
1080 run_test 18 "File create in a directory which references a deleted pool"
1083 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1085 local dir1=$POOL_ROOT/dir1
1086 local dir2=$POOL_ROOT/dir2
1089 create_pool_nofail $POOL
1091 add_pool $POOL $TGT_HALF "$TGT_UUID2"
1093 create_dir $dir1 $POOL
1094 createmany -o $dir1/${tfile} $numfiles ||
1095 error "createmany $dir1/${tfile} failed!"
1096 for file in $dir1/*; do
1097 check_file_in_pool $file $POOL
1101 createmany -o $dir2/${tfile} $numfiles ||
1102 error "createmany $dir2/${tfile} failed!"
1103 for file in $dir2/*; do
1104 check_file_not_in_pool $file $POOL
1111 run_test 19 "Pools should not come into play when not specified"
1114 [[ $OSTCOUNT -ge 2 ]] || skip_env "needs >= 2 OSTs"
1116 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1118 local dir1=$POOL_ROOT/dir1
1119 local dir2=$dir1/dir2
1120 local dir3=$dir1/dir3
1124 create_pool_nofail $POOL
1125 create_pool_nofail $POOL2
1127 add_pool $POOL $TGT_HALF "$TGT_UUID2"
1129 local start=$(printf %04x $((TGT_FIRST + 1)))
1130 TGT=$(for i in $(seq 0x$start 2 0x$TGT_MAX); do \
1131 printf "$FSNAME-OST%04x_UUID " $i; done)
1132 add_pool $POOL2 "$FSNAME-OST[$start-$TGT_MAX/2]" "$TGT"
1134 create_dir $dir1 $POOL
1135 create_file $dir1/file1 $POOL2 # Should replace $dir1 pool with $POOL2
1136 create_dir $dir2 $POOL2
1137 touch $dir2/file2 # Should inherit $POOL2 from $dir2
1138 mkdir $dir3 # Should inherit $POOL from $dir1
1139 $SETSTRIPE -c 1 $dir3 # Should remain existing $POOL
1140 touch $dir3/file3 # Should inherit $POOL from $dir3
1141 $SETSTRIPE -c 1 $dir2/file4 # Should inherit $POOL2 from dir2
1142 $SETSTRIPE -S 64K $dir1/file5 # Should inderit $POOL from $dir1
1144 check_file_in_pool $dir1/file1 $POOL2
1145 check_file_in_pool $dir2/file2 $POOL2
1146 check_dir_not_in_pool $dir3 $POOL2
1147 check_file_not_in_pool $dir3/file3 $POOL2
1148 check_file_not_in_pool $dir2/file4 $POOL
1149 check_file_not_in_pool $dir1/file5 $POOL2
1151 if [ $(lustre_version_code mds1) -ge $(version_code 2.10.54) ]; then
1152 check_dir_in_pool $dir3 $POOL
1153 check_file_in_pool $dir3/file3 $POOL
1154 check_file_in_pool $dir2/file4 $POOL2
1155 check_file_in_pool $dir1/file5 $POOL
1162 run_test 20 "Different pools in a directory hierarchy."
1165 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1166 [[ $OSTCOUNT -le 1 ]] && skip_env "needs >= 2 OSTs"
1170 local dir=$POOL_ROOT/dir
1172 create_pool_nofail $POOL
1174 add_pool $POOL $TGT_HALF "$TGT_UUID2"
1176 create_dir $dir $POOL $OSTCOUNT
1177 create_file $dir/file1 $POOL $OSTCOUNT
1178 $LFS getstripe -v $dir/file1
1179 check_file_in_pool $dir/file1 $POOL
1185 run_test 21 "OST pool with fewer OSTs than stripe count"
1193 for c in $(seq 1 10); do
1194 echo "Pool $pool, iteration $c"
1195 do_facet mgs lctl pool_add $FSNAME.$pool \
1196 OST[$TGT_FIRST-$TGT_MAX/$step] 2>/dev/null
1197 local TGT_SECOND=$(printf %04x $((TGT_FIRST + $step)))
1198 if [ $((16#$TGT_SECOND)) -le $((16#$TGT_MAX)) ]; then
1199 do_facet mgs lctl pool_remove $FSNAME.$pool \
1200 OST[$TGT_SECOND-$TGT_MAX/$step]
1203 echo loop for $pool complete
1207 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1208 [[ $OSTCOUNT -le 1 ]] && skip_env "needs >= 2 OSTs"
1212 create_pool_nofail $POOL
1213 add_pool $POOL "OST0000" "$FSNAME-OST0000_UUID "
1214 create_pool_nofail $POOL2
1215 add_pool $POOL2 "OST0000" "$FSNAME-OST0000_UUID "
1220 create_dir $POOL_ROOT $POOL
1221 createmany -o $POOL_ROOT/${tfile} $numfiles ||
1222 error "createmany $POOL_ROOT/${tfile} failed!"
1227 run_test 22 "Simultaneous manipulation of a pool"
1230 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1231 [[ $OSTCOUNT -le 1 ]] && skip_env "needs >= 2 OSTs"
1234 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS ||
1235 skip_env "User $RUNAS_ID does not exist - skipping"
1239 local BUNIT_SZ=1024 # min block quota unit(kB)
1240 local LIMIT=$((BUNIT_SZ * (OSTCOUNT + 1)))
1241 local dir=$POOL_ROOT/dir
1242 local file="$dir/$tfile-quota"
1244 create_pool_nofail $POOL
1246 local TGT=$(for i in $(seq 0x$TGT_FIRST 3 0x$TGT_MAX); do \
1247 printf "$FSNAME-OST%04x_UUID " $i; done)
1248 add_pool $POOL "$FSNAME-OST[$TGT_FIRST-$TGT_MAX/3]" "$TGT"
1249 create_dir $dir $POOL
1251 # XXX remove the interoperability code once we drop the old server
1252 # ( < 2.3.50) support.
1253 if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.50) ]; then
1254 $LFS quotaoff -ug $MOUNT
1255 $LFS quotacheck -ug $MOUNT
1257 if [[ $PERM_CMD = *"set_param -P"* ]]; then
1258 do_facet mgs $PERM_CMD \
1259 osd-*.$FSNAME-OST*.quota_slave.enable=ug
1261 do_facet mgs $PERM_CMD $FSNAME.quota.ost=ug
1266 $LFS setquota -u $RUNAS_ID -b $LIMIT -B $LIMIT $dir
1268 $LFS quota -v -u $RUNAS_ID $dir
1270 $SETSTRIPE -c 1 -p $POOL $file
1271 chown $RUNAS_ID.$RUNAS_GID $file
1274 # This does two "dd" runs to ensure that the quota failure is returned
1275 # to userspace when we check. The first "dd" might otherwise complete
1276 # without error if it is only writing into cache.
1277 stat=$(LOCALE=C $RUNAS dd if=/dev/zero of=$file bs=$BUNIT_SZ \
1278 count=$((BUNIT_SZ*2)) 2>&1)
1279 echo $stat | grep "Disk quota exceeded" > /dev/null
1280 if [ $? -eq 0 ]; then
1281 $LFS quota -v -u $RUNAS_ID $dir
1282 cancel_lru_locks osc
1283 stat=$(LOCALE=C $RUNAS dd if=/dev/zero of=$file bs=$BUNIT_SZ \
1284 count=$BUNIT_SZ seek=$((BUNIT_SZ*2)) 2>&1)
1287 [[ $RC -eq 0 ]] && error "second dd did not fail."
1288 echo $stat | grep "Disk quota exceeded" > /dev/null
1289 [[ $? -eq 1 ]] && error "second dd did not fail with EDQUOT."
1291 log "first dd failed with EDQUOT."
1293 $LFS quota -v -u $RUNAS_ID $dir
1295 run_test 23a "OST pools and quota"
1298 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1299 [[ $OSTCOUNT -le 1 ]] && skip_env "needs >= 2 OSTs"
1302 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS || {
1303 skip_env "User $RUNAS_ID does not exist - skipping"
1308 local dir=$POOL_ROOT/dir
1309 local file="$dir/$tfile-quota"
1311 create_pool_nofail $POOL
1313 local TGT=$(for i in $(seq 0x$TGT_FIRST 3 0x$TGT_MAX); do \
1314 printf "$FSNAME-OST%04x_UUID " $i; done)
1315 add_pool $POOL "$FSNAME-OST[$TGT_FIRST-$TGT_MAX/3]" "$TGT"
1316 create_dir $dir $POOL
1318 local maxfree=$((1024 * 1024 * 30)) # 30G
1319 local AVAIL=$(lfs_df -p $POOL $dir | awk '/summary/ { print $4 }')
1320 [ $AVAIL -gt $maxfree ] &&
1321 skip_env "Filesystem space $AVAIL is larger than " \
1324 echo "OSTCOUNT=$OSTCOUNT, OSTSIZE=$OSTSIZE, AVAIL=$AVAIL"
1325 echo "MAXFREE=$maxfree, SLOW=$SLOW"
1327 # XXX remove the interoperability code once we drop the old server
1328 # ( < 2.3.50) support.
1329 if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.50) ]; then
1330 $LFS quotaoff -ug $MOUNT
1332 if [[ $PERM_CMD = *"set_param -P"* ]]; then
1333 do_facet mgs $PERM_CMD \
1334 osd-*.$FSNAME-OST*.quota_slave.enable=none
1336 do_facet mgs $PERM_CMD $FSNAME.quota.ost=none
1341 chown $RUNAS_ID.$RUNAS_ID $dir
1345 local stime=$(date +%s)
1349 local maxtime=300 # minimum speed: 5GB / 300sec ~= 17MB/s
1350 while [ $RC -eq 0 ]; do
1352 stat=$(LOCALE=C $RUNAS2 dd if=/dev/zero of=${file}$i bs=1M \
1353 count=$((5 * 1024)) 2>&1)
1355 TOTAL=$((TOTAL + 1024 * 1024 * 5))
1356 echo "[$i iteration] $stat"
1357 echo "total written: $TOTAL"
1360 elapsed=$((etime - stime))
1361 echo "stime=$stime, etime=$etime, elapsed=$elapsed"
1363 if [ $RC -eq 1 ]; then
1364 echo $stat | grep -q "Disk quota exceeded"
1366 error "dd failed with EDQUOT with quota off"
1368 echo $stat | grep -q "No space left on device"
1370 error "dd did not fail with ENOSPC"
1371 elif [ $TOTAL -gt $AVAIL ]; then
1372 error "dd didn't fail with ENOSPC ($TOTAL > $AVAIL)"
1373 elif [ $i -eq 1 -a $elapsed -gt $maxtime ]; then
1374 log "The first 5G write used $elapsed (> $maxtime) " \
1375 "seconds, terminated"
1383 run_test 23b "OST pools and OOS"
1386 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1387 [[ $OSTCOUNT -le 1 ]] && skip_env "needs >= 2 OSTs"
1389 local server_version=$(lustre_version_code $SINGLEMDS)
1390 [[ $server_version -ge $(version_code 2.8.56) ]] ||
1391 skip "Need server version newer than 2.8.55"
1399 create_pool_nofail $POOL
1401 add_pool $POOL $TGT_ALL "$TGT_UUID"
1403 create_dir $POOL_ROOT/dir1 $POOL $OSTCOUNT
1405 mkdir $POOL_ROOT/dir2
1406 $SETSTRIPE -p $POOL -S 65536 -i 0 -c 1 $POOL_ROOT/dir2 ||
1407 error "$SETSTRIPE $POOL_ROOT/dir2 failed"
1409 mkdir $POOL_ROOT/dir3
1410 $SETSTRIPE -S 65536 -i 0 -c 1 $POOL_ROOT/dir3 ||
1411 error "$SETSTRIPE $POOL_ROOT/dir3 failed"
1413 mkdir $POOL_ROOT/dir4
1415 for i in 1 2 3 4; do
1416 dir=${POOL_ROOT}/dir${i}
1425 createmany -o $dir/${tfile} $numfiles ||
1426 error "createmany $dir/${tfile} failed!"
1427 pool=$($LFS getstripe --pool $dir)
1428 index=$($LFS getstripe -i $dir)
1429 size=$($LFS getstripe -S $dir)
1430 count=$($LFS getstripe -c $dir)
1432 for file in $dir/*; do
1433 if [ "$pool" != "" ]; then
1434 check_file_in_pool $file $pool
1436 pool1=$($LFS getstripe --pool $file)
1437 count1=$($LFS getstripe -c $file)
1438 size1=$($LFS getstripe -S $file)
1439 [[ "$pool" != "$pool1" ]] &&
1440 error "Pool '$pool' not on $file:$pool1"
1441 [[ "$count" != "$count1" ]] &&
1442 [[ "$count" != "-1" ]] &&
1443 error "Stripe count $count not on"\
1445 [[ "$count1" != "$OSTCOUNT" ]] &&
1446 [[ "$count" = "-1" ]] &&
1447 error "Stripe count $count1 not on"\
1449 [[ "$size" != "$size1" ]] && [[ "$size" != "0" ]] &&
1450 error "Stripe size $size not on $file:$size1"
1458 run_test 24 "Independence of pool from other setstripe parameters"
1461 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1465 for i in $(seq 10); do
1466 create_pool_nofail $POOL$i
1467 do_facet mgs "lctl pool_add $FSNAME.$POOL$i OST0000; sync"
1468 wait_update $HOSTNAME "lctl get_param -n \
1469 lov.$FSNAME-*.pools.$POOL$i | sort -u |
1470 tr '\n' ' ' " "$FSNAME-OST0000_UUID " >/dev/null ||
1471 error "pool_add failed: $1; $2"
1473 facet_failover $SINGLEMDS ||
1474 error "failed to failover $SINGLEMDS"
1475 wait_osc_import_state $SINGLEMDS ost FULL
1479 # Veriy that the pool got created and is usable
1480 df $POOL_ROOT > /dev/null
1483 # Make sure OST0 can be striped on
1484 $SETSTRIPE -i 0 -c 1 $POOL_ROOT/$tfile
1485 local STR=$($LFS getstripe -i $POOL_ROOT/$tfile)
1486 rm $POOL_ROOT/$tfile
1487 if [[ "$STR" == "0" ]]; then
1488 echo "Creating a file in pool$i"
1489 create_file $POOL_ROOT/file$i $POOL$i || break
1490 check_file_in_pool $POOL_ROOT/file$i $POOL$i || break
1492 echo "OST 0 seems to be unavailable. Try later."
1498 run_test 25 "Create new pool and restart MDS"
1501 [[ $OSTCOUNT -le 2 ]] && skip_env "needs >= 3 OSTs"
1502 local dev=$(mdsdevname ${SINGLEMDS//mds/})
1503 local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
1507 create_pool_nofail $POOL2
1509 do_facet mgs "lctl pool_add $FSNAME.$POOL2 OST0000; sync"
1510 wait_update $HOSTNAME "lctl get_param -n \
1511 lov.$FSNAME-*.pools.$POOL2 | sort -u |
1512 grep $FSNAME-OST0000_UUID " "$FSNAME-OST0000_UUID" ||
1513 error "pool_add failed: $1; $2"
1515 do_facet mgs "lctl pool_add $FSNAME.$POOL2 OST0002; sync"
1516 wait_update $HOSTNAME "lctl get_param -n \
1517 lov.$FSNAME-*.pools.$POOL2 | sort -u |
1518 grep $FSNAME-OST0002_UUID" "$FSNAME-OST0002_UUID" ||
1519 error "pool_add failed: $1; $2"
1521 # Veriy that the pool got created and is usable
1523 echo "Creating files in $POOL2"
1525 for ((i = 0; i < 10; i++)); do
1526 #OBD_FAIL_MDS_OSC_CREATE_FAIL 0x147
1527 #Fail OST0000 to ensure objects create on
1528 #the other OST in the pool
1529 do_facet $SINGLEMDS lctl set_param fail_loc=0x147
1530 do_facet $SINGLEMDS lctl set_param fail_val=0
1531 create_file $POOL_ROOT/file$i $POOL2 1 -1 || break
1532 do_facet $SINGLEMDS lctl set_param fail_loc=0
1533 check_file_in_pool $POOL_ROOT/file$i $POOL2 || break
1537 run_test 26 "Choose other OSTs in the pool first in the creation remedy"
1540 [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs"
1544 local count=$OSTCOUNT
1546 create_pool_nofail $POOL
1547 do_facet mgs lctl pool_add $FSNAME.$POOL $TGT_ALL
1548 osts=$(list_pool $FSNAME.$POOL)
1549 for ost in ${osts}; do
1551 if [[ $count -eq 0 ]]; then
1552 #define OBD_FAIL_OST_LIST_ASSERT 0x239
1553 do_facet $SINGLEMDS \
1554 $LCTL set_param fail_loc=0x239 fail_val=10
1555 list_pool $FSNAME.$POOL &
1558 do_facet $SINGLEMDS $LCTL set_param fail_loc=0
1559 do_facet mgs $LCTL pool_remove $FSNAME.$POOL $ost
1561 do_facet $SINGLEMDS $LCTL set_param fail_val=0
1563 do_facet mgs $LCTL pool_remove $FSNAME.$POOL $ost
1568 run_test 27 "Race pool_list and pool_remove"
1573 destroy_test_pools $FSNAME
1574 if ! combined_mgs_mds; then
1575 zconf_umount $mgs_HOST $MOUNT
1576 do_facet mgs "rm -rf $MOUNT"
1578 check_and_cleanup_lustre