5 LUSTRE=${LUSTRE:-`dirname $0`/..}
6 . $LUSTRE/tests/test-framework.sh
13 # the summary file a bit smaller than OSTSIZE
14 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
17 [ "$SLOW" = no ] && { nobjhi=1; thrhi=4; }
18 thrlo=${thrlo:-$(( thrhi / 2))}
21 # bug number 23791 23791
22 ALWAYS_EXCEPT="1b 2b $OBDFILTER_SURVEY_EXCEPT"
24 OBDSURVEY=${OBDSURVEY:-$(which obdfilter-survey)}
27 check_and_setup_lustre
29 # FIXME: the summary file a bit smaller than OSTSIZE, add estimation
30 minsize=$(min_ost_size)
31 if [ $(( size * 1024 )) -ge $minsize ]; then
32 size=$((minsize * 10 / 1024 / 12 ))
33 echo min kbytesavail: $minsize using size=${size} MBytes per obd instance
37 echo $(do_nodes $1 'lctl dl | grep obdfilter' | \
38 awk '{print $4}' | sort -u)
47 for oss in $(osts_nodes); do
49 nid=$(host_nids_address $oss $NETTYPE)
51 # if oss is local -- obdfilter-survey needs dev wo/ host
53 [[ $oss = `hostname` && "$1" == "disk" ]] || target=$nid:$target
54 targets="$targets $target"
61 obdflter_survey_targets () {
66 disk) targets=$(get_targets $case);;
67 netdisk) targets=$(get_targets $case);;
68 network) targets=$(host_nids_address $(comma_list $(osts_nodes)) $NETTYPE);;
69 *) error "unknown obdflter-survey case!" ;;
74 obdflter_survey_run () {
77 rm -f ${TMP}/obdfilter_survey*
79 local targets=$(obdflter_survey_targets $case)
80 local cmd="NETTYPE=$NETTYPE thrlo=$thrlo nobjhi=$nobjhi thrhi=$thrhi size=$size case=$case rslt_loc=${TMP} targets=\"$targets\" $OBDSURVEY"
84 cat ${TMP}/obdfilter_survey*
87 obdflter_survey_run disk
89 run_test 1a "Object Storage Targets survey"
94 local varsvc=${facet}_svc
95 local dev=$(ldiskfs_canon "*.${!varsvc}.mntdev" $facet)
97 # ext4: /proc/fs/jbd2/sda1:8/history
98 # ext3: /proc/fs/jbd/sdb1/history
100 do_facet $facet cat /proc/fs/jbd*/${dev}*/$file
103 check_jbd_values () {
108 # last two lines from history
110 # $8: hndls >= thrhi * 2
111 # display history of rtime/4 before, in case obd cleanup consumes time
112 local tlines=$((rtime / 5 / 4 + 1))
113 local hist=("$(print_jbd history $facet | tail -$tlines | head -n1)")
115 local run=($(echo "${hist[*]}" | awk '{print $4}'))
116 local hndls=($(echo "${hist[*]}" | awk '{print $8}'))
119 for (( i=0; i<1; i++)); do
120 [[ ${run[i]} -lt 5000 ]] && \
121 error "$facet: run expected 5000, have ${run[i]}" && rc=1
122 [[ ${hndls[i]} -lt $((thrhi * 2)) ]] && \
123 error "$facet: hndls expected > $((thrhi * 2)), have ${hndls[i]}" && rc=2
128 check_jbd_values_facets () {
134 for facet in ${facets//,/ }; do
135 check_jbd_values $facet $thrhi $rtime || rc=$((rc+$?))
141 local param_file=$TMP/$tfile-params
143 do_nodesv $(comma_list $(osts_nodes)) \
144 $LCTL get_param obdfilter.${FSNAME}-*.sync_journal
145 save_lustre_params $(get_facets OST) \
146 "obdfilter.${FSNAME}-*.sync_journal" > $param_file
147 do_nodesv $(comma_list $(osts_nodes)) \
148 $LCTL set_param obdfilter.${FSNAME}-*.sync_journal=0
150 local stime=$(date +%s)
151 thrlo=4 nobjhi=1 thrhi=4 obdflter_survey_run disk
152 local etime=$(date +%s)
153 # run time of obd survey
154 local rtime=$((etime - stime))
156 echo "obd survey finished in $rtime seconds"
157 check_jbd_values_facets $(get_facets OST) 4 $rtime || rc=$((rc+$?))
159 restore_lustre_params < $param_file
164 run_test 1b "Object Storage Targets survey, async journal"
167 nobjlo=1 nobjhi=1 thrlo=32 thrhi=32 rszlo=1024 rszhi=1024 size=8192\
168 obdflter_survey_run disk
170 run_test 1c "Object Storage Targets survey, big batch"
173 obdflter_survey_run netdisk
175 run_test 2a "Stripe F/S over the Network"
178 local param_file=$TMP/$tfile-params
180 do_nodesv $(comma_list $(osts_nodes)) \
181 $LCTL get_param obdfilter.${FSNAME}-*.sync_journal
182 save_lustre_params $(get_facets OST) \
183 "obdfilter.${FSNAME}-*.sync_journal" > $param_file
184 do_nodesv $(comma_list $(osts_nodes)) \
185 $LCTL set_param obdfilter.${FSNAME}-*.sync_journal=0
187 local stime=$(date +%s)
188 thrlo=4 nobjhi=1 thrhi=4 obdflter_survey_run netdisk
189 local etime=$(date +%s)
190 local rtime=$((etime - stime))
192 echo "obd survey finished in $rtime seconds"
193 check_jbd_values_facets $(get_facets OST) 4 $rtime || rc=$((rc+$?))
195 restore_lustre_params < $param_file
200 run_test 2b "Stripe F/S over the Network, async journal"
203 # README.obdfilter-survey: In network test only automated run is supported.
205 remote_servers || { skip "Local servers" && return 0; }
207 # The Network survey test needs:
208 # Start lctl and check for the device list. The device list must be empty.
211 obdflter_survey_run network
215 run_test 3a "Network survey"
219 check_and_cleanup_lustre