Whamcloud - gitweb
LU-11503 tests: fix "division by 0" defect
[fs/lustre-release.git] / lustre / tests / ha.sh
1 #!/bin/bash
2 # -*- mode: Bash; tab-width: 4; indent-tabs-mode: t; -*-
3 # vim:shiftwidth=4:softtabstop=4:tabstop=4:
4 #
5 # NAME
6 #
7 #   ha.sh - test Lustre HA (aka failover) configurations
8 #
9 # SYNOPSIS
10 #
11 #   ha.sh [OPTIONS]
12 #
13 # DESCRIPTION
14 #
15 #   ha.sh tests Lustre HA (aka failover) configurations with a CRM.
16 #
17 # OPTIONS
18 #
19 #   -h
20 #       Help.
21 #
22 #   -c HOST[,...]
23 #       Specify client nodes.
24 #
25 #   -s HOST[,...]
26 #       Specify server nodes.
27 #
28 #   -v HOST[,...]
29 #       Specify victim nodes to be rebooted.
30 #
31 #   -d DIRECTORY
32 #       Choose a parent of the test directory.  "/mnt/lustre" if not specified.
33 #
34 #   -u SECONDS
35 #       Define a duration for the test. 86400 seconds if not specified.
36 #
37 #   -p SECONDS
38 #       Define a max failover period. 10 minutes if not set.
39 #
40 #   -w
41 #       Only run the workloads; no failure will be introduced.
42 #       -v, -s are ignored in this case.
43 #   -r
44 #       Workloads dry run for several seconds; no failures will be introduced.
45 #       This option is useful to verify the loads.
46 #       -u is ignored in this case
47 #   -m
48 #       Reboot victim nodes simultaneously.
49 #
50 #
51 # ASSUMPTIONS
52 #
53 #   A Lustre file system is up and mounted on all client nodes.  This script
54 #   does not mount or unmount any Lustre targets or clients, let alone format
55 #   anything.
56 #
57 #   Each target has a failnode, so that workloads can continue after a power
58 #   failure.
59 #
60 #   CRM could be configured by 2 ways:
61 #   1.
62 #   Targets are automatically failed back when their primary node is back.  This
63 #   assumption avoids calling CRM-specific commands to trigger failbacks, making
64 #   this script more CRM-neural.
65 #   2.
66 #   Targets are not automatically failed back when their primary node is back.
67 #   CRM-specific command is executed to trigger failbacks.
68 #
69 #   A crash dump mechanism is configured to catch LBUGs, panics, etc.
70 #
71 # WORKLOADS
72 #
73 #   Each client runs set of MPI and non-MPI workloads. These
74 #   applications are run in short loops so that their exit status can be waited
75 #   for and checked within reasonable time by ha_wait_loads.
76 #   The set of MPI and non-MPI workloads are configurable by parameters:
77 #       ha_nonmpi_loads
78 #               default set: dd, tar, iozone
79 #       ha_mpi_loads
80 #               default set: ior, simul, mdtest
81 #
82 #   The number of clients run MPI loads is configured by parameter
83 #   ha_mpi_instances. Only one client runs MPI workloads by default.
84 #
85 # PROCESS STRUCTURE AND IPC
86 #
87 #   On the node where this script is run, the processes look like this:
88 #
89 #       ~ ha.sh (ha_killer)
90 #
91 #           ~ ha.sh (ha_repeat_mpi_load ior)
92 #               ~ mpirun IOR
93 #           ~ ha.sh (ha_repeat_mpi_load simul)
94 #               ~ mpirun simul
95 #           ~ ha.sh (ha_repeat_mpi_load mdtest)
96 #               ~ mpirun mdtest
97 #           ~ ... (one for each MPI load)
98 #
99 #           ~ ha.sh (ha_repeat_nonmpi_load client2 dbench)
100 #               ~ pdsh client2 dbench
101 #           ~ ha.sh (ha_repeat_nonmpi_load client2 iozone)
102 #               ~ pdsh client2 iozone
103 #           ~ ha.sh (ha_repeat_nonmpi_load client5 iozone)
104 #               ~ pdsh client5 iozone
105 #           ~ ... (one for each non-MPI load on each client)
106 #
107 #   Each tilde represents a process.  Indentations imply parent-children
108 #   relation.
109 #
110 #   IPC is done by files in the temporary directory.
111 #
112
113 #set -x
114
115 SIMUL=${SIMUL:-$(which simul 2> /dev/null || true)}
116 IOR=${IOR:-$(which IOR 2> /dev/null || true)}
117 MDTEST=${MDTEST:-$(which mdtest 2> /dev/null || true)}
118
119 ior_blockSize=${ior_blockSize:-6g}
120 mpi_threads_per_client=${mpi_threads_per_client:-2}
121
122 iozone_SIZE=${iozone_SIZE:-262144} # 256m
123
124 mpirun=${MPIRUN:-$(which mpirun)}
125 LFS=${LFS:-$(which lfs)}
126
127 ha_check_env()
128 {
129         for ((load = 0; load < ${#ha_mpi_load_tags[@]}; load++)); do
130                 local tag=${ha_mpi_load_tags[$load]}
131                 local bin=$(echo $tag | tr '[:lower:]' '[:upper:]')
132                 if [ x${!bin} = x ]; then
133                         ha_error ha_mpi_loads: ${ha_mpi_loads}, $bin is not set
134                         exit 1
135                 fi
136         done
137 }
138
139 ha_info()
140 {
141         echo "$0: $(date +%H:%M:%S' '%s):" "$@"
142 }
143
144 ha_log()
145 {
146         local nodes=${1// /,}
147         shift
148         ha_on $nodes "lctl mark $*"
149 }
150
151 ha_error()
152 {
153     ha_info "$@" >&2
154 }
155
156 ha_trap_err()
157 {
158     local i
159
160     ha_error "Trap ERR triggered by:"
161     ha_error "    $BASH_COMMAND"
162     ha_error "Call trace:"
163     for ((i = 0; i < ${#FUNCNAME[@]}; i++)); do
164         ha_error "    ${FUNCNAME[$i]} [${BASH_SOURCE[$i]}:${BASH_LINENO[$i]}]"
165     done
166 }
167
168 trap ha_trap_err ERR
169 set -eE
170
171 declare     ha_tmp_dir=/tmp/$(basename $0)-$$
172 declare     ha_stop_file=$ha_tmp_dir/stop
173 declare     ha_fail_file=$ha_tmp_dir/fail
174 declare     ha_status_file_prefix=$ha_tmp_dir/status
175 declare -a  ha_status_files
176 declare     ha_machine_file=$ha_tmp_dir/machine_file
177 declare     ha_power_down_cmd=${POWER_DOWN:-"pm -0"}
178 declare     ha_power_up_cmd=${POWER_UP:-"pm -1"}
179 declare     ha_power_delay=${POWER_DELAY:-60}
180 declare     ha_failback_delay=${DELAY:-5}
181 declare     ha_failback_cmd=${FAILBACK:-""}
182 declare     ha_stripe_params=${STRIPEPARAMS:-"-c 0"}
183 declare     ha_dir_stripe_count=${DSTRIPECOUNT:-"1"}
184 declare     ha_mdt_index=${MDTINDEX:-"0"}
185 declare     ha_mdt_index_random=${MDTINDEXRAND:-false}
186 declare -a  ha_clients
187 declare -a  ha_servers
188 declare -a  ha_victims
189 declare     ha_test_dir=/mnt/lustre/$(basename $0)-$$
190 declare     ha_start_time=$(date +%s)
191 declare     ha_expected_duration=$((60 * 60 * 24))
192 declare     ha_max_failover_period=10
193 declare     ha_nr_loops=0
194 declare     ha_stop_signals="SIGINT SIGTERM SIGHUP"
195 declare     ha_load_timeout=$((60 * 10))
196 declare     ha_workloads_only=false
197 declare     ha_workloads_dry_run=false
198 declare     ha_simultaneous=false
199
200 declare     ha_mpi_instances=${ha_mpi_instances:-1}
201
202 declare     ha_mpi_loads=${ha_mpi_loads="ior simul mdtest"}
203 declare -a  ha_mpi_load_tags=($ha_mpi_loads)
204
205 declare     ha_ior_params=${IORP:-'" -b $ior_blockSize -t 2m -w -W -T 1"'}
206 declare     ha_simul_params=${SIMULP:-'" -n 10"'}
207 declare     ha_mdtest_params=${MDTESTP:-'" -i 1 -n 1000"'}
208 declare     ha_mpirun_options=${MPIRUN_OPTIONS:-""}
209
210 eval ha_params_ior=($ha_ior_params)
211 eval ha_params_simul=($ha_simul_params)
212 eval ha_params_mdtest=($ha_mdtest_params)
213
214 declare ha_nparams_ior=${#ha_params_ior[@]}
215 declare ha_nparams_simul=${#ha_params_simul[@]}
216 declare ha_nparams_mdtest=${#ha_params_mdtest[@]}
217
218 declare -A  ha_mpi_load_cmds=(
219         [ior]="$IOR -o {}/f.ior {params}"
220         [simul]="$SIMUL {params} -d {}"
221         [mdtest]="$MDTEST {params} -d {}"
222 )
223
224 declare     ha_nonmpi_loads=${ha_nonmpi_loads="dd tar iozone"}
225 declare -a  ha_nonmpi_load_tags=($ha_nonmpi_loads)
226 declare -a  ha_nonmpi_load_cmds=(
227         "dd if=/dev/zero of={}/f.dd bs=1M count=256"
228         "tar cf - /etc | tar xf - -C {}"
229         "iozone -a -e -+d -s $iozone_SIZE {}/f.iozone"
230 )
231
232 ha_usage()
233 {
234     ha_info "Usage: $0 -c HOST[,...] -s HOST[,...]"                         \
235             "-v HOST[,...] [-d DIRECTORY] [-u SECONDS]"
236 }
237
238 ha_process_arguments()
239 {
240     local opt
241
242         while getopts hc:s:v:d:p:u:wrm opt; do
243         case $opt in
244         h)
245             ha_usage
246             exit 0
247             ;;
248         c)
249             ha_clients=(${OPTARG//,/ })
250             ;;
251         s)
252             ha_servers=(${OPTARG//,/ })
253             ;;
254         v)
255             ha_victims=(${OPTARG//,/ })
256             ;;
257         d)
258             ha_test_dir=$OPTARG/$(basename $0)-$$
259             ;;
260         u)
261             ha_expected_duration=$OPTARG
262             ;;
263         p)
264                 ha_max_failover_period=$OPTARG
265                 ;;
266         w)
267                 ha_workloads_only=true
268                 ;;
269         r)
270                 ha_workloads_dry_run=true
271                 ;;
272         m)
273                 ha_simultaneous=true
274                 ;;
275         \?)
276             ha_usage
277             exit 1
278             ;;
279         esac
280     done
281
282         if [ -z "${ha_clients[*]}" ]; then
283                 ha_error "-c is mandatory"
284                 ha_usage
285                 exit 1
286         fi
287         if ! ($ha_workloads_dry_run ||
288                         $ha_workloads_only) &&
289                         ([ -z "${ha_servers[*]}" ] ||
290                         [ -z "${ha_victims[*]}" ]); then
291                 ha_error "-s, and -v are all mandatory"
292                 ha_usage
293                 exit 1
294         fi
295 }
296
297 ha_on()
298 {
299         local nodes=$1
300         local rc=0
301
302         shift
303
304         #
305         # -S is to be used here to track the
306         # remote command return values
307         #
308         pdsh -S -w $nodes PATH=/usr/local/sbin:/usr/local/bin:/sbin:\
309 /bin:/usr/sbin:/usr/bin "$@" ||
310                 rc=$?
311         return $rc
312 }
313
314 ha_trap_exit()
315 {
316         touch "$ha_stop_file"
317         trap 0
318         if [ -e "$ha_fail_file" ]; then
319                 ha_info "Test directory $ha_test_dir not removed"
320                 ha_info "Temporary directory $ha_tmp_dir not removed"
321         else
322                 ha_on ${ha_clients[0]} rm -rf "$ha_test_dir"
323                 ha_info "Please find the results in the directory $ha_tmp_dir"
324         fi
325 }
326
327 ha_trap_stop_signals()
328 {
329     ha_info "${ha_stop_signals// /,} received"
330     touch "$ha_stop_file"
331 }
332
333 ha_sleep()
334 {
335     local n=$1
336
337     ha_info "Sleeping for ${n}s"
338     #
339     # sleep(1) could interrupted.
340     #
341     sleep $n || true
342 }
343
344 ha_lock()
345 {
346     local lock=$1
347
348     until mkdir "$lock" >/dev/null 2>&1; do
349         ha_sleep 1 >/dev/null
350     done
351 }
352
353 ha_unlock()
354 {
355     local lock=$1
356
357     rm -r "$lock"
358 }
359
360 ha_dump_logs()
361 {
362         local nodes=${1// /,}
363         local file=/tmp/$(basename $0)-$$-$(date +%s).dk
364         local lock=$ha_tmp_dir/lock-dump-logs
365         local rc=0
366
367         ha_lock "$lock"
368         ha_info "Dumping lctl log to $file"
369
370         #
371         # some nodes could crash, so
372         # do not exit with error if not all logs are dumped
373         #
374         ha_on $nodes "lctl dk >>$file" || rc=$?
375
376         [ $rc -eq 0 ] ||
377                 ha_error "not all logs are dumped! Some nodes are unreachable."
378         ha_unlock "$lock"
379 }
380
381 ha_repeat_mpi_load()
382 {
383         local client=$1
384         local load=$2
385         local status=$3
386         local parameter=$4
387         local tag=${ha_mpi_load_tags[$load]}
388         local cmd=${ha_mpi_load_cmds[$tag]}
389         local dir=$ha_test_dir/$client-$tag
390         local log=$ha_tmp_dir/$client-$tag
391         local rc=0
392         local nr_loops=0
393         local avg_loop_time=0
394         local start_time=$(date +%s)
395
396         cmd=${cmd//"{}"/$dir}
397         cmd=${cmd//"{params}"/$parameter}
398
399         ha_info "Starting $tag"
400
401         local machines="-machinefile $ha_machine_file"
402         while [ ! -e "$ha_stop_file" ] && ((rc == 0)); do
403                 {
404                 local mdt_index
405                 if $ha_mdt_index_random && [ $ha_mdt_index -ne 0 ]; then
406                         mdt_index=$(ha_rand $ha_mdt_index)
407                 else
408                         mdt_index=$ha_mdt_index
409                 fi
410                 ha_on $client $LFS mkdir -i$mdt_index -c$ha_dir_stripe_count "$dir" &&
411                 ha_on $client $LFS getdirstripe "$dir" &&
412                 ha_on $client chmod a+xwr $dir &&
413                 ha_on $client "su mpiuser sh -c \" $mpirun $ha_mpirun_options \
414                         -np $((${#ha_clients[@]} * mpi_threads_per_client )) \
415                         $machines $cmd \" " &&
416                         ha_on $client rm -rf "$dir";
417                 } >>"$log" 2>&1 || rc=$?
418
419                 ha_info rc=$rc
420
421                 if ((rc != 0)); then
422                         touch "$ha_fail_file"
423                         touch "$ha_stop_file"
424                         ha_dump_logs "${ha_clients[*]} ${ha_servers[*]}"
425                 fi
426                 echo $rc >"$status"
427
428                 nr_loops=$((nr_loops + 1))
429         done
430
431         [ $nr_loops -ne 0 ] &&
432                 avg_loop_time=$((($(date +%s) - start_time) / nr_loops))
433
434         ha_info "$tag stopped: rc $rc avg loop time $avg_loop_time"
435 }
436
437 ha_start_mpi_loads()
438 {
439         local client
440         local load
441         local tag
442         local status
443         local n
444         local nparam
445
446         for client in ${ha_clients[@]}; do
447                 ha_info ha_machine_file=$ha_machine_file
448                 echo $client >> $ha_machine_file
449         done
450         local dirname=$(dirname $ha_machine_file)
451         for client in ${ha_clients[@]}; do
452                 ha_on $client mkdir -p $dirname
453                 scp $ha_machine_file $client:$ha_machine_file
454         done
455
456         # ha_mpi_instances defines the number of
457         # clients start mpi loads; should be <= ${#ha_clients[@]}
458         local inst=$ha_mpi_instances
459         (( inst <= ${#ha_clients[@]} )) || inst=${#ha_clients[@]}
460
461         for ((n = 0; n < $inst; n++)); do
462                 client=${ha_clients[n]}
463                 for ((load = 0; load < ${#ha_mpi_load_tags[@]}; load++)); do
464                         tag=${ha_mpi_load_tags[$load]}
465                         status=$ha_status_file_prefix-$tag-$client
466                         # ha_nparams_ior
467                         # ha_nparams_simul
468                         local num=ha_nparams_$tag
469                         nparam=$((n % num))
470                         local aref=ha_params_$tag[nparam]
471                         local parameter=${!aref}
472                         ha_repeat_mpi_load $client $load $status "$parameter" &
473                                 ha_status_files+=("$status")
474                 done
475         done
476 }
477
478 ha_repeat_nonmpi_load()
479 {
480         local client=$1
481         local load=$2
482         local status=$3
483         local tag=${ha_nonmpi_load_tags[$load]}
484         local cmd=${ha_nonmpi_load_cmds[$load]}
485         local dir=$ha_test_dir/$client-$tag
486         local log=$ha_tmp_dir/$client-$tag
487         local rc=0
488         local nr_loops=0
489         local avg_loop_time=0
490         local start_time=$(date +%s)
491
492     cmd=${cmd//"{}"/$dir}
493
494     ha_info "Starting $tag on $client"
495
496         while [ ! -e "$ha_stop_file" ] && ((rc == 0)); do
497                 ha_on $client "mkdir -p $dir &&                              \
498                         $cmd &&                                              \
499                         rm -rf $dir" >>"$log" 2>&1 || rc=$?
500
501                 if ((rc != 0)); then
502                         ha_dump_logs "${ha_clients[*]} ${ha_servers[*]}"
503                         touch "$ha_fail_file"
504                         touch "$ha_stop_file"
505                 fi
506                 echo $rc >"$status"
507
508                 nr_loops=$((nr_loops + 1))
509         done
510
511         [ $nr_loops -ne 0 ] &&
512                 avg_loop_time=$((($(date +%s) - start_time) / nr_loops))
513
514         ha_info "$tag on $client stopped: rc $rc avg loop time ${avg_loop_time}s"
515 }
516
517 ha_start_nonmpi_loads()
518 {
519     local client
520     local load
521     local tag
522     local status
523
524     for client in ${ha_clients[@]}; do
525         for ((load = 0; load < ${#ha_nonmpi_load_tags[@]}; load++)); do
526             tag=${ha_nonmpi_load_tags[$load]}
527             status=$ha_status_file_prefix-$tag-$client
528             ha_repeat_nonmpi_load $client $load $status &
529             ha_status_files+=("$status")
530         done
531     done
532 }
533
534 ha_start_loads()
535 {
536     trap ha_trap_stop_signals $ha_stop_signals
537     ha_start_nonmpi_loads
538     ha_start_mpi_loads
539 }
540
541 ha_stop_loads()
542 {
543     touch $ha_stop_file
544     trap - $ha_stop_signals
545     ha_info "Waiting for workloads to stop"
546     wait
547 }
548
549 ha_wait_loads()
550 {
551     local file
552     local end=$(($(date +%s) + ha_load_timeout))
553
554     ha_info "Waiting for workload status"
555     rm -f "${ha_status_files[@]}"
556
557         #
558         # return immediately if ha_stop_file exists,
559         # all status_files not needed to be checked
560         #
561         for file in "${ha_status_files[@]}"; do
562                 if [ -e "$ha_stop_file" ]; then
563                         ha_info "$ha_stop_file found! Stop."
564                         break
565                 fi
566                 #
567                 # Wait status file created during ha_load_timeout.
568                 # Existing file guarantees that some application
569                 # is completed. If no status file was created
570                 # this function guarantees that we allow
571                 # applications to continue after/before
572                 # failover/failback during ha_load_timeout time.
573                 #
574                 until [ -e "$file" ] || (($(date +%s) >= end)); do
575                         #
576                         # check ha_stop_file again, it could appear
577                         # during ha_load_timeout
578                         #
579                         if [ -e "$ha_stop_file" ]; then
580                                 ha_info "$ha_stop_file found! Stop."
581                                 break
582                         fi
583                         ha_sleep 1 >/dev/null
584                 done
585         done
586 }
587
588 ha_power_down()
589 {
590         local nodes=$1
591         local rc=1
592         local i
593
594         ha_info "Powering down $nodes"
595         for i in $(seq 1 5); do
596                 $ha_power_down_cmd $nodes && rc=0 && break
597                 sleep $ha_power_delay
598         done
599
600         [ $rc -eq 0 ] || ha_info "Failed Powering down in $i attempts"
601 }
602
603 ha_power_up()
604 {
605         local nodes=$1
606         local rc=1
607         local i
608
609         ha_info "Powering up $nodes"
610         for i in $(seq 1 5); do
611                 $ha_power_up_cmd $nodes && rc=0 && break
612                 sleep $ha_power_delay
613         done
614
615         [ $rc -eq 0 ] || ha_info "Failed Powering up in $i attempts"
616 }
617
618 #
619 # rand MAX
620 #
621 # Print a random integer within [0, MAX).
622 #
623 ha_rand()
624 {
625     local max=$1
626
627     #
628     # See "5.2 Bash Variables" from "info bash".
629     #
630     echo -n $((RANDOM * max / 32768))
631 }
632
633 ha_aim()
634 {
635         local i
636         local nodes
637
638         if $ha_simultaneous ; then
639                 nodes=$(echo ${ha_victims[@]})
640                 nodes=${nodes// /,}
641         else
642                 i=$(ha_rand ${#ha_victims[@]})
643                 nodes=${ha_victims[$i]}
644         fi
645
646         echo -n $nodes
647 }
648
649 ha_wait_nodes()
650 {
651         local nodes=$1
652         local end=$(($(date +%s) + 10 * 60))
653
654         ha_info "Waiting for $nodes to boot up"
655         until ha_on $nodes hostname >/dev/null 2>&1 ||
656                 [ -e "$ha_stop_file" ] ||
657                         (($(date +%s) >= end)); do
658                 ha_sleep 1 >/dev/null
659         done
660 }
661
662 ha_failback()
663 {
664         local nodes=$1
665         ha_info "Failback resources on $nodes in $ha_failback_delay sec"
666
667         ha_sleep $ha_failback_delay
668         [ "$ha_failback_cmd" ] ||
669         {
670                 ha_info "No failback command set, skiping"
671                 return 0
672         }
673
674         $ha_failback_cmd $nodes
675 }
676
677 ha_summarize()
678 {
679     ha_info "---------------8<---------------"
680     ha_info "Summary:"
681     ha_info "    Duration: $(($(date +%s) - $ha_start_time))s"
682     ha_info "    Loops: $ha_nr_loops"
683 }
684
685 ha_killer()
686 {
687         local nodes
688
689         while (($(date +%s) < ha_start_time + ha_expected_duration)) &&
690                         [ ! -e "$ha_stop_file" ]; do
691                 ha_info "---------------8<---------------"
692
693                 $ha_workloads_only || nodes=$(ha_aim)
694
695                 ha_info "Failing $nodes"
696                 $ha_workloads_only && ha_info "    is skipped: workload only..."
697
698                 ha_sleep $(ha_rand $ha_max_failover_period)
699                 $ha_workloads_only || ha_power_down $nodes
700                 ha_sleep 10
701                 ha_wait_loads || return
702
703                 if [ -e $ha_stop_file ]; then
704                         $ha_workloads_only || ha_power_up $nodes
705                         break
706                 fi
707
708                 ha_info "Bringing $nodes back"
709                 ha_sleep $(ha_rand 10)
710                 $ha_workloads_only ||
711                 {
712                         ha_power_up $nodes
713                         ha_wait_nodes $nodes
714                         ha_failback $nodes
715                 }
716
717                 #
718                 # Wait for the failback to start.
719                 #
720                 ha_sleep 60
721                 ha_wait_loads || return
722
723                 ha_sleep $(ha_rand 20)
724
725                 ha_nr_loops=$((ha_nr_loops + 1))
726                 ha_info "Loop $ha_nr_loops done"
727         done
728         ha_summarize
729 }
730
731 ha_main()
732 {
733         ha_process_arguments "$@"
734         ha_check_env
735
736         ha_log "${ha_clients[*]} ${ha_servers[*]}" \
737                 "START: $0: $(date +%H:%M:%S' '%s)"
738         trap ha_trap_exit EXIT
739         mkdir "$ha_tmp_dir"
740         ha_on ${ha_clients[0]} mkdir "$ha_test_dir"
741         ha_on ${ha_clients[0]} " \
742                 $LFS setstripe $ha_stripe_params $ha_test_dir"
743
744         ha_start_loads
745         ha_wait_loads
746
747         if $ha_workloads_dry_run; then
748                 ha_sleep 5
749         else
750                 ha_killer
751                 ha_dump_logs "${ha_clients[*]} ${ha_servers[*]}"
752         fi
753
754         ha_stop_loads
755
756         if [ -e "$ha_fail_file" ]; then
757                 exit 1
758         else
759                 ha_log "${ha_clients[*]} ${ha_servers[*]}" \
760                         "END: $0: $(date +%H:%M:%S' '%s)"
761                 exit 0
762         fi
763 }
764
765 ha_main "$@"