]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/2drive-swap-test
Backport from Bacula Enterprise
[bacula/bacula] / regress / tests / 2drive-swap-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-swap-test"
14 JobName="2drive-swap"
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 @$out /dev/null
38 messages
39 @$out ${cwd}/tmp/log1.out
40 label storage=tape volume=TestVolume001 slot=1 Pool=Default drive=0
41 label storage=tape volume=TestVolume002 slot=2 Pool=Default drive=1
42 status storage=tape
43 @#setdebug level=120 storage=tape
44 run job=$JobName level=Full yes
45 @sleep 2
46 run job=$JobName level=Full yes
47 wait
48 list volumes
49 list jobs
50 update volume=TestVolume001 maxvolbytes=40123123
51 setdebug level=150 storage=tape
52 run job=$JobName level=Full yes
53 wait
54 list volumes
55 list jobs
56 messages
57 quit
58 END_OF_DATA
59
60 run_bacula
61
62 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
63 @$out /dev/null
64 messages
65 @# now do a restore
66 @#
67 @$out ${cwd}/tmp/log2.out
68 restore where=${cwd}/tmp/bacula-restores select all storage=tape done
69 yes
70 wait
71 messages
72 quit
73 END_OF_DATA
74
75 run_bconsole
76 check_for_zombie_jobs storage=tape
77 stop_bacula
78
79 check_two_logs
80 check_restore_diff
81
82 end_test