]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/vtape-big-test-changer
Make out of freespace non-fatal for removable devices -- i.e. behaves like tape
[bacula/bacula] / regress / tests / vtape-big-test-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 backups with dummy tape driver
9 # This test setups an Autochanger with 800 slots
10 # and 5 drives (3 LTO3 and 2 LTO1)
11 #
12 # TAPE_DRIVE="$cwd/working/ach/drive0"
13 # TAPE_DRIVE1="$cwd/working/ach/drive0"
14 # AUTOCHANGER="$cwd/working/ach/conf"
15 # USE_VTAPE=yes
16 # AUTOCHANGER_SCRIPT=disk-changer
17
18
19 TestName="vtape-test-changer"
20 JobName=backup
21 . scripts/functions
22
23 require_vtape
24
25 scripts/cleanup
26 scripts/copy-tape-confs
27 cp $rscripts/bacula-dir-vtape.conf $conf/bacula-dir.conf
28 cp $rscripts/bacula-sd-vtape.conf $conf/bacula-sd.conf
29 scripts/prepare-fake-autochanger 300
30
31 perl -Mscripts::functions \
32     -e "set_maximum_concurrent_jobs('$conf/bacula-dir.conf', 100)"
33 perl -Mscripts::functions \
34     -e "set_maximum_concurrent_jobs('$conf/bacula-sd.conf', 100)"
35 perl -Mscripts::functions \
36     -e "set_maximum_concurrent_jobs('$conf/bacula-fd.conf', 100)"
37
38 echo "${cwd}/build" >${cwd}/tmp/file-list
39
40 start_test
41
42 when1=`perl -Mscripts::functions -e "get_time(30)"`
43 when2=`perl -Mscripts::functions -e "get_time(45)"`
44
45 clientname=`awk '/Name = .*-fd/ { if (!ok) { print $3 ; ok=1 } }' bin/bacula-dir.conf`
46
47 perl -Mscripts::functions \
48     -e "extract_resource('$conf/bacula-dir.conf', 'Job', 'NightlySave')" > $tmp/1
49
50 for i in `seq 4 40`; do
51     sed "s%NightlySave%NightlySave$i%" $tmp/1 >> $conf/bacula-dir.conf
52 done
53
54
55
56 # Catalog record for cleaning tape "CLN01" successfully created.
57 # CLN01      | Cleaning
58
59 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
60 @$out ${cwd}/tmp/log7.out
61 label barcodes pool=Scratch slots=1-300 storage=LTO3 drive=0
62 yes
63 messages
64 list volumes
65 @$out ${cwd}/tmp/log1.out
66 run level=full storage=LTO3 when="$when1" job=NightlySave  pool=Inc     yes
67 run level=full storage=LTO3 when="$when1" job=NightlySave1 pool=Full    yes
68 run level=full storage=LTO3 when="$when1" job=NightlySave2 pool=Default yes
69 run level=full storage=LTO3 when="$when1" job=NightlySave3 pool=Default yes
70 run level=full storage=LTO3 when="$when1" job=NightlySave4 pool=Inc     yes
71 run level=full storage=LTO3 when="$when1" job=NightlySave5 pool=Full    yes
72 run level=full storage=LTO3 when="$when1" job=NightlySave6 pool=Default yes
73 run level=full storage=LTO3 when="$when1" job=NightlySave7 pool=Default yes
74 run level=full storage=LTO3 when="$when1" job=NightlySave8 pool=Inc     yes
75 run level=full storage=LTO3 when="$when1" job=NightlySave9 pool=Full    yes
76 @#run level=full storage=LTO3 when="$when1" job=NightlySave10  pool=Default yes
77 @#run level=full storage=LTO3 when="$when1" job=NightlySave11  pool=Default yes
78 @#run level=full storage=LTO3 when="$when1" job=NightlySave12  pool=Inc     yes
79 @#run level=full storage=LTO3 when="$when1" job=NightlySave13  pool=Full    yes
80 @#run level=full storage=LTO3 when="$when1" job=NightlySave14  pool=Default yes
81 @#run level=full storage=LTO3 when="$when1" job=NightlySave15  pool=Default yes
82 @#run level=full storage=LTO3 when="$when1" job=NightlySave16  pool=Inc     yes
83 @#run level=full storage=LTO3 when="$when1" job=NightlySave17  pool=Full    yes
84 @#run level=full storage=LTO3 when="$when1" job=NightlySave18  pool=Default yes
85 @#run level=full storage=LTO3 when="$when1" job=NightlySave19  pool=Default yes
86 @#run level=full storage=LTO3 when="$when1" job=NightlySave20  pool=Inc     yes
87 @#run level=full storage=LTO3 when="$when1" job=NightlySave21  pool=Full    yes
88 @#run level=full storage=LTO3 when="$when1" job=NightlySave22  pool=Default yes
89 @#run level=full storage=LTO3 when="$when1" job=NightlySave23  pool=Default yes
90 @#run level=full storage=LTO3 when="$when1" job=NightlySave24  pool=Inc     yes
91 @#run level=full storage=LTO3 when="$when1" job=NightlySave25  pool=Full    yes
92 @#run level=full storage=LTO3 when="$when1" job=NightlySave26  pool=Default yes
93 @#run level=full storage=LTO3 when="$when1" job=NightlySave27  pool=Default yes
94 @#run level=full storage=LTO3 when="$when1" job=NightlySave28  pool=Inc     yes
95 @#run level=full storage=LTO3 when="$when1" job=NightlySave29  pool=Full    yes
96 @#run level=full storage=LTO3 when="$when1" job=NightlySave30  pool=Default yes
97 @#run level=full storage=LTO3 when="$when1" job=NightlySave31  pool=Default yes
98 @#run level=full storage=LTO3 when="$when1" job=NightlySave32  pool=Inc     yes
99 @#run level=full storage=LTO3 when="$when1" job=NightlySave33  pool=Full    yes
100 @#run level=full storage=LTO3 when="$when1" job=NightlySave34  pool=Default yes
101 @#run level=full storage=LTO3 when="$when1" job=NightlySave35  pool=Default yes
102 @sleep 50
103 @#wait jobid=1
104 @#restore client=$clientname fileset="Full Set" pool=Inc where=${cwd}/tmp/bacula-restores1 select all done
105 @#yes
106 @#sleep 30
107 cancel
108 1
109 yes
110 @sleep 1
111 cancel
112 1
113 yes
114 @sleep 1
115 cancel
116 1
117 yes
118 @sleep 1
119 cancel
120 1
121 yes
122 wait
123 messages
124 quit
125 END_OF_DATA
126
127 run_bacula
128 check_for_zombie_jobs storage=LTO3 client=$clientname
129
130 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
131 @$out ${cwd}/tmp/log2.out  
132 @# 
133 @# now do a restore
134 @#
135 restore client=$clientname fileset="Full Set" pool=Full where=${cwd}/tmp/bacula-restores select all done
136 yes
137 wait
138 messages
139 END_OF_DATA
140
141 run_bconsole
142 check_for_zombie_jobs storage=LTO3 client=$clientname
143
144 # test update slots
145 # remove volume vol20 from autochanger
146 grep -v vol20 ${cwd}/working/ach/barcodes > ${cwd}/tmp/1
147 cp ${cwd}/tmp/1 ${cwd}/working/ach/barcodes
148
149 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
150 @$out ${cwd}/tmp/log3.out
151 list volume=vol20
152 update slots slots=5-40 storage=LTO3 drive=3
153 list volume=vol20
154 END_OF_DATA
155
156 run_bconsole
157
158 stop_bacula
159
160 check_two_logs
161 check_restore_diff
162
163 # get InChanger flag
164 RES=`awk -F'|' '/vol20 .+(Full|Append)/ { print $11 }' ${cwd}/tmp/log3.out`
165 set $RES
166 if [ $1 -eq $2 ]; then
167     print_debug "ERROR: Error in update slots"
168     bstat=1
169 fi
170
171 grep LTO1_5 tmp/log1.out > /dev/null
172 if test $? = 0; then
173     print_debug "ERROR: AutoSelect option broken"
174     bstat=1
175 fi
176
177 grep 'Error: Re-read' tmp/log1.out > /dev/null
178 if test $? = 0; then
179     print_debug "ERROR: Found Re-read errors"
180     #bstat=1
181 fi
182
183 end_test