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 = .+?-sd/) { $_ =~ s/-sd/-sd$i/}
18 if (/WorkingDirectory/) { $_ =~ s:working:tmp/$i:}
19 if (/Pid Directory/) { $_ =~ s:working:tmp/$i:}
20 if (/(Archive|Changer) Device/) { $_ =~ s:$tmp:$tmp/$i:}
22 ' $conf/bacula-sd.conf > $conf/bacula-sd$i.conf
24 sed "s/bacula-sd.conf/bacula-sd${i}.conf/" $scripts/bacula-ctl-sd \
25 > $tmp/bacula-ctl-sd$i
26 chmod +x $tmp/bacula-ctl-sd$i
30 # Patch up bacula-dir.conf
32 if (/^Storage {/) { $in=1; $nb++; }
34 if (/SDPort = (\d+)/ && $in) {if ($nb == 2) { $_ = " SDPort = 18102\n"; }}
35 if (/SDPort = (\d+)/ && $in) {if ($nb == 3) { $_ = " SDPort = 18103\n"; }}
36 if (/SDPort = (\d+)/ && $in) {if ($nb == 4) { $_ = " SDPort = 18104\n"; }}
38 ' $conf/bacula-dir.conf > $tmp/1
39 cp $tmp/1 $conf/bacula-dir.conf
43 echo "${cwd}/build" >${cwd}/tmp/file-list
45 change_jobname $JobName
48 # Write out bconsole commands
49 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
52 @$out ${cwd}/tmp/log1.out
53 label storage=tape volume=TestVolume001 Pool=Default slot=1 drive=0
54 label storage=File volume=TestVolume002 Pool=Default
55 run job=$JobName storage=tape yes
63 $tmp/bacula-ctl-sd$sd start &> /dev/null
68 echo "ficheriro1.txt" >${cwd}/build/po/ficheriro1.txt
69 echo "ficheriro2.txt" >${cwd}/build/po/ficheriro2.txt
72 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
75 @$out ${cwd}/tmp/log1.out
76 @# Force Incremental on the second Volume
77 run level=Incremental storage=File job=$JobName yes
83 @$out ${cwd}/tmp/log2.out
84 setdebug trace=1 level=110 client
85 setdebug trace=1 level=110 director
86 restore where=${cwd}/tmp/bacula-restores select all done yes
91 select * FROM Storage;
92 select VolumeName, Name, StorageId, MediaType FROM Media JOIN Storage USING (StorageId);
99 check_for_zombie_jobs storage=File
100 check_for_zombie_jobs storage=tape
104 $tmp/bacula-ctl-sd$sd stop &> /dev/null