3 # This script will test next vol algo with
6 # TODO: Test Pool with RecyclePool
7 # Test Pool without RecyclePool
8 # Test with enabled=false
14 TestName="next-vol-test"
19 scripts/copy-tape-confs
20 cp scripts/bacula-dir-vtape.conf bin/bacula-dir.conf
21 cp scripts/bacula-sd-vtape.conf bin/bacula-sd.conf
22 scripts/prepare-fake-autochanger
27 cat <<EOF > ${cwd}/tmp/bconcmds
28 @$out ${cwd}/tmp/log.out
29 label barcodes storage=LTO3 slots=46-59 drive=0 pool=Scratch
31 update volume=vol47 pool=Test inchanger=no RecyclePool=Test
32 update volume=vol59 pool=Test enabled=no
33 update volume=vol58 pool=Test volstatus=Recycle
35 update volume=vol56 pool=Test
36 update volume=vol55 pool=Test volstatus=Full volretention=15
37 update volume=vol46 volstatus=Full volretention=15
39 update volume=vol46 pool=Test
40 update volume=vol54 volstatus=Recycle
42 update volume=vol52 MaxVolJobs=1
43 update volume=vol51 inchanger=no volstatus=Recycle
45 update volume=vol50 inchanger=no
46 update volume=vol49 inchanger=no
47 update volume=vol48 inchanger=no pool=Test
48 update volume AllFromPool=Test
50 update Media SET VolJobs=1 WHERE VolumeName='vol52';
51 update Media SET LastWritten='2006-01-01 01:00:00';
52 update Media SET LastWritten='2006-01-01 01:00:01' WHERE VolumeName='vol57';
53 update Media SET LastWritten='2006-01-01 01:00:02' WHERE VolumeName='vol53';
59 echo $PWD/build/po > tmp/file-list
61 cat <<EOF > ${cwd}/tmp/bconcmds
62 @$out ${cwd}/tmp/log2.out
64 @# Pool + Append + Enabled + InChanger
65 run level=full pool=Test NightlySave yes
70 @# Pool + Recycled + Enabled + InChanger
71 run level=full pool=Test NightlySave yes
76 @# Pool + Purged + Enabled + InChanger
77 run level=full pool=Test NightlySave yes
82 @# Pool + Full + Recycle + Enabled + InChanger
83 run level=full pool=Test NightlySave yes
88 @# No more in Test pool, get from scratch
89 @# vol52 is Append, but have 1 job and MaxJob
90 @# Scratch + Recycle + Enabled + InChanger
91 run level=full pool=Test NightlySave yes
96 @# Scratch + Purged + Enabled + InChanger + LastW
97 run level=full pool=Test NightlySave yes
102 @# Scratch + Purged + Enabled + InChanger + LastW
103 run level=full pool=Test NightlySave yes
108 @# Scratch + Purged + Enabled + InChanger + LastW
109 run level=full pool=Test NightlySave yes
113 restore fileset="Full Set" pool=Test where=${cwd}/tmp/bacula-restores select all done
120 @#run level=full pool=Test NightlySave yes
128 awk '/Must choose/ { print $4 } ' tmp/log2.out > tmp/normal
129 awk '/Volume name.+:/ { print $3 } ' tmp/log2.out > tmp/real
130 if test "$debug" -eq 1; then
131 diff -ur tmp/normal tmp/real
133 diff tmp/normal tmp/real > /dev/null
137 # try to break the old code
138 # in this situation, we have 1 available volume (vol50) and bacula will try to use
139 # vol47, vol48 and vol49 and will stop without using vol50.
142 cat <<EOF > ${cwd}/tmp/bconcmds
143 @$out ${cwd}/tmp/log1.out
144 update volume=vol47 pool=Test VolStatus=Used VolRetention=10s inchanger=no RecyclePool=Test
145 update volume=vol48 pool=Test VolStatus=Used VolRetention=10s inchanger=no RecyclePool=Test
146 update volume=vol49 pool=Test VolStatus=Used VolRetention=10s inchanger=no RecyclePool=Test
147 update volume=vol50 pool=Test VolStatus=Used VolRetention=10s inchanger=yes RecyclePool=Test
149 update Media SET LastWritten='2005-01-01 01:00:00' WHERE VolumeName IN ('vol47', 'vol48', 'vol49');
152 run level=full pool=Test NightlySave yes
160 check_for_zombie_jobs storage=LTO3
163 grep "Invalid slot=0 defined in catalog for Volume" tmp/log1.out > /dev/null
164 if [ $? -ne 0 ]; then