]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/two-volume-changer
Backport from Bacula Enterprise
[bacula/bacula] / regress / tests / two-volume-changer
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6
7 #
8 # Run a simple backup of the Bacula build directory 
9 #  to two tapes where the maximum tape file size is set to 1M
10 #  Note, this test simulates the tape filling and writing to
11 #   the next tape.
12 #
13 TestName="two-volume-changer"
14 JobName=twovolchanger
15 . scripts/functions
16
17 require_tape_drive
18 require_autochanger
19
20 scripts/cleanup
21 scripts/copy-2tape-confs
22 scripts/prepare-two-tapes
23  
24 echo "${cwd}/build" >${cwd}/tmp/file-list
25
26 outf="tmp/sed_tmp"
27 echo "s%# Maximum File Size%  Maximum File Size%g" >${outf}
28 cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
29 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
30
31 change_jobname $JobName
32 start_test
33
34 # Write out bconsole commands
35 cat <<END_OF_DATA >tmp/bconcmds
36 @$out /dev/null
37 messages
38 @$out tmp/log1.out
39 label storage=tape volume=TestVolume001 slot=$SLOT1 pool=Default drive=$DRIVE1
40 label storage=tape volume=TestVolume002 slot=$SLOT2 pool=Default drive=$DRIVE1
41 update Volume=TestVolume002 MaxVolBytes=3000000 pool=Default drive=$DRIVE1
42 sql
43 select * from Storage;
44 select VolumeName,InChanger,Slot,StorageId from Media;
45
46 @#setdebug level=1000 client=$CLIENT 
47 setdebug level=150 storage=tape
48 run job=$JobName yes
49 wait
50 sql
51 select * from Storage;
52 select VolumeName,InChanger,Slot,StorageId from Media;
53
54 messages
55 quit
56 END_OF_DATA
57
58 run_bacula
59 check_for_zombie_jobs storage=tape
60 stop_bacula
61
62 $scripts/${AUTOCHANGER_SCRIPT} ${AUTOCHANGER} unload $SLOT2 ${TAPE_DRIVE} 0
63
64 cat <<END_OF_DATA >tmp/bconcmds
65 @$out /dev/null
66 messages
67 @# 
68 @# now do a restore
69 @#
70 @$out tmp/log2.out
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_bacula
79 check_for_zombie_jobs storage=tape
80 stop_bacula
81
82 check_two_logs
83 check_restore_diff
84 end_test