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