Whamcloud - gitweb
b=20863
authorgrev <grev>
Wed, 21 Oct 2009 09:30:46 +0000 (09:30 +0000)
committergrev <grev>
Wed, 21 Oct 2009 09:30:46 +0000 (09:30 +0000)
i=Brian
sanity test_200* cleanup

lustre/tests/ost-pools.sh
lustre/tests/sanity.sh
lustre/tests/test-framework.sh

index a07f247..84371a6 100644 (file)
@@ -187,30 +187,6 @@ drain_pool() {
         ||error "Failed to remove targets from pool: $pool"
 }
 
-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
-}
-
 add_pool() {
     local pool=$1
     local osts=$2
index 09cff2f..b834772 100644 (file)
@@ -6261,9 +6261,20 @@ check_file_in_pool()
 
 export mdtlov=
 
+cleanup_200 () {
+        trap 0
+        test_pools || return 0
+        destroy_pool $POOL
+}
+
 test_200a() {
         test_pools || return 0
+
         do_facet mgs $LCTL pool_new $FSNAME.$POOL
+
+        trap cleanup_200 EXIT
+        CLEANUP_200=yes
+
         # get param should return err until pool is created
         wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null || echo foo" "" || error "Pool creation of $POOL failed"
 }
@@ -6359,11 +6370,14 @@ test_201c() {   # was 200i
         test_pools || return 0
         do_facet mgs $LCTL pool_destroy $FSNAME.$POOL
         # get param should return err once pool is gone
-        wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null || echo foo" "foo" && return 0
+        wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$POOL 2>/dev/null || 
+                echo foo" "foo" && unset CLEANUP_200 && trap 0 && return 0
         error "Pool $FSNAME.$POOL is not destroyed"
 }
 run_test 201c "Remove a pool ============================================"
 
+[ "$CLEANUP_200" ] && cleanup_200
+
 test_202() {
         $LFS setstripe -c 2 -s 1048576 $DIR/$tfile
         multiop $DIR/$tfile oO_WRONLY:O_APPEND:O_DIRECT:b1048548b130c || \
index a51bece..487dd41 100644 (file)
@@ -2739,6 +2739,30 @@ wait_clients_import_state () {
     fi
 }
 
+destroy_pool_int() {
+    local ost
+    local OSTS=$(do_facet mds 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
+}
+
+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
+}
+
 gather_logs () {
     local list=$1