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
52 $tmp/bacula-ctl-sd$sd start &> /dev/null
56 # Write out bconsole commands
57 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
60 @$out ${cwd}/tmp/log1.out
61 label storage=tape volume=TestVolume001 Pool=Default slot=1 drive=0
62 label storage=File volume=TestVolume002 Pool=Default
63 label storage=File2 volume=File2-Vol001 Pool=Default
64 label storage=File3 volume=File3-Vol001 Pool=Default
65 label storage=File4 volume=File4-Vol001 Pool=Default
66 run job=$JobName storage=tape yes
69 @exec "touch $cwd/build/po/fr.po"
70 run job=$JobName storage=File yes
73 @exec "touch $cwd/build/po/de.po"
74 run job=$JobName storage=File2 yes
77 @exec "touch $cwd/build/po/it.po"
78 run job=$JobName storage=File3 yes
81 @exec "touch $cwd/build/po/es.po"
82 run job=$JobName storage=File4 yes
90 echo "ficheriro1.txt" >${cwd}/build/po/ficheriro1.txt
91 echo "ficheriro2.txt" >${cwd}/build/po/ficheriro2.txt
94 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
97 @$out ${cwd}/tmp/log1.out
98 @# Force Incremental on the second Volume
99 @exec "touch $cwd/build/po/fi.po"
100 run level=Incremental storage=File job=$JobName yes
103 @exec "touch $cwd/build/po/uk.po"
104 run level=Incremental storage=File2 job=$JobName yes
107 @exec "touch $cwd/build/po/sv.po"
108 run level=Incremental storage=File3 job=$JobName yes
111 @exec "touch $cwd/build/po/README"
112 run level=Incremental storage=File4 job=$JobName yes
118 @$out ${cwd}/tmp/log2.out
119 setdebug trace=1 level=110 client
120 setdebug trace=1 level=110 director
121 restore where=${cwd}/tmp/bacula-restores select all done yes
124 @$out ${cwd}/tmp/status.out
126 @exec "touch $cwd/build/po/POTFILES"
127 @$out ${cwd}/tmp/log1.out
128 run level=Incremental storage=File4 job=$JobName yes
133 select * FROM Storage;
134 select VolumeName, Name, StorageId, MediaType FROM Media JOIN Storage USING (StorageId);
141 check_for_zombie_jobs storage=File
142 check_for_zombie_jobs storage=tape
146 $tmp/bacula-ctl-sd$sd stop &> /dev/null