X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2Fost-pools.sh;h=09a2aef089800ded382f7cd8495c87085da4ae47;hb=8932a707f0e9461729adaea7a240509a796b3b5d;hp=909b35c9e1301a9aae4e8f3afadf2f0bd416515b;hpb=9bab04cf69a33fb5ba3724ab5aa9f7654c80cf42;p=fs%2Flustre-release.git diff --git a/lustre/tests/ost-pools.sh b/lustre/tests/ost-pools.sh index 909b35c..09a2aef 100644 --- a/lustre/tests/ost-pools.sh +++ b/lustre/tests/ost-pools.sh @@ -1,4 +1,6 @@ #!/bin/bash +# -*- mode: Bash; tab-width: 4; indent-tabs-mode: t; -*- +# vim:autoindent:shiftwidth=4:tabstop=4: # # Run select tests by setting ONLY, or as arguments to the script. # Skip specific tests by setting EXCEPT. @@ -73,12 +75,12 @@ create_dir() { mkdir -p $dir if [[ -n $4 ]]; then - $SETSTRIPE -c $count -p $pool $dir -o $idx + $SETSTRIPE -c $count -p $pool $dir -o $idx else - $SETSTRIPE -c $count -p $pool $dir + $SETSTRIPE -c $count -p $pool $dir fi [[ $? -eq 0 ]] || \ - error "$SETSTRIPE -p $pool $dir failed." + error "$SETSTRIPE -p $pool $dir failed." } create_file() { @@ -89,14 +91,14 @@ create_file() { rm -f $file $SETSTRIPE -o $index -c $count -p $pool $file [[ $? -eq 0 ]] || \ - error "$SETSTRIPE -p $pool $file failed." + error "$SETSTRIPE -p $pool $file failed." } osts_in_pool() { local pool=$1 local res - for i in $(do_facet mds lctl pool_list $FSNAME.$pool | grep -v "^Pool:" \ - | sed -e 's/_UUID$//;s/^.*-OST//'); do + for i in $(do_facet $SINGLEMDS lctl pool_list $FSNAME.$pool | \ + grep -v "^Pool:" | sed -e 's/_UUID$//;s/^.*-OST//'); do res="$res $(printf "%d" 0x$i)" done echo $res @@ -106,12 +108,12 @@ check_dir_in_pool() { local dir=$1 local pool=$2 local res=$($GETSTRIPE $dir | grep "^stripe_count:" \ - | cut -d ':' -f 5 | tr -d "[:blank:]") + | cut -d ':' -f 5 | tr -d "[:blank:]") if [[ "$res" == "$pool" ]]; then - return 0 + return 0 else - error found $res instead of $pool - return 1 + error found $res instead of $pool + return 1 fi } @@ -121,28 +123,28 @@ check_file_in_pool() { } check_file_in_osts() { - local file=$1 - local pool_list=${2:-$TGT_LIST} - local count=$3 - local res=$($GETSTRIPE $file | grep 0x | cut -f2) - local i - for i in $res - do - found=$(echo :$pool_list: | tr " " ":" | grep :$i:) - if [[ "$found" == "" ]]; then - echo "pool list: $pool_list" - echo "striping: $res" - $GETSTRIPE $file - error "$file not allocated from OSTs $pool_list." - return 1 - fi - done - - local ost_count=$($GETSTRIPE $file | grep 0x | wc -l) - [[ -n "$count" ]] && [[ $ost_count -ne $count ]] && \ - error "Stripe count $count expected; got $ost_count" - - return 0 + local file=$1 + local pool_list=${2:-$TGT_LIST} + local count=$3 + local res=$($GETSTRIPE $file | grep 0x | cut -f2) + local i + for i in $res + do + found=$(echo :$pool_list: | tr " " ":" | grep :$i:) + if [[ "$found" == "" ]]; then + echo "pool list: $pool_list" + echo "striping: $res" + $GETSTRIPE $file + error "$file not allocated from OSTs $pool_list." + return 1 + fi + done + + local ost_count=$($GETSTRIPE $file | grep 0x | wc -l) + [[ -n "$count" ]] && [[ $ost_count -ne $count ]] && \ + { error "Stripe count $count expected; got $ost_count" && return 1; } + + return 0 } check_file_not_in_pool() { @@ -150,71 +152,56 @@ check_file_not_in_pool() { local pool=$2 local res=$($GETSTRIPE -v $file | grep "^pool:" | tr -d "[:blank:]" | cut -f 2 -d ':') if [[ "$res" == "$pool" ]]; then - error "File $file is in pool: $res" - return 1 + error "File $file is in pool: $res" + return 1 else - return 0 + return 0 fi } check_dir_not_in_pool() { local dir=$1 local pool=$2 - local res=$($GETSTRIPE -v $dir | grep "^stripe_count" | head -1 | cut -f 8 -d ' ') + local res=$($GETSTRIPE -v $dir | grep "^stripe_count" | head -1 | \ + cut -f 8 -d ' ') if [[ "$res" == "$pool" ]]; then - error "File $dir is in pool: $res" - return 1 + error "File $dir is in pool: $res" + return 1 else - return 0 + return 0 fi } create_pool() { - do_facet mds lctl pool_new $FSNAME.$1 + do_facet $SINGLEMDS lctl pool_new $FSNAME.$1 local RC=$? # get param should return err until pool is created [[ $RC -ne 0 ]] && return $RC wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$1 \ - 2>/dev/null || echo foo" "" || RC=1 + 2>/dev/null || echo foo" "" || RC=1 [[ $RC -ne 0 ]] && error "pool_new failed" return $RC } -destroy_pool_int() { - OSTS=$(do_facet mds lctl pool_list $1 | awk '$1 !~ /^Pool:/ {print $1}') - for ost in $OSTS - do - do_facet mds lctl pool_remove $1 $ost - done - do_facet mds lctl pool_destroy $1 -} - -destroy_pool() { - local RC - - do_facet mds lctl pool_list $FSNAME.$1 - RC=$? - [[ $RC -ne 0 ]] && return $RC - - destroy_pool_int $FSNAME.$1 - RC=$? - [[ $RC -ne 0 ]] && return $RC - - wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$1 \ - 2>/dev/null || echo foo" "foo" && return 0 +drain_pool() { + pool=$1 + wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$pool" ""\ + ||error "Failed to remove targets from pool: $pool" } add_pool() { local pool=$1 local osts=$2 - local tgt="${3}$(lctl get_param -n lov.$FSNAME-*.pools.$pool | sort -u | tr '\n' ' ')" + local tgt="${3}$(lctl get_param -n lov.$FSNAME-*.pools.$pool | \ + sort -u | tr '\n' ' ')" - do_facet mds lctl pool_add $FSNAME.$pool $osts + do_facet $SINGLEMDS lctl pool_add $FSNAME.$pool $osts local RC=$? [[ $RC -ne 0 ]] && return $RC - wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$pool | sort -u | tr '\n' ' ' " "$tgt" || RC=1 + wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$pool | \ + sort -u | tr '\n' ' ' " "$tgt" || RC=1 [[ $RC -ne 0 ]] && error "pool_add failed: $1; $2" return $RC } @@ -223,7 +210,7 @@ create_pool_nofail() { create_pool $1 if [[ $? != 0 ]] then - error "Pool creation of $1 failed" + error "Pool creation of $1 failed" fi } @@ -231,14 +218,15 @@ create_pool_fail() { create_pool $1 if [[ $? == 0 ]] then - error "Pool creation of $1 succeeded; should have failed" + error "Pool creation of $1 succeeded; should have failed" fi } cleanup_tests() { # Destroy pools from previous test runs - for p in $(do_facet mds lctl pool_list $FSNAME | grep $FSNAME.pool[0-$OSTCOUNT]); do - destroy_pool_int $p; + for p in $(do_facet $SINGLEMDS lctl pool_list $FSNAME | \ + grep $FSNAME.pool[0-$OSTCOUNT]); do + destroy_pool_int $p; done rm -rf $DIR/d0.${TESTSUITE} } @@ -276,29 +264,29 @@ test_1() { create_pool_fail $NAME echo "pool_new should fail if fs-name or poolname are missing." - do_facet mds lctl pool_new .pool1 + do_facet $SINGLEMDS lctl pool_new .pool1 2>/dev/null [[ $? -ne 0 ]] || \ - error "pool_new did not fail even though fs-name was missing." - do_facet mds lctl pool_new pool1 + error "pool_new did not fail even though fs-name was missing." + do_facet $SINGLEMDS lctl pool_new pool1 2>/dev/null [[ $? -ne 0 ]] || \ - error "pool_new did not fail even though fs-name was missing." - do_facet mds lctl pool_new ${FSNAME}. + error "pool_new did not fail even though fs-name was missing." + do_facet $SINGLEMDS lctl pool_new ${FSNAME}. 2>/dev/null [[ $? -ne 0 ]] || \ - error "pool_new did not fail even though pool name was missing." - do_facet mds lctl pool_new . + error "pool_new did not fail even though pool name was missing." + do_facet $SINGLEMDS lctl pool_new . 2>/dev/null [[ $? -ne 0 ]] || \ - error "pool_new did not fail even though pool name and fs-name " \ - "were missing." - do_facet mds lctl pool_new ${FSNAME},pool1 + error "pool_new did not fail even though pool name and fs-name " \ + "were missing." + do_facet $SINGLEMDS lctl pool_new ${FSNAME},pool1 2>/dev/null [[ $? -ne 0 ]] || \ - error "pool_new did not fail even though pool name format was wrong" - do_facet mds lctl pool_new ${FSNAME}/pool1 + error "pool_new did not fail even though pool name format was wrong" + do_facet $SINGLEMDS lctl pool_new ${FSNAME}/pool1 2>/dev/null [[ $? -ne 0 ]] || \ - error "pool_new did not fail even though pool name format was wrong" + error "pool_new did not fail even though pool name format was wrong" - do_facet mds lctl pool_new ${FSNAME}.p + do_facet $SINGLEMDS lctl pool_new ${FSNAME}.p 2>/dev/null [[ $? -ne 0 ]] || \ - error "pool_new did not fail even though pool1 existed" + error "pool_new did not fail even though pool1 existed" destroy_pool p } @@ -307,17 +295,18 @@ run_test 1 "Test lctl pool_new =========================================" test_2a() { destroy_pool $POOL - do_facet mds lctl pool_add $FSNAME.$POOL $FSNAME-OST0000 + do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL $FSNAME-OST0000 2>/dev/null [[ $? -ne 0 ]] || \ - error " pool_add did not fail even though pool did " \ - " not exist." + error " pool_add did not fail even though pool did " \ + " not exist." } run_test 2a "pool_add: non-existant pool" test_2b() { - do_facet mds lctl pool_add $FSNAME.p1234567891234567890 $FSNAME-OST0000 + do_facet $SINGLEMDS lctl pool_add $FSNAME.p1234567891234567890 \ + $FSNAME-OST0000 2>/dev/null [[ $? -ne 0 ]] || \ - error "pool_add did not fail even though pool name was invalid." + error "pool_add did not fail even though pool name was invalid." } run_test 2b "pool_add: Invalid pool name" @@ -328,44 +317,49 @@ test_2c() { lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null [[ $? -ne 0 ]] || \ - destroy_pool $POOL + destroy_pool $POOL create_pool_nofail $POOL # 1. OST0000 - do_facet mds lctl pool_add $FSNAME.$POOL OST0000 + do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL OST0000 RC=$?; [[ $RC -eq 0 ]] || \ - error "pool_add failed. $FSNAME $POOL OST0000: $RC" - do_facet mds lctl pool_remove $FSNAME.$POOL OST0000 + error "pool_add failed. $FSNAME $POOL OST0000: $RC" + do_facet $SINGLEMDS lctl pool_remove $FSNAME.$POOL OST0000 + drain_pool $POOL - # 2. lustre­OST0000 - do_facet mds lctl pool_add $FSNAME.$POOL $FSNAME-OST0000 + # 2. lustre-OST0000 + do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL $FSNAME-OST0000 RC=$?; [[ $RC -eq 0 ]] || \ - error "pool_add failed. $FSNAME $POOL $FSNAME-OST0000: $RC" - do_facet mds lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000 + error "pool_add failed. $FSNAME $POOL $FSNAME-OST0000: $RC" + do_facet $SINGLEMDS lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000 + drain_pool $POOL - # 3. lustre­OST0000_UUID - do_facet mds lctl pool_add $FSNAME.$POOL $FSNAME-OST0000_UUID + # 3. lustre-OST0000_UUID + do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL $FSNAME-OST0000_UUID RC=$?; [[ $RC -eq 0 ]] || \ - error "pool_add failed. $FSNAME $POOL $FSNAME-OST0000_UUID: $RC" - do_facet mds lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000_UUID + error "pool_add failed. $FSNAME $POOL $FSNAME-OST0000_UUID: $RC" + do_facet $SINGLEMDS lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000_UUID + drain_pool $POOL - # 4. lustre­OST[0,1,2,3,] + # 4. lustre-OST[0,1,2,3,] TGT="$FSNAME-OST[" for i in $TGT_LIST; do TGT=${TGT}$(printf "$i," $i); done TGT="${TGT}]" - do_facet mds lctl pool_add $FSNAME.$POOL $TGT + do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL $TGT [[ $? -eq 0 ]] || \ - error "pool_add failed. $FSNAME.$POOL $TGT. $RC" - do_facet mds lctl pool_remove $FSNAME.$POOL $TGT + error "pool_add failed. $FSNAME.$POOL $TGT. $RC" + do_facet $SINGLEMDS lctl pool_remove $FSNAME.$POOL $TGT + drain_pool $POOL - # 5. lustre­OST[0-5/1] - do_facet mds lctl pool_add $FSNAME.$POOL $TGT_ALL + # 5. lustre-OST[0-5/1] + do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL $TGT_ALL RC=$?; [[ $RC -eq 0 ]] || \ - error "pool_add failed. $FSNAME $POOL" "$TGT_ALL $RC" + error "pool_add failed. $FSNAME $POOL" "$TGT_ALL $RC" wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$POOL | \ sort -u | tr '\n' ' ' " "$TGT_UUID" || error "Add to pool failed" - do_facet mds lctl pool_remove $FSNAME.$POOL $TGT_ALL + do_facet $SINGLEMDS lctl pool_remove $FSNAME.$POOL $TGT_ALL + drain_pool $POOL destroy_pool $POOL } @@ -377,14 +371,14 @@ test_2d() { lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null [[ $? -ne 0 ]] || \ - destroy_pool $POOL + destroy_pool $POOL create_pool_nofail $POOL TGT=$(printf "$FSNAME-OST%04x_UUID " $OSTCOUNT) - do_facet mds lctl pool_add $FSNAME.$POOL $TGT + do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL $TGT RC=$?; [[ $RC -ne 0 ]] || \ - error "pool_add succeeded for an OST ($TGT) that does not exist." + error "pool_add succeeded for an OST ($TGT) that does not exist." destroy_pool $POOL } @@ -397,23 +391,24 @@ test_2e() { $LCTL get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null [[ $? -ne 0 ]] || \ - destroy_pool $POOL + destroy_pool $POOL create_pool_nofail $POOL TGT="$FSNAME-OST0000_UUID " - do_facet mds lctl pool_add $FSNAME.$POOL $TGT + do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL $TGT wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$POOL | \ sort -u | tr '\n' ' ' " "$TGT" || error "Add to pool failed" - RESULT=$(do_facet mds "LOCALE=C $LCTL pool_add $FSNAME.$POOL $TGT 2>&1") + RESULT=$(do_facet $SINGLEMDS \ + "LOCALE=C $LCTL pool_add $FSNAME.$POOL $TGT 2>&1") RC=$? echo $RESULT [[ $RC -ne 0 ]] || \ - error "pool_add succeeded for an OST that was already in the pool." + error "pool_add succeeded for an OST that was already in the pool." [[ $(grep "already in pool" <<< $RESULT) ]] || \ - error "pool_add failed as expected but error message not as expected." + error "pool_add failed as expected but error message not as expected." destroy_pool $POOL } @@ -422,57 +417,59 @@ run_test 2e "pool_add: OST already in a pool should be rejected ========" test_3a() { lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null [[ $? -ne 0 ]] || \ - destroy_pool $POOL + destroy_pool $POOL - do_facet mds lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000 + do_facet $SINGLEMDS lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000 2>/dev/null [[ $? -ne 0 ]] || \ - error "pool_remove did not fail even though" \ - "pool did not exist." + error "pool_remove did not fail even though pool did not exist." } run_test 3a "pool_remove: non-existant pool" test_3b() { - do_facet mds lctl pool_remove ${NON_EXISTANT_FS}.$POOL OST0000 + do_facet $SINGLEMDS lctl pool_remove ${NON_EXISTANT_FS}.$POOL OST0000 2>/dev/null [[ $? -ne 0 ]] || \ - error "pool_remove did not fail even though fsname did not exist." + error "pool_remove did not fail even though fsname did not exist." } run_test 3b "pool_remove: non-existant fsname" test_3c() { - do_facet mds lctl pool_remove $FSNAME.p1234567891234567890 $FSNAME-OST0000 + do_facet $SINGLEMDS lctl pool_remove $FSNAME.p1234567891234567890 \ + $FSNAME-OST0000 2>/dev/null [[ $? -ne 0 ]] || \ - error "pool_remove did not fail even though pool name was invalid." + error "pool_remove did not fail even though pool name was invalid." } run_test 3c "pool_remove: Invalid pool name" - # Testing various combinations of OST name list test_3d() { lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null [[ $? -ne 0 ]] || \ - destroy_pool $POOL + destroy_pool $POOL create_pool_nofail $POOL - do_facet mds lctl pool_add $FSNAME.$POOL OST0000 - do_facet mds lctl pool_remove $FSNAME.$POOL OST0000 + do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL OST0000 + do_facet $SINGLEMDS lctl pool_remove $FSNAME.$POOL OST0000 [[ $? -eq 0 ]] || \ - error "pool_remove failed. $FSNAME $POOL OST0000" + error "pool_remove failed. $FSNAME $POOL OST0000" + drain_pool $POOL - do_facet mds lctl pool_add $FSNAME.$POOL $FSNAME-OST0000 - do_facet mds lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000 + do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL $FSNAME-OST0000 + do_facet $SINGLEMDS lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000 [[ $? -eq 0 ]] || \ - error "pool_remove failed. $FSNAME $POOL $FSNAME-OST0000" + error "pool_remove failed. $FSNAME $POOL $FSNAME-OST0000" + drain_pool $POOL - do_facet mds lctl pool_add $FSNAME.$POOL $FSNAME-OST0000_UUID - do_facet mds lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000_UUID + do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL $FSNAME-OST0000_UUID + do_facet $SINGLEMDS lctl pool_remove $FSNAME.$POOL $FSNAME-OST0000_UUID [[ $? -eq 0 ]] || \ - error "pool_remove failed. $FSNAME $POOL $FSNAME-OST0000_UUID" + error "pool_remove failed. $FSNAME $POOL $FSNAME-OST0000_UUID" + drain_pool $POOL add_pool $POOL $TGT_ALL "$TGT_UUID" - - do_facet mds lctl pool_remove $FSNAME.$POOL $TGT_ALL + do_facet $SINGLEMDS lctl pool_remove $FSNAME.$POOL $TGT_ALL [[ $? -eq 0 ]] || \ - error "pool_remove failed. $FSNAME $POOL" $TGT_ALL + error "pool_remove failed. $FSNAME $POOL" $TGT_ALL + drain_pool $POOL destroy_pool $POOL } @@ -481,18 +478,18 @@ run_test 3d "pool_remove: OST index combinations ===========================" test_4a() { lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null [[ $? -ne 0 ]] || \ - destroy_pool $POOL + destroy_pool $POOL - do_facet mds lctl pool_destroy $FSNAME.$POOL + do_facet $SINGLEMDS lctl pool_destroy $FSNAME.$POOL 2>/dev/null [[ $? -ne 0 ]] || \ - error "pool_destroy did not fail even though pool did not exist." + error "pool_destroy did not fail even though pool did not exist." } run_test 4a "pool_destroy: non-existant pool" test_4b() { - do_facet mds lctl pool_destroy ${NON_EXISTANT_FS}.$POOL + do_facet $SINGLEMDS lctl pool_destroy ${NON_EXISTANT_FS}.$POOL 2>/dev/null [[ $? -ne 0 ]] || \ - error "pool_destroy did not fail even though the filesystem did not exist." + error "pool_destroy did not fail even though the filesystem did not exist." } run_test 4b "pool_destroy: non-existant fs-name" @@ -500,9 +497,9 @@ test_4c() { create_pool_nofail $POOL add_pool $POOL "OST0000" "$FSNAME-OST0000_UUID " - do_facet mds lctl pool_destroy ${FSNAME}.$POOL + do_facet $SINGLEMDS lctl pool_destroy ${FSNAME}.$POOL [[ $? -ne 0 ]] || \ - error "pool_destroy succeeded with a non-empty pool name." + error "pool_destroy succeeded with a non-empty pool." destroy_pool $POOL } run_test 4c "pool_destroy: non-empty pool ===============================" @@ -510,49 +507,49 @@ run_test 4c "pool_destroy: non-empty pool ===============================" sub_test_5() { local LCMD=$1 - $LCMD pool_list + $LCMD pool_list 2>/dev/null [[ $? -ne 0 ]] || \ - error "pool_list did not fail even though fsname was not mentioned." + error "pool_list did not fail even though fsname was not mentioned." - destroy_pool $POOL - destroy_pool $POOL2 + destroy_pool $POOL 2>/dev/null + destroy_pool $POOL2 2>/dev/null create_pool_nofail $POOL create_pool_nofail $POOL2 $LCMD pool_list $FSNAME [[ $? -eq 0 ]] || \ - error "pool_list $FSNAME failed." + error "pool_list $FSNAME failed." - do_facet mds lctl pool_add $FSNAME.$POOL $TGT_ALL + do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL $TGT_ALL $LCMD pool_list $FSNAME.$POOL [[ $? -eq 0 ]] || \ - error "pool_list $FSNAME.$POOL failed." + error "pool_list $FSNAME.$POOL failed." - $LCMD pool_list ${NON_EXISTANT_FS} + $LCMD pool_list ${NON_EXISTANT_FS} 2>/dev/null [[ $? -ne 0 ]] || \ - error "pool_list did not fail for a non-existant fsname $NON_EXISTANT_FS" + error "pool_list did not fail for a non-existant fsname $NON_EXISTANT_FS" - $LCMD pool_list ${FSNAME}.$NON_EXISTANT_POOL + $LCMD pool_list ${FSNAME}.$NON_EXISTANT_POOL 2>/dev/null [[ $? -ne 0 ]] || \ - error "pool_list did not fail for a non-existant pool $NON_EXISTANT_POOL" - - if [[ ! $(grep mds <<< $LCMD) ]]; then - echo $LCMD pool_list $DIR - $LCMD pool_list $DIR - [[ $? -eq 0 ]] || \ - error "pool_list failed for $DIR" - - mkdir -p ${DIR}/d1 - $LCMD pool_list ${DIR}/d1 - [[ $? -eq 0 ]] || \ - error "pool_list failed for ${DIR}/d1" + error "pool_list did not fail for a non-existant pool $NON_EXISTANT_POOL" + + if [[ ! $(grep $SINGLEMDS <<< $LCMD) ]]; then + echo $LCMD pool_list $DIR + $LCMD pool_list $DIR + [[ $? -eq 0 ]] || \ + error "pool_list failed for $DIR" + + mkdir -p ${DIR}/d1 + $LCMD pool_list ${DIR}/d1 + [[ $? -eq 0 ]] || \ + error "pool_list failed for ${DIR}/d1" fi rm -rf ${DIR}nonexistant - $LCMD pool_list ${DIR}nonexistant + $LCMD pool_list ${DIR}nonexistant 2>/dev/null [[ $? -ne 0 ]] || \ - error "pool_list did not fail for invalid mountpoint ${DIR}nonexistant" + error "pool_list did not fail for invalid mountpoint ${DIR}nonexistant" destroy_pool $POOL destroy_pool $POOL2 @@ -564,8 +561,8 @@ test_5() { sub_test_5 $LFS # Issue commands from MDS - sub_test_5 "do_facet mds lctl" - sub_test_5 "do_facet mds lfs" + sub_test_5 "do_facet $SINGLEMDS lctl" + sub_test_5 "do_facet $SINGLEMDS lfs" } run_test 5 "lfs/lctl pool_list" @@ -577,43 +574,43 @@ test_6() { create_pool_nofail $POOL - do_facet mds lctl pool_list $FSNAME + do_facet $SINGLEMDS lctl pool_list $FSNAME [[ $? -eq 0 ]] || \ - error "pool_list $FSNAME failed." + error "pool_list $FSNAME failed." - do_facet mds lctl pool_add $FSNAME.$POOL $TGT_ALL + add_pool $POOL $TGT_ALL "$TGT_UUID" mkdir -p $POOL_DIR $SETSTRIPE -c -1 -p $POOL $POOL_DIR [[ $? -eq 0 ]] || \ - error "$SETSTRIPE -p $POOL failed." + error "$SETSTRIPE -p $POOL failed." check_dir_in_pool $POOL_DIR $POOL # If an invalid pool name is specified, the command should fail - $SETSTRIPE -c 2 -p $INVALID_POOL $POOL_DIR + $SETSTRIPE -c 2 -p $INVALID_POOL $POOL_DIR 2>/dev/null [[ $? -ne 0 ]] || \ - error_ignore 19919 "setstripe to invalid pool did not fail." + error "setstripe to invalid pool did not fail." # If the pool name does not exist, the command should fail - $SETSTRIPE -c 2 -p $NON_EXISTANT_POOL $POOL_DIR + $SETSTRIPE -c 2 -p $NON_EXISTANT_POOL $POOL_DIR 2>/dev/null [[ $? -ne 0 ]] || \ - error_ignore 19919 "setstripe to non-existant pool did not fail." + error "setstripe to non-existant pool did not fail." # lfs setstripe should work as before if a pool name is not specified. $SETSTRIPE -c -1 $POOL_DIR [[ $? -eq 0 ]] || \ - error "$SETSTRIPE -p $POOL_DIR failed." + error "$SETSTRIPE -p $POOL_DIR failed." $SETSTRIPE -c -1 $POOL_FILE [[ $? -eq 0 ]] || \ - error "$SETSTRIPE -p $POOL_FILE failed." + error "$SETSTRIPE -p $POOL_FILE failed." # lfs setstripe should fail if a start index that is outside the # pool is specified. create_pool_nofail $POOL2 add_pool $POOL2 "OST0000" "$FSNAME-OST0000_UUID " - $SETSTRIPE -o 1 -p $POOL2 $ROOT_POOL/$tfile + $SETSTRIPE -o 1 -p $POOL2 $ROOT_POOL/$tfile 2>/dev/null [[ $? -ne 0 ]] || \ - error "$SETSTRIPE with start index outside the pool did not fail." + error "$SETSTRIPE with start index outside the pool did not fail." destroy_pool $POOL destroy_pool $POOL2 @@ -628,11 +625,11 @@ test_11() { create_pool_nofail $POOL create_pool_nofail $POOL2 - do_facet mds lctl pool_add $FSNAME.$POOL \ - $FSNAME-OST[$TGT_FIRST-$TGT_MAX/2] local start=$((TGT_FIRST+1)) - do_facet mds lctl pool_add $FSNAME.$POOL2 \ - $FSNAME-OST[$start-$TGT_MAX/2] + do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL2 \ + $FSNAME-OST[$start-$TGT_MAX/2] + + add_pool $POOL $TGT_HALF "$TGT_UUID2" create_dir $POOL_ROOT/dir1 $POOL create_dir $POOL_ROOT/dir2 $POOL2 @@ -641,16 +638,16 @@ test_11() { local numfiles=100 createmany -o $POOL_ROOT/dir1/$tfile $numfiles || \ - error "createmany $POOL_ROOT/dir1/$tfile failed!" + error "createmany $POOL_ROOT/dir1/$tfile failed!" for file in $POOL_ROOT/dir1/*; do - check_file_in_pool $file $POOL + check_file_in_pool $file $POOL done createmany -o $POOL_ROOT/dir2/$tfile $numfiles || \ - error "createmany $POOL_ROOT/dir2/$tfile failed!" + error "createmany $POOL_ROOT/dir2/$tfile failed!" for file in $POOL_ROOT/dir2/*; do - check_file_in_pool $file $POOL2 + check_file_in_pool $file $POOL2 done rm -rf $POOL_ROOT/dir? @@ -670,11 +667,11 @@ test_12() { create_pool_nofail $POOL create_pool_nofail $POOL2 - do_facet mds lctl pool_add $FSNAME.$POOL \ - $FSNAME-OST[$TGT_FIRST-$TGT_MAX/2] local start=$((TGT_FIRST+1)) - do_facet mds lctl pool_add $FSNAME.$POOL2 \ - $FSNAME-OST[$start-$TGT_MAX/2] + do_facet $SINGLEMDS lctl pool_add $FSNAME.$POOL2 \ + $FSNAME-OST[$start-$TGT_MAX/2] + + add_pool $POOL $TGT_HALF "$TGT_UUID2" echo creating some files in $POOL and $POOL2 @@ -690,10 +687,11 @@ test_12() { check_file_in_pool $POOL_ROOT/file2 $POOL2 echo Changing the pool membership - do_facet mds lctl pool_remove $FSNAME.$POOL $FSNAME-OST[$TGT_FIRST] - do_facet mds lctl pool_list $FSNAME.$POOL - do_facet mds lctl pool_add $FSNAME.$POOL2 $FSNAME-OST[$TGT_FIRST] - do_facet mds lctl pool_list $FSNAME.$POOL2 + do_facet $SINGLEMDS lctl pool_remove $FSNAME.$POOL $FSNAME-OST[$TGT_FIRST] + do_facet $SINGLEMDS lctl pool_list $FSNAME.$POOL + FIRST_UUID=$(echo $TGT_UUID | awk '{print $1}') + add_pool $POOL2 $FSNAME-OST[$TGT_FIRST] "$FIRST_UUID " + do_facet $SINGLEMDS lctl pool_list $FSNAME.$POOL2 echo Checking the files again check_dir_in_pool $POOL_ROOT/dir1 $POOL @@ -703,7 +701,7 @@ test_12() { echo Creating some more files create_dir $POOL_ROOT/dir3 $POOL - create_dir $POOL_ROOT/dir4 POOL2 + create_dir $POOL_ROOT/dir4 $POOL2 create_file $POOL_ROOT/file3 $POOL create_file $POOL_ROOT/file4 $POOL2 @@ -726,13 +724,13 @@ test_13() { local count=3 create_pool_nofail $POOL - do_facet mds lctl pool_add $FSNAME.$POOL $TGT_ALL + add_pool $POOL $TGT_ALL "$TGT_UUID" create_dir $POOL_ROOT/dir1 $POOL -1 createmany -o $POOL_ROOT/dir1/$tfile $numfiles || \ - error "createmany $POOL_ROOT/dir1/$tfile failed!" + error "createmany $POOL_ROOT/dir1/$tfile failed!" for file in $POOL_ROOT/dir1/*; do - check_file_in_pool $file $POOL $OSTCOUNT + check_file_in_pool $file $POOL $OSTCOUNT done create_file $POOL_ROOT/dir1/file1 $POOL 1 $TGT_FIRST @@ -747,31 +745,31 @@ test_13() { create_dir $POOL_ROOT/dir2 $POOL $count createmany -o $POOL_ROOT/dir2/$tfile $numfiles || \ - error "createmany $POOL_ROOT/dir2/$tfile failed!" + error "createmany $POOL_ROOT/dir2/$tfile failed!" for file in $POOL_ROOT/dir2/*; do - check_file_in_pool $file $POOL $count + check_file_in_pool $file $POOL $count done create_dir $POOL_ROOT/dir3 $POOL $count $((TGT_FIRST+1)) createmany -o $POOL_ROOT/dir3/$tfile_ $numfiles || \ - error "createmany $POOL_ROOT/dir3/$tfile_ failed!" + error "createmany $POOL_ROOT/dir3/$tfile_ failed!" for file in $POOL_ROOT/dir3/*; do - check_file_in_pool $file $POOL $count + check_file_in_pool $file $POOL $count done create_dir $POOL_ROOT/dir4 $POOL 1 createmany -o $POOL_ROOT/dir4/$tfile_ $numfiles || \ - error "createmany $POOL_ROOT/dir4/$tfile_ failed!" + error "createmany $POOL_ROOT/dir4/$tfile_ failed!" for file in $POOL_ROOT/dir4/*; do - check_file_in_pool $file $POOL 1 + check_file_in_pool $file $POOL 1 done create_dir $POOL_ROOT/dir5 $POOL 1 $((TGT_FIRST+2)) createmany -o $POOL_ROOT/dir5/$tfile_ $numfiles || \ - error "createmany $POOL_ROOT/dir5/$tfile_ failed!" + error "createmany $POOL_ROOT/dir5/$tfile_ failed!" for file in $POOL_ROOT/dir5/*; do - check_file_in_pool $file $POOL 1 - check_file_in_osts $file "$((TGT_FIRST+2))" + check_file_in_pool $file $POOL 1 + check_file_in_osts $file "$((TGT_FIRST+2))" done rm -rf create_dir $POOL_ROOT/dir? @@ -804,13 +802,13 @@ test_14() { i=0 while [[ $i -lt $numfiles ]]; do - OST=$((OST+2)) - [[ $OST -gt $TGT_MAX ]] && OST=$TGT_FIRST + OST=$((OST+2)) + [[ $OST -gt $TGT_MAX ]] && OST=$TGT_FIRST - # echo "Iteration: $i OST: $OST" - create_file $POOL_ROOT/dir1/file${i} $POOL 1 - check_file_in_osts $POOL_ROOT/dir1/file${i} $OST - i=$((i+1)) + # echo "Iteration: $i OST: $OST" + create_file $POOL_ROOT/dir1/file${i} $POOL 1 + check_file_in_osts $POOL_ROOT/dir1/file${i} $OST + i=$((i+1)) done # Fill OST $TGT_FIRST with 10M files @@ -832,9 +830,9 @@ test_14() { create_dir $POOL_ROOT/dir3 $POOL 1 create_file $POOL_ROOT/dir3/file $POOL 1 createmany -o $POOL_ROOT/dir3/$tfile_ $numfiles || \ - error "createmany $POOL_ROOT/dir3/$tfile_ failed!" + error "createmany $POOL_ROOT/dir3/$tfile_ failed!" for file in $POOL_ROOT/dir3/*; do - check_file_in_pool $file $POOL + check_file_in_pool $file $POOL done rm -rf $POOL_ROOT @@ -857,10 +855,10 @@ test_15() { add_pool pool${i} "$FSNAME-OST[$i]" "$tgt" create_dir $POOL_ROOT/dir${i} pool${i} createmany -o $POOL_ROOT/dir$i/$tfile $numfiles || \ - error "createmany $POOL_ROOT/dir$i/$tfile failed!" + error "createmany $POOL_ROOT/dir$i/$tfile failed!" for file in $POOL_ROOT/dir$i/*; do - check_file_in_osts $file $i + check_file_in_osts $file $i done i=$((i+1)) @@ -890,15 +888,15 @@ test_16() { create_dir $dir $POOL for i in $(seq 1 10); do - dir=${dir}/dir${i} + dir=${dir}/dir${i} done mkdir -p $dir createmany -o $dir/$tfile $numfiles || \ - error "createmany $dir/$tfile failed!" + error "createmany $dir/$tfile failed!" for file in $dir/*; do - check_file_in_pool $file $POOL + check_file_in_pool $file $POOL done rm -rf $POOL_ROOT/$tdir @@ -922,16 +920,16 @@ test_17() { create_dir $dir $POOL createmany -o $dir/${tfile}1_ $numfiles || \ - error "createmany $dir/${tfile}1_ failed!" + error "createmany $dir/${tfile}1_ failed!" for file in $dir/*; do - check_file_in_pool $file $POOL + check_file_in_pool $file $POOL done destroy_pool $POOL createmany -o $dir/${tfile}2_ $numfiles || \ - error "createmany $dir/${tfile}2_ failed!" + error "createmany $dir/${tfile}2_ failed!" rm -rf $dir return 0 @@ -994,9 +992,9 @@ test_18() { diff=$(echo "scale=2; ($time2 - $time3) * 100 / $time3" | bc) if [[ "$deg" == "1" ]]; then - error "Performance degradation with pools is $diff %." + error "Performance degradation with pools is $diff %." else - echo "Performance degradation with pools is $diff %." + echo "Performance degradation with pools is $diff %." fi return 0 } @@ -1016,16 +1014,16 @@ test_19() { create_dir $dir1 $POOL createmany -o $dir1/${tfile} $numfiles || \ - error "createmany $dir1/${tfile} failed!" + error "createmany $dir1/${tfile} failed!" for file in $dir1/*; do - check_file_in_pool $file $POOL + check_file_in_pool $file $POOL done mkdir -p $dir2 createmany -o $dir2/${tfile} $numfiles || \ - error "createmany $dir2/${tfile} failed!" + error "createmany $dir2/${tfile} failed!" for file in $dir2/*; do - check_file_not_in_pool $file $POOL + check_file_not_in_pool $file $POOL done rm -rf $dir1 $dir2 @@ -1051,7 +1049,7 @@ test_20() { local start=$((TGT_FIRST+1)) TGT=$(for i in `seq $start 2 $TGT_MAX`; \ - do printf "$FSNAME-OST%04x_UUID " $i; done) + do printf "$FSNAME-OST%04x_UUID " $i; done) add_pool $POOL2 "$FSNAME-OST[$start-$TGT_MAX/2]" "$TGT" create_dir $dir1 $POOL @@ -1115,31 +1113,38 @@ add_loop() { for c in $(seq 1 10); do - echo "Pool $pool, iteration $c" - create_pool_nofail $pool - local TGT=$(for i in `seq $TGT_FIRST $step $TGT_MAX`; \ - do printf "$FSNAME-OST%04x_UUID " $i; done) - add_pool $pool "$FSNAME-OST[$TGT_FIRST-$TGT_MAX/$step]" "$TGT" - destroy_pool $pool - do_facet mds lctl pool_list $FSNAME + echo "Pool $pool, iteration $c" + do_facet $SINGLEMDS lctl pool_add $FSNAME.$pool OST[$TGT_FIRST-$TGT_MAX/$step] 2>/dev/null + local TGT_SECOND=$(($TGT_FIRST+$step)) + if [ "$TGT_SECOND" -le "$TGT_MAX" ]; then + do_facet $SINGLEMDS lctl pool_remove $FSNAME.$pool OST[$TGT_SECOND-$TGT_MAX/$step] + fi done echo loop for $pool complete } test_22() { local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir} - [[ $OSTCOUNT -le 1 ]] && skip "Need atleast 2 OSTs" && return + [[ $OSTCOUNT -le 1 ]] && skip "Need at least 2 OSTs" && return local numfiles=100 + create_pool_nofail $POOL + add_pool $POOL "OST0000" "$FSNAME-OST0000_UUID " + create_pool_nofail $POOL2 + add_pool $POOL2 "OST0000" "$FSNAME-OST0000_UUID " + add_loop $POOL 1 & add_loop $POOL2 2 & sleep 5 create_dir $POOL_ROOT $POOL createmany -o $POOL_ROOT/${tfile} $numfiles || \ - error "createmany $POOL_ROOT/${tfile} failed!" + error "createmany $POOL_ROOT/${tfile} failed!" wait + destroy_pool $POOL + destroy_pool $POOL2 + return 0 } run_test 22 "Simultaneous manipulation of a pool" @@ -1150,40 +1155,49 @@ test_23() { mkdir -p $POOL_ROOT check_runas_id $TSTID $TSTID $RUNAS || { - skip "User $RUNAS_ID does not exist - skipping" - return 0 + skip "User $RUNAS_ID does not exist - skipping" + return 0 } - local numfiles=12 local i=0 local TGT - local LIMIT=1024 + local BLK_SZ=1024 + local BUNIT_SZ=1024 # min block quota unit(kB) + local LOVNAME=`lctl get_param -n llite.*.lov.common_name | tail -n 1` + local OSTCOUNT=`lctl get_param -n lov.$LOVNAME.numobd` + local LIMIT local dir=$POOL_ROOT/dir - local file1="$dir/$tfile-quota1" - local file2="$dir/$tfile-quota2" + local file="$dir/$tfile-quota" create_pool_nofail $POOL local TGT=$(for i in `seq $TGT_FIRST 3 $TGT_MAX`; \ - do printf "$FSNAME-OST%04x_UUID " $i; done) + do printf "$FSNAME-OST%04x_UUID " $i; done) add_pool $POOL "$FSNAME-OST[$TGT_FIRST-$TGT_MAX/3]" "$TGT" create_dir $dir $POOL $LFS quotaoff -ug $MOUNT $LFS quotacheck -ug $MOUNT - $LFS setquota -u $TSTUSR -b $LIMIT -B $LIMIT $dir #-i 5 -I 5 $dir - - $LFS setstripe $file1 -c 1 -p $POOL - chown $TSTUSR.$TSTUSR $file1 - ls -l $file1 + LIMIT=$((BUNIT_SZ * (OSTCOUNT + 1))) + $LFS setquota -u $TSTUSR -b $LIMIT -B $LIMIT $dir + sleep 3 + $LFS quota -v -u $TSTUSR $dir + + $LFS setstripe $file -c 1 -p $POOL + chown $TSTUSR.$TSTUSR $file + ls -l $file type runas - stat=$(LC_ALL=C $RUNAS dd if=/dev/zero of=$file1 bs=1024 count=$((LIMIT*2)) 2>&1) + LOCALE=C $RUNAS dd if=/dev/zero of=$file bs=$BLK_SZ count=$((BUNIT_SZ*2)) || true + $LFS quota -v -u $TSTUSR $dir + cancel_lru_locks osc + stat=$(LOCALE=C $RUNAS dd if=/dev/zero of=$file bs=$BLK_SZ count=$BUNIT_SZ seek=$((BUNIT_SZ*2)) 2>&1) RC=$? echo $stat [[ $RC -eq 0 ]] && error "dd did not fail with EDQUOT." - echo $stat | grep "Disk quota exceeded" + echo $stat | grep "Disk quota exceeded" > /dev/null [[ $? -eq 1 ]] && error "dd did not fail with EDQUOT." + $LFS quota -v -u $TSTUSR $dir echo "second run" $LFS quotaoff -ug $MOUNT @@ -1194,17 +1208,17 @@ test_23() { while [ $RC -eq 0 ]; do i=$((i+1)) - stat=$(LOCALE=C $RUNAS2 dd if=/dev/zero of=${file2}$i bs=1024 \ - count=$((LIMIT*LIMIT)) 2>&1) + stat=$(LOCALE=C $RUNAS2 dd if=/dev/zero of=${file}$i bs=1M \ + count=$((LIMIT*LIMIT)) 2>&1) RC=$? if [ $RC -eq 1 ]; then - echo $stat - echo $stat | grep "Disk quota exceeded" - [[ $? -eq 0 ]] && error "dd failed with EDQUOT" + echo $stat + echo $stat | grep "Disk quota exceeded" + [[ $? -eq 0 ]] && error "dd failed with EDQUOT" - echo $stat | grep "No space left on device" - [[ $? -ne 0 ]] && error "dd did not fail with ENOSPC; " \ - "failed with $stat" + echo $stat | grep "No space left on device" + [[ $? -ne 0 ]] && error "dd did not fail with ENOSPC; " \ + "failed with $stat" fi done @@ -1236,11 +1250,11 @@ test_24() { mkdir $POOL_ROOT/dir2 $SETSTRIPE $POOL_ROOT/dir2 -p $POOL -s 65536 -i 0 -c 1 || \ - error "$SETSTRIPE $POOL_ROOT/dir2 failed" + error "$SETSTRIPE $POOL_ROOT/dir2 failed" mkdir $POOL_ROOT/dir3 $SETSTRIPE $POOL_ROOT/dir3 -s 65536 -i 0 -c 1 || \ - error "$SETSTRIPE $POOL_ROOT/dir3 failed" + error "$SETSTRIPE $POOL_ROOT/dir3 failed" mkdir $POOL_ROOT/dir4 @@ -1256,37 +1270,37 @@ test_24() { local size1 createmany -o $dir/${tfile} $numfiles || \ - error "createmany $dir/${tfile} failed!" + error "createmany $dir/${tfile} failed!" res=$($GETSTRIPE -v $dir | grep "^stripe_count:") if [ $? -ne 0 ]; then - res=$($GETSTRIPE -v $dir | grep "^(Default) ") - pool=$(cut -f 9 -d ' ' <<< $res) - index=$(cut -f 7 -d ' ' <<< $res) - size=$(cut -f 5 -d ' ' <<< $res) - count=$(cut -f 3 -d ' ' <<< $res) + res=$($GETSTRIPE -v $dir | grep "^(Default) ") + pool=$(cut -f 9 -d ' ' <<< $res) + index=$(cut -f 7 -d ' ' <<< $res) + size=$(cut -f 5 -d ' ' <<< $res) + count=$(cut -f 3 -d ' ' <<< $res) else - pool=$(cut -f 8 -d ' ' <<< $res) - index=$(cut -f 6 -d ' ' <<< $res) - size=$(cut -f 4 -d ' ' <<< $res) - count=$(cut -f 2 -d ' ' <<< $res) + pool=$(cut -f 8 -d ' ' <<< $res) + index=$(cut -f 6 -d ' ' <<< $res) + size=$(cut -f 4 -d ' ' <<< $res) + count=$(cut -f 2 -d ' ' <<< $res) fi for file in $dir/*; do - if [ "$pool" != "" ]; then - check_file_in_pool $file $pool - fi - pool1=$($GETSTRIPE -v $file | grep "^pool:" |\ - tr -d '[:blank:]' | cut -f 2 -d ':') - count1=$($GETSTRIPE -v $file | grep "^lmm_stripe_count:" |\ - tr -d '[:blank:]' | cut -f 2 -d ':') - size1=$($GETSTRIPE -v $file | grep "^lmm_stripe_size:" |\ - tr -d '[:blank:]' | cut -f 2 -d ':') - [[ "$pool" != "$pool1" ]] && \ - error "Pool name ($pool) not inherited in $file($pool1)" - [[ "$count" != "$count1" ]] && \ - error "Stripe count ($count) not inherited in $file ($count1)" - [[ "$size" != "$size1" ]] && [[ "$size" != "0" ]] && \ - error "Stripe size ($size) not inherited in $file ($size1)" + if [ "$pool" != "" ]; then + check_file_in_pool $file $pool + fi + pool1=$($GETSTRIPE -v $file | grep "^pool:" |\ + tr -d '[:blank:]' | cut -f 2 -d ':') + count1=$($GETSTRIPE -v $file | grep "^lmm_stripe_count:" |\ + tr -d '[:blank:]' | cut -f 2 -d ':') + size1=$($GETSTRIPE -v $file | grep "^lmm_stripe_size:" |\ + tr -d '[:blank:]' | cut -f 2 -d ':') + [[ "$pool" != "$pool1" ]] && \ + error "Pool name ($pool) not inherited in $file($pool1)" + [[ "$count" != "$count1" ]] && \ + error "Stripe count ($count) not inherited in $file ($count1)" + [[ "$size" != "$size1" ]] && [[ "$size" != "0" ]] && \ + error "Stripe size ($size) not inherited in $file ($size1)" done done @@ -1297,6 +1311,33 @@ test_24() { } run_test 24 "Independence of pool from other setstripe parameters" +test_25() { + local dev=$(mdsdevname ${SINGLEMDS//mds/}) + local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir} + + mkdir -p $POOL_ROOT + + for i in $(seq 10); do + create_pool_nofail pool$i + do_facet $SINGLEMDS lctl pool_add $FSNAME.pool$i OST0000 + stop $SINGLEMDS || return 1 + start $SINGLEMDS ${dev} $MDS_MOUNT_OPTS || \ + { error "Failed to start $SINGLEMDS after stopping" && break; } + client_df + + # Veriy that the pool got created and is usable + echo "Creating a file in pool$i" + create_file $POOL_ROOT/file$i pool$i || break + check_file_in_pool $POOL_ROOT/file$i pool$i || break + done + + rm -rf $POOL_ROOT + for i in $(seq 10); do + destroy_pool pool$i + done +} +run_test 25 "Create new pool and restart MDS =======================" + log "cleanup: ======================================================" cd $ORIG_PWD cleanup_tests