]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/relabel-tape
Make out of freespace non-fatal for removable devices -- i.e. behaves like tape
[bacula/bacula] / regress / tests / relabel-tape
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 using the compressed option
9 #   then backup four times, each with incremental then finally restore.
10 #   It should require at least 4 different bsrs.
11 #
12 TestName="relabel-tape"
13 JobName=Relabeltape
14 . scripts/functions
15
16 require_tape_drive
17
18 scripts/cleanup-tape
19 scripts/copy-tape-confs
20
21 echo "${cwd}/build" >${cwd}/tmp/file-list
22
23 change_jobname $JobName
24 start_test
25
26 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
27 @$out /dev/null
28 messages
29 @$out ${cwd}/tmp/log1.out
30 setdebug level=150 storage=tape
31 label storage=tape volume=TestVolume001 slot=0 pool=Default
32 run job=$JobName level=Full yes
33 wait
34 messages
35 add pool=Default storage=tape
36 0
37 TestVolume002
38 @# set status to append
39 update volume=TestVolume001
40 1
41 .
42 run job=$JobName level=Full yes
43 wait
44 list volumes
45 unmount storage=tape
46 unmount storage=tape
47 purge volume=TestVolume001
48 relabel oldvolume=TestVolume001 volume=TestVolume003 slot=0 pool=Default storage=tape
49 list volumes
50 mount storage=tape
51 messages
52 wait
53 run job=$JobName level=Full yes
54 wait
55 list volumes
56 messages
57 quit
58 END_OF_DATA
59
60 run_bacula
61 check_for_zombie_jobs storage=tape
62
63
64
65 # now do several restores to ensure we cleanup between jobs
66 #
67 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
68 @$out ${cwd}/tmp/log2.out
69 setdebug level=150 storage=tape
70 list volumes
71 restore where=${cwd}/tmp/bacula-restores select all done
72 yes
73 wait
74 restore where=${cwd}/tmp/bacula-restores select all done
75 yes
76 wait
77 @$out ${cwd}/tmp/log2.out
78 @#
79 @# now unmount the tape and start two restores
80 @#  at the same time
81 @#
82 list volumes
83 unmount storage=tape
84 restore where=${cwd}/tmp/bacula-restores select all done
85 yes
86 restore where=${cwd}/tmp/bacula-restores select
87 unmark *
88 mark *
89 done
90 yes
91 mount storage=tape
92 wait
93 messages
94 quit
95 END_OF_DATA
96
97 run_bconsole
98
99 check_for_zombie_jobs storage=tape
100 stop_bacula
101
102 check_two_logs
103 check_restore_diff
104 end_test