3 # Run backups with dummy tape driver
4 # This test setups an Autochanger with 80 slots
5 # and 5 drives (5 LTO3)
16 scripts/copy-tape-confs
17 sed 's:Job {:Job { ClientRunBeforeJob = "/bin/sleep 5":' \
18 $rscripts/bacula-dir-vtape.conf > $conf/bacula-dir.conf
19 sed 's/VTape/VTape; maximum concurrent jobs = 3/' \
20 $rscripts/bacula-sd-vtape.conf | \
21 sed 's/LTO1/LTO3/g' > $conf/bacula-sd.conf
22 scripts/prepare-fake-autochanger
24 echo "${cwd}/build" >${cwd}/tmp/file-list
26 perl -Mscripts::functions -e "extract_resource('$conf/bacula-dir.conf', 'Job', 'NightlySave')" > $tmp/1
27 cat $tmp/1 | sed s/NightlySave/NightlySave4/ >> $conf/bacula-dir.conf
28 cat $tmp/1 | sed s/NightlySave/NightlySave5/ >> $conf/bacula-dir.conf
29 cat $tmp/1 | sed s/NightlySave/NightlySave6/ >> $conf/bacula-dir.conf
30 cat $tmp/1 | sed s/NightlySave/NightlySave7/ >> $conf/bacula-dir.conf
31 cat $tmp/1 | sed s/NightlySave/NightlySave8/ >> $conf/bacula-dir.conf
32 cat $tmp/1 | sed s/NightlySave/NightlySave9/ >> $conf/bacula-dir.conf
33 cat $tmp/1 | sed s/NightlySave/NightlySave10/ >> $conf/bacula-dir.conf
37 clientname=`awk '/Name = .*-fd/ { if (!ok) { print $3 ; ok=1 } }' bin/bacula-dir.conf`
39 when1=`perl -MPOSIX -e "print strftime('%F %T', localtime(time+30))"`
40 when2=`perl -MPOSIX -e "print strftime('%F %T', localtime(time+45))"`
42 # Catalog record for cleaning tape "CLN01" successfully created.
45 # Write out bconsole commands
46 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
49 @$out ${cwd}/tmp/log6.out
50 @#setdebug level=200 storage=LTO1
51 label barcodes pool=Scratch slots=41-60 storage=LTO3 drive=0
59 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
60 @$out ${cwd}/tmp/log1.out
61 setdebug trace=1 level=150 storage=LTO3
62 run storage=LTO3 when="$when1" job=NightlySave pool=Inc yes
63 run storage=LTO3 when="$when1" job=NightlySave2 pool=Inc yes
64 run storage=LTO3 when="$when1" job=NightlySave3 pool=Inc yes
65 run storage=LTO3 when="$when1" job=NightlySave4 pool=Inc yes
66 run storage=LTO3 when="$when1" job=NightlySave5 pool=Inc yes
67 run storage=LTO3 when="$when1" job=NightlySave6 pool=Full yes
68 run storage=LTO3 when="$when1" job=NightlySave7 pool=Full yes
69 run storage=LTO3 when="$when1" job=NightlySave8 pool=Full yes
70 run storage=LTO3 when="$when1" job=NightlySave9 pool=Full yes
71 run storage=LTO3 when="$when1" job=NightlySave10 pool=Full yes
74 @$out ${cwd}/tmp/log3.out
75 @#run storage=LTO3 when="$when1" job=NightlySave pool=Inc yes
76 @#run storage=LTO3 when="$when1" job=NightlySave2 pool=Inc yes
77 @#run storage=LTO3 when="$when1" job=NightlySave3 pool=Inc yes
78 @#run storage=LTO3 when="$when1" job=NightlySave4 pool=Inc yes
79 @#run storage=LTO3 when="$when1" job=NightlySave5 pool=Inc yes
80 @#run storage=LTO3 when="$when1" job=NightlySave6 pool=Full yes
81 @#run storage=LTO3 when="$when1" job=NightlySave7 pool=Full yes
82 @#run storage=LTO3 when="$when1" job=NightlySave8 pool=Full yes
83 @#run storage=LTO3 when="$when1" job=NightlySave9 pool=Full yes
84 @#run storage=LTO3 when="$when1" job=NightlySave10 pool=Full yes
91 check_for_zombie_jobs storage=LTO3 client=$clientname
93 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
94 setdebug trace=1 level=0 storage=LTO3
95 @$out ${cwd}/tmp/log2.out
99 restore client=$clientname fileset="Full Set" pool=Full where=${cwd}/tmp/bacula-restores select all done
106 check_for_zombie_jobs storage=LTO3 client=$clientname
113 # foreach Job, we store the drive and we count the total
114 # job number per drive
115 m/(\d+): Using Device "(.+?)"/
116 and $drive_info[$i++]="$1 $2" and $drive{$2}++;
120 foreach $k (sort keys %drive) {
121 if ($drive{$k} > 3) {
122 print "ERR $k has more than 3 jobs ($drive{$k})\n";
127 foreach $k (@drive_info) { print "$k\n"}
133 if [ $? -ne 0 ]; then
134 print_debug "ERR: Problem during log analysis"