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 # 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
42 for oss in $(osts_nodes); do
43 devs=$(do_node $oss "lctl dl |grep obdfilter |sort" | awk '{print $4}')
44 nid=$(host_nids_address $oss $NETTYPE)
46 # if oss is local -- obdfilter-survey needs dev wo/ host
48 [[ $oss = `hostname` ]] || target=$nid:$target
49 targets="$targets $target"
56 obdflter_survey_targets () {
61 disk) targets=$(get_targets);;
62 netdisk) targets=$(get_targets);;
63 network) targets=$(host_nids_address $(comma_list $(osts_nodes)) $NETTYPE);;
64 *) error "unknown obdflter-survey case!" ;;
69 obdflter_survey_run () {
72 rm -f ${TMP}/obdfilter_survey*
74 local targets=$(obdflter_survey_targets $case)
75 local cmd="NETTYPE=$NETTYPE thrlo=$thrlo nobjhi=$nobjhi thrhi=$thrhi size=$size case=$case rslt_loc=${TMP} targets=\"$targets\" $OBDSURVEY"
79 cat ${TMP}/obdfilter_survey*
82 obdflter_survey_run disk
84 run_test 1a "Object Storage Targets survey"
89 local varsvc=${facet}_svc
90 local dev=$(ldiskfs_canon "*.${!varsvc}.mntdev" $facet)
92 # ext4: /proc/fs/jbd2/sda1:8/history
93 # ext3: /proc/fs/jbd/sdb1/history
95 do_facet $facet cat /proc/fs/jbd*/${dev}*/$file
102 # last two lines from history
104 # $8: hndls >= thrhi * 2
105 local hist=("$(print_jbd history $facet | tail -3 | head -2)")
107 local run=($(echo "${hist[*]}" | awk '{print $4}'))
108 local hndls=($(echo "${hist[*]}" | awk '{print $8}'))
111 for (( i=0; i<1; i++)); do
112 [[ ${run[i]} -lt 5000 ]] && \
113 error "$facet: run expected 5000, have ${run[i]}" && rc=1
114 [[ ${hndls[i]} -lt $((thrhi * 2)) ]] && \
115 error "$facet: hndls expected > $((thrhi * 2)), have ${hndls[i]}" && rc=2
120 check_jbd_values_facets () {
125 for facet in ${facets//,/ }; do
126 check_jbd_values $facet $thrhi || rc=$((rc+$?))
132 local param_file=$TMP/$tfile-params
134 do_nodesv $(comma_list $(osts_nodes)) lctl get_param obdfilter.${FSNAME}-*.sync_journal
136 save_lustre_params $(comma_list $(osts_nodes)) "obdfilter.${FSNAME}-*.sync_journal" >$param_file
137 do_nodesv $(comma_list $(osts_nodes)) lctl set_param obdfilter.${FSNAME}-*.sync_journal=0
139 thrlo=4 nobjhi=1 thrhi=4 obdflter_survey_run disk
141 check_jbd_values_facets $(get_facets OST) 4 || rc=$((rc+$?))
143 restore_lustre_params < $param_file
148 run_test 1b "Object Storage Targets survey, async journal"
151 obdflter_survey_run netdisk
153 run_test 2a "Stripe F/S over the Network"
156 local param_file=$TMP/$tfile-params
158 do_nodesv $(comma_list $(osts_nodes)) lctl get_param obdfilter.${FSNAME}-*.sync_journal
160 save_lustre_params $(comma_list $(osts_nodes)) "obdfilter.${FSNAME}-*.sync_journal" >$param_file
161 do_nodesv $(comma_list $(osts_nodes)) lctl set_param obdfilter.${FSNAME}-*.sync_journal=0
163 thrlo=4 nobjhi=1 thrhi=4 obdflter_survey_run netdisk
165 check_jbd_values_facets $(get_facets OST) 4 || rc=$((rc+$?))
167 restore_lustre_params < $param_file
172 run_test 2b "Stripe F/S over the Network, async journal"
175 # README.obdfilter-survey: In network test only automated run is supported.
177 remote_servers || { skip "Local servers" && return 0; }
179 # The Network survey test needs:
180 # Start lctl and check for the device list. The device list must be empty.
183 obdflter_survey_run network
187 run_test 3a "Network survey"
189 complete $(basename $0) $SECONDS
191 check_and_cleanup_lustre