Whamcloud - gitweb
LU-8995 tests: set debug size correctly
[fs/lustre-release.git] / lustre / tests / test-framework.sh
index f3eb748..a90beae 100755 (executable)
@@ -17,10 +17,6 @@ export QUOTA_AUTO=1
 # specify environment variable containing batch job name for server statistics
 export JOBID_VAR=${JOBID_VAR:-"procname_uid"}  # or "existing" or "disable"
 
-# LOAD_LLOOP: LU-409: only load llite_lloop module if kernel < 2.6.32 or
-#             LOAD_LLOOP is true. LOAD_LLOOP is false by default.
-export LOAD_LLOOP=${LOAD_LLOOP:-false}
-
 #export PDSH="pdsh -S -Rssh -w"
 export MOUNT_CMD=${MOUNT_CMD:-"mount -t lustre"}
 export UMOUNT=${UMOUNT:-"umount -d"}
@@ -496,20 +492,6 @@ load_module() {
        fi
 }
 
-llite_lloop_enabled() {
-    local n1=$(uname -r | cut -d. -f1)
-    local n2=$(uname -r | cut -d. -f2)
-    local n3=$(uname -r | cut -d- -f1 | cut -d. -f3)
-
-    # load the llite_lloop module for < 2.6.32 kernels
-    if [[ $n1 -lt 2 ]] || [[ $n1 -eq 2 && $n2 -lt 6 ]] || \
-       [[ $n1 -eq 2 && $n2 -eq 6 && $n3 -lt 32 ]] || \
-        $LOAD_LLOOP; then
-        return 0
-    fi
-    return 1
-}
-
 load_modules_local() {
        if [ -n "$MODPROBE" ]; then
                # use modprobe
@@ -548,10 +530,12 @@ load_modules_local() {
        fi
 
        load_module ../libcfs/libcfs/libcfs
+       # Prevent local MODOPTS_LIBCFS being passed as part of environment
+       # variable to remote nodes
+       unset MODOPTS_LIBCFS
 
-    [ "$PTLDEBUG" ] && lctl set_param debug="$PTLDEBUG"
-    [ "$SUBSYSTEM" ] && lctl set_param subsystem_debug="${SUBSYSTEM# }"
-    load_module ../lnet/lnet/lnet
+       set_default_debug
+       load_module ../lnet/lnet/lnet
        case $NETTYPE in
        o2ib)
                LNETLND="o2iblnd/ko2iblnd"
@@ -604,7 +588,6 @@ load_modules_local() {
        fi
 
        load_module llite/lustre
-       llite_lloop_enabled && load_module llite/llite_lloop
        [ -d /r ] && OGDB=${OGDB:-"/r/tmp"}
        OGDB=${OGDB:-$TMP}
        rm -f $OGDB/ogdb-$HOSTNAME
@@ -2184,6 +2167,15 @@ sync_all_data() {
                grep -v 'Found no match'
 }
 
+wait_zfs_commit() {
+       # the occupied disk space will be released
+       # only after DMUs are committed
+       if [[ $(facet_fstype $1) == zfs ]]; then
+               echo "sleep $2 for ZFS OSD"
+               sleep $2
+       fi
+}
+
 wait_delete_completed_mds() {
        local MAX_WAIT=${1:-20}
        # for ZFS, waiting more time for DMUs to be committed
@@ -2204,6 +2196,7 @@ wait_delete_completed_mds() {
                mds2sync="$mds2sync $node"
        done
        if [ -z "$mds2sync" ]; then
+               wait_zfs_commit $SINGLEMDS $ZFS_WAIT
                return
        fi
        mds2sync=$(comma_list $mds2sync)
@@ -2221,16 +2214,7 @@ wait_delete_completed_mds() {
                        "$LCTL get_param -n osc.*MDT*.sync_*" | calc_sum)
                #echo "$node: $changes changes on all"
                if [[ $changes -eq 0 ]]; then
-                       etime=$(date +%s)
-                       #echo "delete took $((etime - stime)) seconds"
-
-                       # the occupied disk space will be released
-                       # only after DMUs are committed
-                       if [[ $(facet_fstype $SINGLEMDS) == zfs ]]; then
-                               echo "sleep $ZFS_WAIT for ZFS OSD"
-                               sleep $ZFS_WAIT
-                       fi
-
+                       wait_zfs_commit $SINGLEMDS $ZFS_WAIT
                        return
                fi
                sleep 1
@@ -6220,8 +6204,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() {
@@ -6267,13 +6260,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
 }
 
 # <fsname>.<poolname> or <poolname>
@@ -6285,7 +6277,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=$?
@@ -6302,6 +6295,7 @@ destroy_pool() {
                2>/dev/null || echo foo" "foo" || error "destroy pool failed $1"
 
        remove_pool_from_list $fsname.$poolname
+
        return $RC
 }
 
@@ -6310,8 +6304,6 @@ destroy_pools () {
     local poolname
     local listvar=${fsname}_CREATED_POOLS
 
-    pool_list $fsname
-
     [ x${!listvar} = x ] && return 0
 
     echo destroy the created pools: ${!listvar}