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 (/SDPort = /) { $_ =~ s/(\d+)/1810$i/}
17 if (/Name = /) { $_ =~ s/FileStorage/FileStorage$i/}
18 if (/mediatype = /) { $_ =~ s/FileMedia/FileMedia$1/}
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
49 # Write out bconsole commands
50 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
53 @$out ${cwd}/tmp/log1.out
54 label storage=tape volume=TestVolume001 Pool=Default slot=1 drive=0
55 label storage=File volume=TestVolume002 Pool=Default
56 label storage=File2 volume=File2-Vol001 Pool=Default
57 label storage=File3 volume=File3-Vol001 Pool=Default
58 label storage=File4 volume=File4-Vol001 Pool=Default
59 run job=$JobName storage=tape yes
62 run job=$JobName storage=File yes
65 run job=$JobName storage=File2 yes
68 run job=$JobName storage=File3 yes
71 run job=$JobName storage=File4 yes
79 $tmp/bacula-ctl-sd$sd start &> /dev/null
84 echo "ficheriro1.txt" >${cwd}/build/po/ficheriro1.txt
85 echo "ficheriro2.txt" >${cwd}/build/po/ficheriro2.txt
88 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
91 @$out ${cwd}/tmp/log1.out
92 @# Force Incremental on the second Volume
93 run level=Incremental storage=File job=$JobName yes
96 run level=Incremental storage=File2 job=$JobName yes
99 run level=Incremental storage=File3 job=$JobName yes
102 run level=Incremental storage=File4 job=$JobName yes
108 @$out ${cwd}/tmp/log2.out
109 setdebug trace=1 level=110 client
110 setdebug trace=1 level=110 director
111 restore where=${cwd}/tmp/bacula-restores select all done yes
116 select * FROM Storage;
117 select VolumeName, Name, StorageId, MediaType FROM Media JOIN Storage USING (StorageId);
124 check_for_zombie_jobs storage=File
125 check_for_zombie_jobs storage=tape
129 $tmp/bacula-ctl-sd$sd stop &> /dev/null