3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
8 # This script uses the virtual disk autochanger
10 TestName="multi-storage-test"
14 export REGRESS_CHECK_CORRUPTION=no
17 scripts/copy-2disk-confs
18 scripts/prepare-disk-changer
20 # create a new bacula-sd.confs
22 perl -ne "\$i='$i';\$tmp='$tmp';"'
23 if (/Name =/ ) { $_ =~ s/-sd/-$i-sd/}
24 if (/SDPort = /) { $_ =~ s/(\d+)/1810$i/}
25 if (/mediatype = /) { $_ =~ s/FileMedia/FileMedia$i/}
26 if (/WorkingDirectory/) { $_ =~ s:working:tmp/$i:}
27 if (/Pid Directory/) { $_ =~ s:working:tmp/$i:}
28 if (/(Archive|Changer) Device/) { $_ =~ s:$tmp:$tmp/$i:}
30 ' $conf/bacula-sd.conf > $conf/bacula-sd$i.conf
32 sed "s/bacula-sd.conf/bacula-sd${i}.conf/" $scripts/bacula-ctl-sd \
33 > $tmp/bacula-ctl-sd$i
34 chmod +x $tmp/bacula-ctl-sd$i
38 # Patch up bacula-dir.conf
40 if (/^Storage {/) { $in=1; $nb++; }
42 if (/SDPort = (\d+)/ && $in) {if ($nb == 2) { $_ = " SDPort = 18102\n"; }}
43 if (/SDPort = (\d+)/ && $in) {if ($nb == 3) { $_ = " SDPort = 18103\n"; }}
44 if (/SDPort = (\d+)/ && $in) {if ($nb == 4) { $_ = " SDPort = 18104\n"; }}
46 ' $conf/bacula-dir.conf > $tmp/1
47 cp $tmp/1 $conf/bacula-dir.conf
51 echo "${cwd}/build" >${cwd}/tmp/file-list
53 change_jobname $JobName
58 $tmp/bacula-ctl-sd$sd stop &> /dev/null
65 $tmp/bacula-ctl-sd$sd start &> /dev/null
68 # Write out bconsole commands
69 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
72 @$out ${cwd}/tmp/log1.out
73 label storage=tape volume=TestVolume001 Pool=Default slot=1 drive=0
74 label storage=File volume=TestVolume002 Pool=Default
75 label storage=File2 volume=File2-Vol001 Pool=Default
76 label storage=File3 volume=File3-Vol001 Pool=Default
77 label storage=File4 volume=File4-Vol001 Pool=Default
78 run job=$JobName storage=tape yes
81 @exec "touch $cwd/build/po/fr.po"
82 run job=$JobName storage=File yes
85 @exec "touch $cwd/build/po/de.po"
86 run job=$JobName storage=File2 yes
89 @exec "touch $cwd/build/po/it.po"
90 run job=$JobName storage=File3 yes
93 @exec "touch $cwd/build/po/es.po"
94 run job=$JobName storage=File4 yes
102 echo "ficheriro1.txt" >${cwd}/build/po/ficheriro1.txt
103 echo "ficheriro2.txt" >${cwd}/build/po/ficheriro2.txt
106 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
109 @$out ${cwd}/tmp/log1.out
110 @# Force Incremental on the second Volume
111 @exec "touch $cwd/build/po/fi.po"
112 run level=Incremental storage=File job=$JobName yes
115 @exec "touch $cwd/build/po/uk.po"
116 run level=Incremental storage=File2 job=$JobName yes
119 @exec "touch $cwd/build/po/sv.po $cwd/build/po/test.po"
120 run level=Incremental storage=File3 job=$JobName yes
123 @exec "touch $cwd/build/po/README"
124 run level=Incremental storage=File4 job=$JobName yes
130 @$out ${cwd}/tmp/log22.out
131 setdebug trace=1 level=110 client
132 setdebug trace=1 level=110 director
133 restore where=${cwd}/tmp/bacula-restores select all done yes
136 @$out ${cwd}/tmp/status.out
138 @exec "touch $cwd/build/po/POTFILES"
139 @$out ${cwd}/tmp/log1.out
140 run level=Incremental storage=File4 job=$JobName yes
143 @# run a job that will wait for a volume
144 @$out ${cwd}/tmp/log23.out
145 @exec "touch $cwd/build/po/ChangeLog"
146 run level=Incremental pool=Special storage=File3 job=$JobName yes
153 @# now do a restore with a backup that takes a drive
155 setdebug trace=1 level=110 client
156 setdebug trace=1 level=110 director
157 restore where=${cwd}/tmp/bacula-restores1 select all done yes
161 label storage=File3 volume=test3 pool=Special
167 select * FROM Storage;
168 select VolumeName, Name, StorageId, MediaType FROM Media JOIN Storage USING (StorageId);
170 @$out ${cwd}/tmp/log24.out
171 restore where=${cwd}/tmp/bacula-restores select all done yes
179 check_for_zombie_jobs storage=File
180 check_for_zombie_jobs storage=File2
181 check_for_zombie_jobs storage=File3
182 check_for_zombie_jobs storage=File4
183 check_for_zombie_jobs storage=tape
187 $tmp/bacula-ctl-sd$sd stop &> /dev/null
190 # we have two restore to test
191 cp $tmp/log22.out $tmp/log2.out
193 cp $tmp/log23.out $tmp/log2.out
195 cp $tmp/log24.out $tmp/log2.out