]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/bad-label-changer
Make out of freespace non-fatal for removable devices -- i.e. behaves like tape
[bacula/bacula] / regress / tests / bad-label-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 # Label two tapes, write to the first, then recycle it and destroy
9 #  the header.  Bacula should discover that, mark the tape in 
10 #  error and continue onto the second tape.
11 #
12 TestName="bad-label-changer"
13 JobName=badlabelchanger
14 . scripts/functions
15
16 require_tape_drive
17 require_autochanger
18
19 scripts/cleanup
20 scripts/copy-2tape-confs
21 scripts/prepare-two-tapes
22  
23 echo "${cwd}/build" >${cwd}/tmp/file-list
24
25 #outf="tmp/sed_tmp"
26 #echo "s%# Maximum File Size%  Maximum File Size%g" >${outf}
27 #cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
28 #sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
29
30 change_jobname $JobName
31 start_test
32
33 # Write out bconsole commands
34 cat <<END_OF_DATA >tmp/bconcmds
35 @$out /dev/null
36 messages
37 @$out tmp/log1.out
38 label storage=tape volume=TestVolume002 slot=$SLOT2 pool=Default drive=$DRIVE1
39 label storage=tape volume=TestVolume001 slot=$SLOT1 pool=Default drive=$DRIVE1
40 list volumes
41 @#setdebug level=10 client=$CLIENT 
42 setdebug level=150 storage=tape
43 run job=$JobName yes
44 wait
45 purge volume=TestVolume001
46 messages
47 quit
48 END_OF_DATA
49
50 run_bacula
51 check_for_zombie_jobs storage=tape
52 stop_bacula
53
54 # Overwrite TestVolume001 label
55 init_drive ${TAPE_DRIVE}
56
57 cat <<END_OF_DATA >tmp/bconcmds
58 @$out /dev/null
59 messages
60 list volumes
61 run job=$JobName level=Full storage=tape yes
62 wait
63 messages
64 @# 
65 @# now do a restore
66 @#
67 @$out 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_bacula
76 check_for_zombie_jobs storage=tape
77 stop_bacula
78
79 check_two_logs
80 check_restore_diff
81 end_test