3 # See if Pool/Media attributes are correctly handled
5 TestName="pool-attributes-test"
13 # Zap out any schedule in default conf file so that
14 # it doesn't start during our test
17 echo "s% Schedule =%# Schedule =%g" >${outf}
18 cp $scripts/bacula-dir.conf $tmp/1
19 sed -f ${outf} $tmp/1 >$scripts/bacula-dir.conf
21 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'CacheRetention', '10', 'Pool', 'File')"
22 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'CacheRetention', '20', 'Pool', 'Default')"
24 change_jobname BackupClient1 $JobName
27 cat <<END_OF_DATA >$tmp/bconcmds
31 setdebug level=4 storage=File1
32 label volume=TestVolume001 storage=File1 pool=File slot=1 drive=0
33 label volume=TestVolume002 storage=File1 pool=Default slot=1 drive=0
35 llist volume=TestVolume001
37 llist volume=TestVolume002
43 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'CacheRetention', '30', 'Pool', 'File')"
44 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'CacheRetention', '40', 'Pool', 'Default')"
45 $bperl -e "add_attribute('$conf/bacula-sd.conf', 'AutoLabel', 'yes', 'Device')"
48 cat <<END_OF_DATA >$tmp/bconcmds
53 update allfrompool=File volume
54 update allfrompool=Default volume
56 llist volume=TestVolume001
58 llist volume=TestVolume002
60 @# Check volumes from Scratch
61 delete volume=TestVolume001 yes
62 update volume=TestVolume002 pool=Scratch cacheretention=0
67 llist volume=TestVolume001
69 llist volume=TestVolume002
70 @# Delete all volumes and check autolabel
72 delete volume=TestVolume002 yes
79 llist volume pool=File
87 check_cacheretention()
92 HAVE=`cat $FILE | tr 'A-Z' 'a-z' | awk '/cacheretention/ { print $2 }'`
93 if [ "$VAL" -ne "$HAVE" ]; then
94 print_debug "ERROR: Expect CacheRetention $VAL in $FILE, got $HAVE. $MSG"
99 check_cacheretention $tmp/01.log 10 "Check cacheretention with label command"
100 check_cacheretention $tmp/02.log 20 "Check cacheretention with label command"
101 check_cacheretention $tmp/11.log 30 "Check cacheretention with update frompool command"
102 check_cacheretention $tmp/22.log 40 "Check cacheretention with update frompool command"
103 check_cacheretention $tmp/32.log 30 "Check cacheretention that when we pull a volume from the scratch"
104 check_cacheretention $tmp/41.log 30 "Check cacheretention when we create a volume"
105 check_cacheretention $tmp/42.log 30 "Check cacheretention with pool= parameter"