3 # Copyright (C) 2000-2017 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
6 # See if Pool/Media attributes are correctly handled
8 TestName="pool-attributes-test"
16 # Zap out any schedule in default conf file so that
17 # it doesn't start during our test
20 echo "s% Schedule =%# Schedule =%g" >${outf}
21 cp $scripts/bacula-dir.conf $tmp/1
22 sed -f ${outf} $tmp/1 >$scripts/bacula-dir.conf
24 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'CacheRetention', '10', 'Pool', 'File')"
25 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'CacheRetention', '20', 'Pool', 'Default')"
27 change_jobname BackupClient1 $JobName
30 cat <<END_OF_DATA >$tmp/bconcmds
34 setdebug level=4 storage=File1
35 label volume=TestVolume001 storage=File1 pool=File slot=1 drive=0
36 label volume=TestVolume002 storage=File1 pool=Default slot=1 drive=0
38 llist volume=TestVolume001
40 llist volume=TestVolume002
46 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'CacheRetention', '30', 'Pool', 'File')"
47 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'CacheRetention', '40', 'Pool', 'Default')"
48 $bperl -e "add_attribute('$conf/bacula-sd.conf', 'AutoLabel', 'yes', 'Device')"
51 cat <<END_OF_DATA >$tmp/bconcmds
56 update allfrompool=File volume
57 update allfrompool=Default volume
59 llist volume=TestVolume001
61 llist volume=TestVolume002
63 @# Check volumes from Scratch
64 delete volume=TestVolume001 yes
65 update volume=TestVolume002 pool=Scratch cacheretention=0
70 llist volume=TestVolume001
72 llist volume=TestVolume002
73 @# Delete all volumes and check autolabel
75 delete volume=TestVolume002 yes
82 llist volume pool=File
90 check_cacheretention()
95 HAVE=`cat $FILE | tr 'A-Z' 'a-z' | awk '/cacheretention/ { print $2 }'`
96 if [ "$VAL" -ne "$HAVE" ]; then
97 print_debug "ERROR: Expect CacheRetention $VAL in $FILE, got $HAVE. $MSG"
102 check_cacheretention $tmp/01.log 10 "Check cacheretention with label command"
103 check_cacheretention $tmp/02.log 20 "Check cacheretention with label command"
104 check_cacheretention $tmp/11.log 30 "Check cacheretention with update frompool command"
105 check_cacheretention $tmp/22.log 40 "Check cacheretention with update frompool command"
106 check_cacheretention $tmp/32.log 30 "Check cacheretention that when we pull a volume from the scratch"
107 check_cacheretention $tmp/41.log 30 "Check cacheretention when we create a volume"
108 check_cacheretention $tmp/42.log 30 "Check cacheretention with pool= parameter"