]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/relabel-tape
Backport from Bacula Enterprise
[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 echo "Backup done"
65
66 # now do several restores to ensure we cleanup between jobs
67 #
68 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
69 @$out ${cwd}/tmp/log2.out
70 setdebug level=150 storage=tape
71 list volumes
72 restore where=${cwd}/tmp/bacula-restores select all done
73 yes
74 wait
75 restore where=${cwd}/tmp/bacula-restores select all done
76 yes
77 wait
78 @$out ${cwd}/tmp/log2.out
79 @#
80 @# now unmount the tape and start two restores
81 @#  at the same time
82 @#
83 list volumes
84 unmount storage=tape
85 restore where=${cwd}/tmp/bacula-restores select all done
86 yes
87 restore where=${cwd}/tmp/bacula-restores select
88 unmark *
89 mark *
90 done
91 yes
92 mount storage=tape
93 wait
94 messages
95 quit
96 END_OF_DATA
97
98 run_bconsole
99
100 check_for_zombie_jobs storage=tape
101 stop_bacula
102
103 check_two_logs
104 check_restore_diff
105 end_test