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 <jadhav.vikram@seagate.com>
Change-Id: If5e9e6a7303059ab79e14967d2ea86b6d61c8aba
Reviewed-on: http://es-gerrit.xyus.xyratex.com:8080/11895
Reviewed-by: Vladimir Saveliev <vladimir.saveliev@seagate.com>
Reviewed-by: Rahul Deshmukh <rahul.deshmukh@seagate.com>
Tested-by: Elena V. Gryaznova <elena.gryaznova@seagate.com>
Reviewed-on: https://review.whamcloud.com/23046
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Reviewed-by: Fan Yong <fan.yong@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
wait_update $HOSTNAME "$LCTL get_param -n lov.$FSNAME-*.pools.$TESTNAME|
sort -u | tr '\n' ' ' " "$ost_targets_uuid" ||
error "wait_update $ost_pool failed"
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 <pool_name>] is set with [--ost-list|-o <ost_indices>],
# then the OSTs must be the members of the pool.
# If [--pool|-p <pool_name>] is set with [--ost-list|-o <ost_indices>],
# then the OSTs must be the members of the pool.
osts_in_pool() {
local pool=$1
local res
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)"
cleanup_tests() {
# Destroy pools from previous test runs
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}
destroy_pool_int $p;
done
rm -rf $DIR/d0.${TESTSUITE}
-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
- 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
}
# <fsname>.<poolname> or <poolname>
}
# <fsname>.<poolname> or <poolname>
- pool_list $fsname.$poolname || return $?
+ check_pool_not_exist $fsname.$poolname
+ [[ $? -eq 0 ]] && return 0
destroy_pool_int $fsname.$poolname
RC=$?
destroy_pool_int $fsname.$poolname
RC=$?
2>/dev/null || echo foo" "foo" || error "destroy pool failed $1"
remove_pool_from_list $fsname.$poolname
2>/dev/null || echo foo" "foo" || error "destroy pool failed $1"
remove_pool_from_list $fsname.$poolname
local poolname
local listvar=${fsname}_CREATED_POOLS
local poolname
local listvar=${fsname}_CREATED_POOLS
[ x${!listvar} = x ] && return 0
echo destroy the created pools: ${!listvar}
[ x${!listvar} = x ] && return 0
echo destroy the created pools: ${!listvar}