]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/2drive-2job-test
Backport from Bacula Enterprise
[bacula/bacula] / regress / tests / 2drive-2job-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 TestName="2drive-2job"
14 JobName="2drive2job"
15 . scripts/functions
16
17 scripts/cleanup
18 scripts/copy-2disk-drive-confs
19 scripts/prepare-disk-changer
20 CLIENT=2drive2disk
21
22 change_jobname NightlySave $JobName
23 start_test
24
25 echo "${cwd}/build" >${cwd}/tmp/file-list
26
27 # Turn off Prefer Mounted Volumes so we use 2 drives
28 outf="${cwd}/tmp/sed_tmp"
29 echo "s%# Prefer Mounted Volumes%  Prefer Mounted Volumes%g" >${outf}
30 cp ${cwd}/bin/bacula-dir.conf ${cwd}/tmp/1
31 # Comment the next line out to write everything to one drive
32 #  otherwise, it writes the two jobs to different drives
33 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf
34
35 # Write out bconsole commands
36 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
37 @output /dev/null
38 messages
39 @$out ${cwd}/tmp/log1.out
40 label storage=tape volume=TestVolume001 slot=2 Pool=Default drive=0
41 label storage=tape volume=TestVolume002 slot=1 Pool=Default drive=1
42 status storage=tape
43 @#unmount storage=tape drive=0
44 @#unmount storage=tape drive=1
45 @#mount storage=tape slot=2 drive=0
46 @#mount storage=tape slot=1 drive=1
47 status storage=tape
48 setdebug level=120 storage=tape
49 run job=$JobName level=Full yes
50 @sleep 2
51 run job=$JobName level=Full yes
52 status storage=tape
53 wait
54 list volumes
55 list jobs
56 status storage=tape
57 messages
58 quit
59 END_OF_DATA
60
61 run_bacula
62
63 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
64 @output /dev/null
65 messages
66 @# now do a restore
67 @#
68 @$out ${cwd}/tmp/log2.out
69 @#unmount storage=tape drive=0
70 @#unmount storage=tape drive=1
71 @#mount storage=tape slot=1 drive=0
72 @#mount storage=tape slot=2 drive=1
73 restore where=${cwd}/tmp/bacula-restores select all storage=tape done
74 yes
75 wait
76 messages
77 quit
78 END_OF_DATA
79
80 run_bconsole
81 check_for_zombie_jobs storage=tape
82 stop_bacula
83
84 check_two_logs
85 check_restore_diff
86
87 end_test