3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
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)
12 # TAPE_DRIVE="$cwd/working/ach/drive0"
13 # TAPE_DRIVE1="$cwd/working/ach/drive0"
14 # AUTOCHANGER="$cwd/working/ach/conf"
16 # AUTOCHANGER_SCRIPT=disk-changer
19 TestName="vtape-test-changer"
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
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)"
38 echo "${cwd}/build" >${cwd}/tmp/file-list
42 when1=`perl -Mscripts::functions -e "get_time(30)"`
43 when2=`perl -Mscripts::functions -e "get_time(45)"`
45 clientname=`awk '/Name = .*-fd/ { if (!ok) { print $3 ; ok=1 } }' bin/bacula-dir.conf`
47 perl -Mscripts::functions \
48 -e "extract_resource('$conf/bacula-dir.conf', 'Job', 'NightlySave')" > $tmp/1
50 for i in `seq 4 40`; do
51 sed "s%NightlySave%NightlySave$i%" $tmp/1 >> $conf/bacula-dir.conf
56 # Catalog record for cleaning tape "CLN01" successfully created.
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
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
104 @#restore client=$clientname fileset="Full Set" pool=Inc where=${cwd}/tmp/bacula-restores1 select all done
128 check_for_zombie_jobs storage=LTO3 client=$clientname
130 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
131 @$out ${cwd}/tmp/log2.out
135 restore client=$clientname fileset="Full Set" pool=Full where=${cwd}/tmp/bacula-restores select all done
142 check_for_zombie_jobs storage=LTO3 client=$clientname
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
149 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
150 @$out ${cwd}/tmp/log3.out
152 update slots slots=5-40 storage=LTO3 drive=3
164 RES=`awk -F'|' '/vol20 .+(Full|Append)/ { print $11 }' ${cwd}/tmp/log3.out`
166 if [ $1 -eq $2 ]; then
167 print_debug "ERROR: Error in update slots"
171 grep LTO1_5 tmp/log1.out > /dev/null
173 print_debug "ERROR: AutoSelect option broken"
177 grep 'Error: Re-read' tmp/log1.out > /dev/null
179 print_debug "ERROR: Found Re-read errors"