]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/multi2-storage-test
Tweak multi-storage-test
[bacula/bacula] / regress / tests / multi2-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.confs
14 for sd in 2 3 4; do
15   perl -ne '
16   if (/SDPort = /) { $_ =~ s/(\d+)/1810$sd/;}
17   if (/Name = .+?-sd/) { $_ =~ s/-sd/-sd$sd/;}
18   if (/WorkingDirectory/) { $_ =~ s/"$/$sd"/; }
19   if (/Pid Directory/) { $_ =~ s/"$/$sd"/; }
20   print;
21   ' $conf/bacula-sd.conf > $conf/bacula-sd$sd.conf
22   mkdir -p ${working}$sd
23   sed 's/bacula-sd.conf/bacula-sd$sd.conf/' $scripts/bacula-ctl-sd \
24       > $tmp/bacula-ctl-sd$sd
25   chmod +x $tmp/bacula-ctl-sd$sd
26 done
27
28 # Patch up bacula-dir.conf
29 perl -ne '
30 if (/^Storage {/) { $in=1; $nb++; }
31 if (/^}/) { $in=0 }
32 if (/SDPort = (\d+)/ && $in) {if ($nb == 2) { $_ = "  SDPort = 18102\n"; }}
33 if (/SDPort = (\d+)/ && $in) {if ($nb == 3) { $_ = "  SDPort = 18103\n"; }}
34 if (/SDPort = (\d+)/ && $in) {if ($nb == 4) { $_ = "  SDPort = 18104\n"; }}
35 print;
36 ' $conf/bacula-dir.conf > $tmp/1
37 cp $tmp/1 $conf/bacula-dir.conf
38
39 disable_pluguins
40
41 echo "${cwd}/build" >${cwd}/tmp/file-list
42
43 change_jobname $JobName
44 start_test
45
46 # Write out bconsole commands
47 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
48 @$out /dev/null
49 messages
50 @$out ${cwd}/tmp/log1.out
51 label storage=tape volume=TestVolume001 Pool=Default slot=1 drive=0
52 label storage=File  volume=TestVolume002 Pool=Default
53 run job=$JobName storage=tape yes
54 wait
55 messages
56 quit
57 END_OF_DATA
58
59 # Start SDs
60 for sd in 2 3 4; do
61   $tmp/bacula-ctl-sd$sd start &> /dev/null
62 done
63
64 run_bacula
65
66 echo "ficheriro1.txt" >${cwd}/build/po/ficheriro1.txt
67 echo "ficheriro2.txt" >${cwd}/build/po/ficheriro2.txt
68
69
70 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
71 @$out /dev/null
72 messages
73 @$out ${cwd}/tmp/log1.out
74 @# Force Incremental on the second Volume
75 run level=Incremental storage=File job=$JobName yes
76 wait
77 messages
78 @# 
79 @# now do a restore
80 @#
81 @$out ${cwd}/tmp/log2.out
82 setdebug trace=1 level=110 client
83 setdebug trace=1 level=110 director
84 restore where=${cwd}/tmp/bacula-restores select all done yes
85 wait
86 messages
87 sql
88 select * in Storage;
89
90
91 quit
92 END_OF_DATA
93
94 run_bconsole
95
96 check_for_zombie_jobs storage=File
97 check_for_zombie_jobs storage=tape
98
99 stop_bacula
100 for sd in 2 3 4; do
101   $tmp/bacula-ctl-sd$sd stop &> /dev/null
102 done
103
104 check_two_logs
105 check_restore_diff
106
107 end_test