5 LUSTRE=${LUSTRE:-`dirname $0`/..}
6 . $LUSTRE/tests/test-framework.sh
14 # the summary file a bit smaller than OSTSIZE
15 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
17 [ "$SLOW" = no ] && { nobjhi=1; thrhi=4; }
18 thrlo=${thrlo:-$(( thrhi / 2))}
21 ALWAYS_EXCEPT="$OBDFILTER_SURVEY_EXCEPT"
23 OBDSURVEY=${OBDSURVEY:-$(which obdfilter-survey)}
26 check_and_setup_lustre
28 # FIXME: the summary file a bit smaller than OSTSIZE, add estimation
29 minsize=$(min_ost_size)
30 if [ $(( size * 1024 )) -ge $minsize ]; then
31 size=$((minsize * 10 / 1024 / 12 ))
32 echo min kbytesavail: $minsize using size=${size} MBytes per obd instance
40 for oss in $(osts_nodes); do
41 devs=$(do_node $oss "lctl dl |grep obdfilter |sort" | awk '{print $4}')
43 # if oss is local -- obdfilter-survey needs dev wo/ host
45 [[ $oss = `hostname` ]] || target=$oss:$target
46 targets="$targets $target"
53 obdflter_survey_targets () {
58 disk) targets=$(get_targets);;
59 netdisk) targets=$(get_targets);;
60 network) targets="$(osts_nodes)";;
61 *) error "unknown obdflter-survey case!" ;;
66 obdflter_survey_run () {
69 rm -f ${TMP}/obdfilter_survey*
71 local targets=$(obdflter_survey_targets $case)
72 local cmd="NETTYPE=$NETTYPE thrlo=$thrlo nobjhi=$nobjhi thrhi=$thrhi size=$size case=$case rslt_loc=${TMP} targets=\"$targets\" $OBDSURVEY"
76 cat ${TMP}/obdfilter_survey*
79 obdflter_survey_run disk
81 run_test 1a "Object Storage Targets survey"
86 local varsvc=${facet}_svc
87 local dev=$(ldiskfs_canon "*.${!varsvc}.mntdev" $facet)
89 # ext4: /proc/fs/jbd2/sda1:8/history
90 # ext3: /proc/fs/jbd/sdb1/history
92 do_facet $facet cat /proc/fs/jbd*/${dev}*/$file
99 # last two lines from history
101 # $8: hndls >= thrhi * 2
102 local hist=("$(print_jbd history $facet | tail -3 | head -2)")
104 local run=($(echo "${hist[*]}" | awk '{print $4}'))
105 local hndls=($(echo "${hist[*]}" | awk '{print $8}'))
108 for (( i=0; i<1; i++)); do
109 [[ ${run[i]} -lt 5000 ]] && \
110 error "$facet: run expected 5000, have ${run[i]}" && rc=1
111 [[ ${hndls[i]} -lt $((thrhi * 2)) ]] && \
112 error "$facet: hndls expected > $((thrhi * 2)), have ${hndls[i]}" && rc=2
117 check_jbd_values_facets () {
122 for facet in ${facets//,/ }; do
123 check_jbd_values $facet $thrhi || rc=$((rc+$?))
129 local major=$(get_mds_kernel_major)
130 local minor=$(get_mds_kernel_minor)
131 [ "$major"=="2.6" -a $minor -eq 32 ] && \
132 skip "There is no jbd history in this kernel version." && return
133 local param_file=$TMP/$tfile-params
135 do_nodesv $(comma_list $(osts_nodes)) lctl get_param obdfilter.${FSNAME}-*.sync_journal
137 save_lustre_params $(comma_list $(osts_nodes)) "obdfilter.${FSNAME}-*.sync_journal" >$param_file
138 do_nodesv $(comma_list $(osts_nodes)) lctl set_param obdfilter.${FSNAME}-*.sync_journal=0
140 thrlo=4 nobjhi=1 thrhi=4 obdflter_survey_run disk
142 check_jbd_values_facets $(get_facets OST) 4 || rc=$((rc+$?))
144 restore_lustre_params < $param_file
149 run_test 1b "Object Storage Targets survey, async journal"
152 obdflter_survey_run netdisk
154 run_test 2a "Stripe F/S over the Network"
157 local major=$(get_mds_kernel_major)
158 local minor=$(get_mds_kernel_minor)
159 [ "$major"=="2.6" -a $minor -eq 32 ] && \
160 skip "There is no jbd history in this kernel version." && return
161 local param_file=$TMP/$tfile-params
163 do_nodesv $(comma_list $(osts_nodes)) lctl get_param obdfilter.${FSNAME}-*.sync_journal
165 save_lustre_params $(comma_list $(osts_nodes)) "obdfilter.${FSNAME}-*.sync_journal" >$param_file
166 do_nodesv $(comma_list $(osts_nodes)) lctl set_param obdfilter.${FSNAME}-*.sync_journal=0
168 thrlo=4 nobjhi=1 thrhi=4 obdflter_survey_run netdisk
170 check_jbd_values_facets $(get_facets OST) 4 || rc=$((rc+$?))
172 restore_lustre_params < $param_file
177 run_test 2b "Stripe F/S over the Network, async journal"
180 # README.obdfilter-survey: In network test only automated run is supported.
182 remote_servers || { skip "Local servers" && return 0; }
184 # The Network survey test needs:
185 # Start lctl and check for the device list. The device list must be empty.
188 obdflter_survey_run network
192 run_test 3a "Network survey"
194 complete $(basename $0) $SECONDS
196 check_and_cleanup_lustre