Whamcloud - gitweb
LU-8687 tests: list pool on mds when mgs is separate 46/23046/12
authorJadhav Vikram <jadhav.vikram@seagate.com>
Mon, 19 Dec 2016 12:36:36 +0000 (18:06 +0530)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 31 Jan 2017 04:08:12 +0000 (04:08 +0000)
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>
lustre/tests/conf-sanity.sh
lustre/tests/ost-pools.sh
lustre/tests/test-framework.sh

index afad80b..19eabf5 100755 (executable)
@@ -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"
        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.
index 23f610b..4207f77 100755 (executable)
@@ -88,9 +88,9 @@ create_file() {
 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)"
        done
        echo $res
 }
        done
        echo $res
 }
@@ -209,7 +209,7 @@ create_pool_fail() {
 
 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}
index ba550af..ffc5253 100755 (executable)
@@ -6205,8 +6205,17 @@ oos_full() {
        return $OSCFULL
 }
 
        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() {
 }
 
 create_pool() {
@@ -6252,13 +6261,12 @@ remove_pool_from_list () {
 }
 
 destroy_pool_int() {
 }
 
 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
 }
 
 # <fsname>.<poolname> or <poolname>
 }
 
 # <fsname>.<poolname> or <poolname>
@@ -6270,7 +6278,8 @@ destroy_pool() {
 
        local RC
 
 
        local RC
 
-       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=$?
@@ -6287,6 +6296,7 @@ destroy_pool() {
                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
+
        return $RC
 }
 
        return $RC
 }
 
@@ -6295,8 +6305,6 @@ destroy_pools () {
     local poolname
     local listvar=${fsname}_CREATED_POOLS
 
     local poolname
     local listvar=${fsname}_CREATED_POOLS
 
-    pool_list $fsname
-
     [ x${!listvar} = x ] && return 0
 
     echo destroy the created pools: ${!listvar}
     [ x${!listvar} = x ] && return 0
 
     echo destroy the created pools: ${!listvar}