]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/2drive-offline-test
498154f27001a43341b34b485d486f46429b56d9
[bacula/bacula] / regress / tests / 2drive-offline-test
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6
7 #
8 # Set prefer mounted volumes to no to try to force use of
9 #   the drive swap code.
10 #
11 # This script uses the virtual disk autochanger and two drives
12 #
13 # It tests starting job 1, which will not complete because FD is
14 #   offline, then starting job 2, which wants to swap the volume.
15 #
16 TestName="2drive-offline"
17 JobName="2driveoffline"
18 . scripts/functions
19
20 scripts/cleanup
21 scripts/copy-2disk-drive-confs
22 scripts/prepare-disk-changer
23 CLIENT=2drive2disk
24
25 change_jobname NightlySave $JobName
26 start_test
27
28 echo "${cwd}/build" >${cwd}/tmp/file-list
29
30 # Turn off Prefer Mounted Volumes so we use 2 drives
31 outf="${cwd}/tmp/sed_tmp"
32 echo "s%# Prefer Mounted Volumes%  Prefer Mounted Volumes%g" >${outf}
33 cp ${cwd}/bin/bacula-dir.conf ${cwd}/tmp/1
34 # Comment the next line out to write everything to one drive
35 #  otherwise, it writes the two jobs to different drives
36 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf
37
38 # Write out bconsole commands
39 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
40 @$out /dev/null
41 messages
42 @$out ${cwd}/tmp/log1.out
43 label storage=tape volume=TestVolume001 slot=2 Pool=Default drive=0
44 label storage=tape volume=TestVolume002 slot=1 Pool=Default drive=1
45 status storage=tape
46 setdebug level=120 storage=tape
47 run job=Offline level=Full yes
48 @sleep 2
49 run job=$JobName level=Full yes
50 status storage=tape
51 wait
52 list volumes
53 list jobs
54 status storage=tape
55 messages
56 quit
57 END_OF_DATA
58
59 run_bacula
60
61 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
62 @$out /dev/null
63 messages
64 @# now do a restore
65 @#
66 @$out ${cwd}/tmp/log2.out
67 @#unmount storage=tape drive=0
68 @#unmount storage=tape drive=1
69 @#mount storage=tape slot=1 drive=0
70 @#mount storage=tape slot=2 drive=1
71 restore where=${cwd}/tmp/bacula-restores select all storage=tape done
72 yes
73 wait
74 messages
75 quit
76 END_OF_DATA
77
78 run_bconsole
79 check_for_zombie_jobs storage=tape
80 stop_bacula
81
82 check_two_logs
83 check_restore_diff
84
85 end_test