3 # This script uses the virtual disk autochanger
5 TestName="multi-storage-test"
10 scripts/copy-2disk-confs
11 scripts/prepare-disk-changer
13 # create a new bacula-sd.confs
15 perl -ne "\$i='$i';\$tmp='$tmp';"'
16 if (/Name =/ ) { $_ =~ s/-sd/-$i-sd/}
17 if (/SDPort = /) { $_ =~ s/(\d+)/1810$i/}
18 if (/mediatype = /) { $_ =~ s/FileMedia/FileMedia$i/}
19 if (/WorkingDirectory/) { $_ =~ s:working:tmp/$i:}
20 if (/Pid Directory/) { $_ =~ s:working:tmp/$i:}
21 if (/(Archive|Changer) Device/) { $_ =~ s:$tmp:$tmp/$i:}
23 ' $conf/bacula-sd.conf > $conf/bacula-sd$i.conf
25 sed "s/bacula-sd.conf/bacula-sd${i}.conf/" $scripts/bacula-ctl-sd \
26 > $tmp/bacula-ctl-sd$i
27 chmod +x $tmp/bacula-ctl-sd$i
31 # Patch up bacula-dir.conf
33 if (/^Storage {/) { $in=1; $nb++; }
35 if (/SDPort = (\d+)/ && $in) {if ($nb == 2) { $_ = " SDPort = 18102\n"; }}
36 if (/SDPort = (\d+)/ && $in) {if ($nb == 3) { $_ = " SDPort = 18103\n"; }}
37 if (/SDPort = (\d+)/ && $in) {if ($nb == 4) { $_ = " SDPort = 18104\n"; }}
39 ' $conf/bacula-dir.conf > $tmp/1
40 cp $tmp/1 $conf/bacula-dir.conf
44 echo "${cwd}/build" >${cwd}/tmp/file-list
46 change_jobname $JobName
51 $tmp/bacula-ctl-sd$sd stop &> /dev/null
58 $tmp/bacula-ctl-sd$sd start &> /dev/null
61 # Write out bconsole commands
62 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
65 @$out ${cwd}/tmp/log1.out
66 label storage=tape volume=TestVolume001 Pool=Default slot=1 drive=0
67 label storage=File volume=TestVolume002 Pool=Default
68 label storage=File2 volume=File2-Vol001 Pool=Default
69 label storage=File3 volume=File3-Vol001 Pool=Default
70 label storage=File4 volume=File4-Vol001 Pool=Default
71 run job=$JobName storage=tape yes
74 @exec "touch $cwd/build/po/fr.po"
75 run job=$JobName storage=File yes
78 @exec "touch $cwd/build/po/de.po"
79 run job=$JobName storage=File2 yes
82 @exec "touch $cwd/build/po/it.po"
83 run job=$JobName storage=File3 yes
86 @exec "touch $cwd/build/po/es.po"
87 run job=$JobName storage=File4 yes
95 echo "ficheriro1.txt" >${cwd}/build/po/ficheriro1.txt
96 echo "ficheriro2.txt" >${cwd}/build/po/ficheriro2.txt
99 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
102 @$out ${cwd}/tmp/log1.out
103 @# Force Incremental on the second Volume
104 @exec "touch $cwd/build/po/fi.po"
105 run level=Incremental storage=File job=$JobName yes
108 @exec "touch $cwd/build/po/uk.po"
109 run level=Incremental storage=File2 job=$JobName yes
112 @exec "touch $cwd/build/po/sv.po $cwd/build/po/test.po"
113 run level=Incremental storage=File3 job=$JobName yes
116 @exec "touch $cwd/build/po/README"
117 run level=Incremental storage=File4 job=$JobName yes
123 @$out ${cwd}/tmp/log22.out
124 setdebug trace=1 level=110 client
125 setdebug trace=1 level=110 director
126 restore where=${cwd}/tmp/bacula-restores select all done yes
129 @$out ${cwd}/tmp/status.out
131 @exec "touch $cwd/build/po/POTFILES"
132 @$out ${cwd}/tmp/log1.out
133 run level=Incremental storage=File4 job=$JobName yes
136 @# run a job that will wait for a volume
137 @$out ${cwd}/tmp/log23.out
138 @exec "touch $cwd/build/po/ChangeLog"
139 run level=Incremental pool=Special storage=File3 job=$JobName yes
146 @# now do a restore with a backup that takes a drive
148 setdebug trace=1 level=110 client
149 setdebug trace=1 level=110 director
150 restore where=${cwd}/tmp/bacula-restores select all done yes
154 label storage=File3 volume=test3 pool=Special
160 select * FROM Storage;
161 select VolumeName, Name, StorageId, MediaType FROM Media JOIN Storage USING (StorageId);
168 check_for_zombie_jobs storage=File
169 check_for_zombie_jobs storage=File2
170 check_for_zombie_jobs storage=File3
171 check_for_zombie_jobs storage=File4
172 check_for_zombie_jobs storage=tape
176 $tmp/bacula-ctl-sd$sd stop &> /dev/null
179 # we have two restore to test
180 cp $tmp/log22.out $tmp/log2.out
182 cp $tmp/log23.out $tmp/log2.out