From f44fe5abbc74ca79790c100a30193ded1ef1e6c9 Mon Sep 17 00:00:00 2001 From: Jadhav Vikram Date: Mon, 19 Dec 2016 18:52:46 +0530 Subject: [PATCH] LU-8788 tests: modify create_pool to use as wrapper Changed the required places which directly call lctl pool_new command to use create_pool() wrapper. Seagate-bug-id: MRP-2683 Signed-off-by: Jadhav Vikram Change-Id: I83a867072ae289f820036338249182a3112e7fba Reviewed-on: http://es-gerrit.xyus.xyratex.com:8080/11162 Reviewed-by: Vladimir Saveliev Reviewed-by: Rahul Deshmukh Tested-by: Elena V. Gryaznova Reviewed-on: https://review.whamcloud.com/23541 Reviewed-by: Fan Yong Reviewed-by: Andreas Dilger Tested-by: Jenkins Tested-by: Maloo --- lustre/tests/ost-pools.sh | 43 +++++++++++++++++++++---------------------- lustre/tests/replay-single.sh | 2 +- lustre/tests/sanity.sh | 5 ++--- 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/lustre/tests/ost-pools.sh b/lustre/tests/ost-pools.sh index 4207f77..b3c205d 100755 --- a/lustre/tests/ost-pools.sh +++ b/lustre/tests/ost-pools.sh @@ -194,17 +194,16 @@ add_pool() { } create_pool_nofail() { - create_pool $FSNAME.$1 - if [[ $? != 0 ]]; then - error "Pool creation of $1 failed" - fi + create_pool $FSNAME.$1 + [[ $? -ne 0 ]] && error "Pool creation of $1 failed" + return 0 } create_pool_fail() { - create_pool $FSNAME.$1 - if [[ $? == 0 ]]; then - error "Pool creation of $1 succeeded; should have failed" - fi + create_pool $FSNAME.$1 + [[ $? -ne 0 ]] || + error "Pool creation of $1 succeeded; should have failed" + return 0 } cleanup_tests() { @@ -267,7 +266,7 @@ run_test 1e "Create a pool with a 1000 char pool name; should fail" test_1f() { set_cleanup_trap - do_facet mgs lctl pool_new .$POOL 2>/dev/null + create_pool .$POOL [[ $? -ne 0 ]] || error "pool_new did not fail even though fs-name was missing" } @@ -275,7 +274,7 @@ run_test 1f "pool_new should fail if fs-name is missing" test_1g() { set_cleanup_trap - do_facet mgs lctl pool_new $POOL 2>/dev/null + create_pool $POOL [[ $? -ne 0 ]] || error "pool_new did not fail even though fs-name was missing" } @@ -283,7 +282,7 @@ run_test 1g "pool_new should fail if fs-name is missing" test_1h() { set_cleanup_trap - do_facet mgs lctl pool_new ${FSNAME}. 2>/dev/null + create_pool ${FSNAME}. [[ $? -ne 0 ]] || error "pool_new did not fail even though pool name was missing" } @@ -291,32 +290,32 @@ run_test 1h "pool_new should fail if poolname is missing" test_1i() { set_cleanup_trap - do_facet mgs lctl pool_new . 2>/dev/null + create_pool . [[ $? -ne 0 ]] || - error "pool_new did not fail even if pool and fs-name were missing" + error "pool_new did not fail even if pool/fs-name was missing" } run_test 1i "pool_new should fail if poolname and fs-name are missing" test_1j() { set_cleanup_trap - do_facet mgs lctl pool_new ${FSNAME},$POOL 2>/dev/null + create_pool ${FSNAME},$POOL [[ $? -ne 0 ]] || - error "pool_new did not fail even though pool name format was wrong" + error "pool_new did not fail even if poolname format was wrong" } run_test 1j "pool_new should fail if poolname format is wrong" test_1k() { set_cleanup_trap - do_facet mgs lctl pool_new ${FSNAME}/$POOL 2>/dev/null + create_pool ${FSNAME}/$POOL [[ $? -ne 0 ]] || - error "pool_new did not fail even though pool name format was wrong" + error "pool_new did not fail even if poolname format was wrong" } run_test 1k "pool_new should fail if poolname format is wrong" test_1m() { set_cleanup_trap create_pool_nofail $POOL2 - do_facet mgs lctl pool_new ${FSNAME}.$POOL2 2>/dev/null + create_pool ${FSNAME}.$POOL2 [[ $? -ne 0 ]] || error "pool_new did not fail even though $POOL2 existed" destroy_pool $POOL2 @@ -704,19 +703,19 @@ run_test 7a "create various pool name" test_7b() { # No fsname - do_facet mgs lctl pool_new qwerty + create_pool qwerty [ $? -ne 22 ] && error "can create a pool with no fsname" # No pool name - do_facet mgs lctl pool_new $FSNAME. + create_pool $FSNAME. [ $? -ne 22 ] && error "can create a pool with no name" # Invalid character - do_facet mgs lctl pool_new $FSNAME.0123456789^bdef + create_pool $FSNAME.0123456789^bdef [ $? -ne 22 ] && error "can create a pool with an invalid name" # Too long - do_facet mgs lctl pool_new $FSNAME.0123456789abdefg + create_pool $FSNAME.0123456789abdefg [ $? -ne 36 ] && error "can create a pool with a name too long" return 0 diff --git a/lustre/tests/replay-single.sh b/lustre/tests/replay-single.sh index 96fc10a..b8b7731 100755 --- a/lustre/tests/replay-single.sh +++ b/lustre/tests/replay-single.sh @@ -3074,7 +3074,7 @@ run_test 85a "check the cancellation of unused locks during recovery(IBITS)" test_85b() { #bug 16774 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1" - do_facet mgs $LCTL pool_new $FSNAME.$TESTNAME || + create_pool $FSNAME.$TESTNAME || error "unable to create pool $TESTNAME" do_facet mgs $LCTL pool_add $FSNAME.$TESTNAME $FSNAME-OST0000 || error "unable to add pool $TESTNAME" diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index b389e68..933c416 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -12573,7 +12573,7 @@ test_220() { #LU-325 do_facet ost$((OSTIDX + 1)) lctl set_param fail_val=-1 #define OBD_FAIL_OST_ENOINO 0x229 do_facet ost$((OSTIDX + 1)) lctl set_param fail_loc=0x229 - do_facet mgs $LCTL pool_new $FSNAME.$TESTNAME || return 1 + create_pool $FSNAME.$TESTNAME || return 1 do_facet mgs $LCTL pool_add $FSNAME.$TESTNAME $OST || return 2 $SETSTRIPE $DIR/$tdir -i $OSTIDX -c 1 -p $FSNAME.$TESTNAME @@ -14122,8 +14122,7 @@ test_253() { osp.$mdtosc_proc1.reserved_mb_low) echo "prev high watermark $last_wm_h, prev low watermark $last_wm_l" - do_facet mgs $LCTL pool_new $FSNAME.$TESTNAME || - error "Pool creation failed" + create_pool $FSNAME.$TESTNAME || error "Pool creation failed" do_facet mgs $LCTL pool_add $FSNAME.$TESTNAME $ost_name || error "Adding $ost_name to pool failed" -- 1.8.3.1