]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/multi-storage-test
Merge branch 'master' into basejobv3
[bacula/bacula] / regress / tests / multi-storage-test
1 #!/bin/sh
2 #
3 # This script uses the virtual disk autochanger
4 #
5 TestName="multi-storage-test"
6 JobName=backup
7 . scripts/functions
8
9 scripts/cleanup
10 scripts/copy-2disk-confs
11 scripts/prepare-disk-changer
12
13 # create a new bacula-sd.conf
14 perl -ne '
15 if (/SDPort = /) { $_ =~ s/(\d+)/1$1/;}
16 if (/Name = .+?-sd/) { $_ =~ s/-sd/-sd2/;}
17 if (/WorkingDirectory/) { $_ =~ s/"$/2"/; }
18 print;
19 ' $conf/bacula-sd.conf > $conf/bacula-sd2.conf
20
21 mkdir ${working}2
22
23 perl -ne '
24 if (/^Storage {/) { $in=1; $nb++; }
25 if (/^}/) { $in=0 }
26 if (/SDPort = (\d+)/ && $in) {if ($nb == 2) { $_ = "  SDPort = 1$1\n"; }}
27 print;
28 ' $conf/bacula-dir.conf > $tmp/1
29 cp $tmp/1 $conf/bacula-dir.conf
30
31
32 sed 's/bacula-sd.conf/bacula-sd2.conf/' $scripts/bacula-ctl-sd \
33     > $tmp/bacula-ctl-sd
34 chmod +x $tmp/bacula-ctl-sd
35
36 disable_pluguins
37
38 echo "${cwd}/build" >${cwd}/tmp/file-list
39
40 change_jobname $JobName
41 start_test
42
43 # Write out bconsole commands
44 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
45 @$out /dev/null
46 messages
47 @$out ${cwd}/tmp/log1.out
48 label storage=DDS-4 volume=TestVolume001 Pool=Default slot=1 drive=0
49 label storage=File  volume=TestVolume002 Pool=Default
50 run job=$JobName storage=DDS-4 yes
51 wait
52 messages
53 quit
54 END_OF_DATA
55
56 $tmp/bacula-ctl-sd start &> /dev/null
57 run_bacula
58
59 echo "ficheriro1.txt" >${cwd}/build/po/ficheriro1.txt
60 echo "ficheriro2.txt" >${cwd}/build/po/ficheriro2.txt
61
62
63 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
64 @$out /dev/null
65 messages
66 @$out ${cwd}/tmp/log1.out
67 @# Force Incremental on the second Volume
68 run level=Incremental storage=File job=$JobName yes
69 wait
70 messages
71 @# 
72 @# now do a restore
73 @#
74 @$out ${cwd}/tmp/log2.out
75 setdebug trace=1 level=110 client
76 setdebug trace=1 level=110 director
77 restore where=${cwd}/tmp/bacula-restores select all done yes
78 wait
79 messages
80 @$out
81 quit
82 END_OF_DATA
83
84 run_bconsole
85
86 check_for_zombie_jobs storage=File
87 check_for_zombie_jobs storage=DDS-4
88 stop_bacula
89 $tmp/bacula-ctl-sd stop &> /dev/null
90
91 check_two_logs
92 check_restore_diff
93
94 end_test