From b29b9fb4fd69928331d7374ec85b0b8fc3642a50 Mon Sep 17 00:00:00 2001 From: Jadhav Vikram Date: Mon, 19 Dec 2016 18:06:36 +0530 Subject: [PATCH] LU-8687 tests: list pool on mds when mgs is separate In case of separate MGS and MDS setup list pool on MGS will show nothing, so listing pool from MDS instead of MGS. Test-Parameters: testlist=conf-sanity,ost-pools Seagate-bug-id: MRP-3327 Signed-off-by: Jadhav Vikram Change-Id: If5e9e6a7303059ab79e14967d2ea86b6d61c8aba Reviewed-on: http://es-gerrit.xyus.xyratex.com:8080/11895 Reviewed-by: Vladimir Saveliev Reviewed-by: Rahul Deshmukh Tested-by: Elena V. Gryaznova Reviewed-on: https://review.whamcloud.com/23046 Reviewed-by: Andreas Dilger Tested-by: Jenkins Reviewed-by: Fan Yong Tested-by: Maloo --- lustre/tests/conf-sanity.sh | 3 ++- lustre/tests/ost-pools.sh | 8 ++++---- lustre/tests/test-framework.sh | 32 ++++++++++++++++++++------------ 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index afad80b..19eabf5 100755 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -5839,7 +5839,8 @@ test_82b() { # LU-4665 wait_update $HOSTNAME "$LCTL get_param -n lov.$FSNAME-*.pools.$TESTNAME| sort -u | tr '\n' ' ' " "$ost_targets_uuid" || error "wait_update $ost_pool failed" - pool_list $ost_pool || error "list OST pool $ost_pool failed" + [[ -z $(list_pool $ost_pool) ]] && + error "list OST pool $ost_pool failed" # If [--pool|-p ] is set with [--ost-list|-o ], # then the OSTs must be the members of the pool. diff --git a/lustre/tests/ost-pools.sh b/lustre/tests/ost-pools.sh index 23f610b..4207f77 100755 --- a/lustre/tests/ost-pools.sh +++ b/lustre/tests/ost-pools.sh @@ -88,9 +88,9 @@ create_file() { osts_in_pool() { local pool=$1 local res - for i in $(do_facet mgs lctl pool_list $FSNAME.$pool | - grep -v "^Pool:" | sed -e 's/_UUID$//;s/^.*-OST//'); do - res="$res $(printf "%d" 0x$i)" + for i in $(list_pool $FSNAME.$pool | + sed -e 's/_UUID$//;s/^.*-OST//'); do + res="$res $(printf "%d" 0x$i)" done echo $res } @@ -209,7 +209,7 @@ create_pool_fail() { cleanup_tests() { # Destroy pools from previous test runs - for p in $(do_facet mgs lctl pool_list $FSNAME | grep $POOL); do + for p in $(list_pool $FSNAME | grep $POOL); do destroy_pool_int $p; done rm -rf $DIR/d0.${TESTSUITE} diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index ba550af..ffc5253 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -6205,8 +6205,17 @@ oos_full() { return $OSCFULL } -pool_list () { - do_facet mgs lctl pool_list $1 +list_pool() { + echo -e "$(do_facet $SINGLEMDS $LCTL pool_list $1 | sed '1d')" +} + +check_pool_not_exist() { + local fsname=${1%%.*} + local poolname=${1##$fsname.} + [[ $# -ne 1 ]] && return 0 + [[ x$poolname = x ]] && return 0 + list_pool $fsname | grep -w $1 && return 1 + return 0 } create_pool() { @@ -6252,13 +6261,12 @@ remove_pool_from_list () { } destroy_pool_int() { - local ost - local OSTS=$(do_facet $SINGLEMDS lctl pool_list $1 | \ - awk '$1 !~ /^Pool:/ {print $1}') - for ost in $OSTS; do - do_facet mgs lctl pool_remove $1 $ost - done - do_facet mgs lctl pool_destroy $1 + local ost + local OSTS=$(list_pool $1) + for ost in $OSTS; do + do_facet mgs lctl pool_remove $1 $ost + done + do_facet mgs lctl pool_destroy $1 } # . or @@ -6270,7 +6278,8 @@ destroy_pool() { local RC - pool_list $fsname.$poolname || return $? + check_pool_not_exist $fsname.$poolname + [[ $? -eq 0 ]] && return 0 destroy_pool_int $fsname.$poolname RC=$? @@ -6287,6 +6296,7 @@ destroy_pool() { 2>/dev/null || echo foo" "foo" || error "destroy pool failed $1" remove_pool_from_list $fsname.$poolname + return $RC } @@ -6295,8 +6305,6 @@ destroy_pools () { local poolname local listvar=${fsname}_CREATED_POOLS - pool_list $fsname - [ x${!listvar} = x ] && return 0 echo destroy the created pools: ${!listvar} -- 1.8.3.1