3 # Copyright (C) 2000-2017 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
6 # Run a simple backup of the Bacula build directory
7 # to two tapes where the maximum tape file size is set to 1M
8 # Note, this test simulates the tape filling and writing to
9 # the next tape. One minor wrinkle: we create the two tapes
10 # in the Scratch pool, so they should be switched to the Default
12 # We set TestVolume001 to not in the changer, so the algorithm
13 # should find TestVolume002 and use it rather than blocking.
15 # Note we use the viritual disk autochanger
17 TestName="scratch-pool-test"
21 if test x${AUTOCHANGER} = x/dev/null ; then
22 echo "two-volume-test skipped. No autochanger."
27 scripts/copy-2disk-confs
28 scripts/prepare-disk-changer
30 echo "${cwd}/build" >${cwd}/tmp/file-list
32 outf="${cwd}/tmp/sed_tmp"
33 echo "s%# Maximum File Size% Maximum File Size%g" >${outf}
34 cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
35 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
37 change_jobname NightlySave $JobName
40 # Write out bconsole commands
41 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
44 @$out ${cwd}/tmp/log1.out
45 label storage=tape volume=TestVolume001 slot=1 pool=Scratch drive=0
46 label storage=tape volume=TestVolume002 slot=2 pool=Scratch drive=0
47 update Volume=TestVolume001 MaxVolBytes=2000000 pool=Scratch drive=0
48 update Volume=TestVolume001 inchanger=no pool=Scratch drive=0
49 @#setdebug level=200 storage=tape
50 llist volume=TestVolume001
51 llist volume=TestVolume002
56 llist volume=TestVolume001
60 @# Check if JobMedia OK (run under Aligned)
62 select jobid, mediaid, firstindex,lastindex,volindex from JobMedia order by jobid,volindex;
63 select * from JobMedia order by jobid,volindex;
65 @$out ${cwd}/tmp/log2.out
66 restore where=${cwd}/tmp/bacula-restores select all storage=tape done
74 check_for_zombie_jobs storage=tape