3 # Copyright (C) 2000-2017 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
6 # Run backups with dummy tape driver
7 # This test setups an Autochanger with 80 slots
8 # and 5 drives (3 LTO3 and 2 LTO1)
10 # TAPE_DRIVE="$cwd/working/ach/drive0"
11 # TAPE_DRIVE1="$cwd/working/ach/drive0"
12 # AUTOCHANGER="$cwd/working/ach/conf"
14 # AUTOCHANGER_SCRIPT=disk-changer
17 TestName="vtape-round-robin-changer"
24 scripts/copy-tape-confs
25 cp $rscripts/bacula-dir-vtape.conf $conf/bacula-dir.conf
26 cp $rscripts/bacula-sd-vtape.conf $conf/bacula-sd.conf
27 scripts/prepare-fake-autochanger
29 echo "${cwd}/build" >${cwd}/tmp/file-list
33 clientname=`awk '/Name = .*-fd/ { if (!ok) { print $3 ; ok=1 } }' bin/bacula-dir.conf`
35 # Catalog record for cleaning tape "CLN01" successfully created.
38 # Write out bconsole commands
39 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
42 @$out ${cwd}/tmp/log6.out
43 @#setdebug level=200 storage=LTO1
44 label barcodes pool=Scratch slots=1-40 storage=LTO3 drive=0
52 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
54 run storage=LTO3 job=NightlySave spooldata=no pool=Inc yes
59 @#setdebug level=150 Storage=LTO3
60 run storage=LTO3 job=NightlySave spooldata=no level=full pool=Inc yes
62 setdebug level=0 Storage=LTO3
69 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
74 restore client=$clientname fileset="Full Set" pool=Inc where=${cwd}/tmp/bacula-restores select all done
89 # Get the first slot used
90 s=`awk '/Issuing autochanger/ { print $13;exit }' $tmp/log3.out`
92 # count how many times we unload this volume
93 # Note the second job output is in log3.out
94 nb=`grep "unload .* Slot $s" $tmp/log3.out | wc -l`
95 if [ $nb -gt 1 ]; then
97 print_debug "ERROR: Found $nb 'unload slot $s' instead of 1 for the second job in $tmp/log3.out"