Whamcloud - gitweb
LU-3665 tests: Cleanup echo client after obdfilter-survey
[fs/lustre-release.git] / lustre / tests / obdfilter-survey.sh
index d78f7b4..9a96e56 100644 (file)
@@ -33,28 +33,28 @@ if [ $(( size * 1024 )) -ge $minsize  ]; then
     echo min kbytesavail: $minsize using size=${size} MBytes per obd instance
 fi
 
-get_devs() {
-        echo $(do_nodes $1 'lctl dl | grep obdfilter' | \
-             awk '{print $4}' | sort -u)
-}
-
 get_targets () {
-        local targets
-        local devs
-        local nid
-        local oss
-
-        for oss in $(osts_nodes); do
-                devs=$(get_devs $oss)
-                nid=$(host_nids_address $oss $NETTYPE)
-                for d in $devs; do
-                        # if oss is local -- obdfilter-survey needs dev wo/ host
-                        target=$d
-                        [[ $oss = `hostname` && "$1" == "netdisk" ]] || target=$nid:$target
-                        targets="$targets $target"
-                done
-        done
-
+       local targets
+       local target
+       local dev
+       local nid
+       local osc
+
+       for osc in $($LCTL get_param -N osc.${FSNAME}-*osc-*); do
+               nid=$($LCTL get_param $osc.import |
+                       awk '/current_connection:/ {sub(/@.*/,""); print $2}')
+               dev=$(echo $osc | sed -e 's/^osc\.//' -e 's/-osc.*//')
+               target=$dev
+
+               # For local disk obdfilter-survey requires target devs w/o nid.
+               # obdfilter-survey :
+               # case 1 (local disk):
+               #    $ nobjhi=2 thrhi=2 size=1024
+               #         targets="lustre-OST0000 lustre-OST0001 ..."
+               #                 sh obdfilter-survey
+               local_node && [ "$1" == "disk" ] || target=$nid:$target
+               targets="$targets $target"
+       done
        echo $targets
 }
 
@@ -80,8 +80,10 @@ obdflter_survey_run () {
        local cmd="NETTYPE=$NETTYPE thrlo=$thrlo nobjhi=$nobjhi thrhi=$thrhi size=$size case=$case rslt_loc=${TMP} targets=\"$targets\" $OBDSURVEY"
        echo + $cmd
        eval $cmd
+       local rc=$?
 
        cat ${TMP}/obdfilter_survey*
+       [ $rc = 0 ] || error "$OBDSURVEY failed: $rc"
 }
 test_1a () {
        obdflter_survey_run disk
@@ -94,7 +96,7 @@ print_jbd () {
        local varsvc=${facet}_svc
        local dev=$(ldiskfs_canon "*.${!varsvc}.mntdev" $facet)
 
-       # ext4: /proc/fs/jbd2/sda1:8/history 
+       # ext4: /proc/fs/jbd2/sda1:8/history
        # ext3: /proc/fs/jbd/sdb1/history
 
        do_facet $facet cat /proc/fs/jbd*/${dev}*/$file
@@ -110,7 +112,7 @@ check_jbd_values () {
        # $8: hndls >= thrhi * 2
        # display history of rtime/4 before, in case obd cleanup consumes time
        local tlines=$((rtime / 5 / 4 + 1))
-       local hist=("$(print_jbd history $facet | tail -$tlines | head -1)")
+       local hist=("$(print_jbd history $facet | tail -$tlines | head -n1)")
        echo "$hist"
        local run=($(echo "${hist[*]}" | awk '{print $4}'))
        local hndls=($(echo "${hist[*]}" | awk '{print $8}'))
@@ -140,10 +142,12 @@ check_jbd_values_facets () {
 test_1b () {
        local param_file=$TMP/$tfile-params
 
-       do_nodesv $(comma_list $(osts_nodes)) lctl get_param obdfilter.${FSNAME}-*.sync_journal
-
-       save_lustre_params $(comma_list $(osts_nodes)) "obdfilter.${FSNAME}-*.sync_journal" >$param_file
-       do_nodesv $(comma_list $(osts_nodes)) lctl set_param obdfilter.${FSNAME}-*.sync_journal=0
+       do_nodesv $(comma_list $(osts_nodes)) \
+               $LCTL get_param obdfilter.${FSNAME}-*.sync_journal
+       save_lustre_params $(get_facets OST) \
+               "obdfilter.${FSNAME}-*.sync_journal" > $param_file
+       do_nodesv $(comma_list $(osts_nodes)) \
+               $LCTL set_param obdfilter.${FSNAME}-*.sync_journal=0
 
        local stime=$(date +%s)
        thrlo=4 nobjhi=1 thrhi=4 obdflter_survey_run disk
@@ -162,7 +166,7 @@ test_1b () {
 run_test 1b "Object Storage Targets survey, async journal"
 
 test_1c () {
-       nobjlo=1 nobjhi=1 thrlo=128 thrhi=128 rszlo=1024 rszhi=1024 size=8192\
+       nobjlo=1 nobjhi=1 thrlo=32 thrhi=32 rszlo=1024 rszhi=1024 size=8192\
        obdflter_survey_run disk
 }
 run_test 1c "Object Storage Targets survey, big batch"
@@ -175,10 +179,12 @@ run_test 2a "Stripe F/S over the Network"
 test_2b () {
        local param_file=$TMP/$tfile-params
 
-       do_nodesv $(comma_list $(osts_nodes)) lctl get_param obdfilter.${FSNAME}-*.sync_journal
-
-       save_lustre_params $(comma_list $(osts_nodes)) "obdfilter.${FSNAME}-*.sync_journal" >$param_file
-       do_nodesv $(comma_list $(osts_nodes)) lctl set_param obdfilter.${FSNAME}-*.sync_journal=0
+       do_nodesv $(comma_list $(osts_nodes)) \
+               $LCTL get_param obdfilter.${FSNAME}-*.sync_journal
+       save_lustre_params $(get_facets OST) \
+               "obdfilter.${FSNAME}-*.sync_journal" > $param_file
+       do_nodesv $(comma_list $(osts_nodes)) \
+               $LCTL set_param obdfilter.${FSNAME}-*.sync_journal=0
 
        local stime=$(date +%s)
        thrlo=4 nobjhi=1 thrhi=4 obdflter_survey_run netdisk
@@ -198,10 +204,16 @@ run_test 2b "Stripe F/S over the Network, async journal"
 
 # README.obdfilter-survey: In network test only automated run is supported.
 test_3a () {
+       # obdfilter-survey Prerequisite:
+       #    For "network" case  you need to have all
+       #    modules (those llmount.sh loads) loaded in kernel. And the
+       #    'lctl dl' output must be blank.
+       # Skipping test for CLIENTONLY mode because of
+       # cleanupall()->stopall() does not cleanup the servers on this mode.
+       [ "$CLIENTONLY" ] && skip "CLIENTONLY mode" && return
+
        remote_servers || { skip "Local servers" && return 0; }
 
-       # The Network survey test needs:
-       # Start lctl and check for the device list. The device list must be empty.
        cleanupall
 
        obdflter_survey_run network