]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/vtape-round-robin-changer
Big backport from Enterprise
[bacula/bacula] / regress / tests / vtape-round-robin-changer
1 #!/bin/sh
2 #
3 # Run backups with dummy tape driver
4 # This test setups an Autochanger with 80 slots
5 # and 5 drives (3 LTO3 and 2 LTO1)
6 #
7 # TAPE_DRIVE="$cwd/working/ach/drive0"
8 # TAPE_DRIVE1="$cwd/working/ach/drive0"
9 # AUTOCHANGER="$cwd/working/ach/conf"
10 # USE_VTAPE=yes
11 # AUTOCHANGER_SCRIPT=disk-changer
12
13
14 TestName="vtape-round-robin-changer"
15 JobName=backup
16 . scripts/functions
17
18 require_vtape
19
20 scripts/cleanup
21 scripts/copy-tape-confs
22 cp $rscripts/bacula-dir-vtape.conf $conf/bacula-dir.conf
23 cp $rscripts/bacula-sd-vtape.conf $conf/bacula-sd.conf
24 scripts/prepare-fake-autochanger
25
26 echo "${cwd}/build" >${cwd}/tmp/file-list
27
28 start_test
29
30 clientname=`awk '/Name = .*-fd/ { if (!ok) { print $3 ; ok=1 } }' bin/bacula-dir.conf`
31
32 # Catalog record for cleaning tape "CLN01" successfully created.
33 # CLN01      | Cleaning
34
35 # Write out bconsole commands
36 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
37 @$out /dev/null
38 messages
39 @$out ${cwd}/tmp/log6.out
40 @#setdebug level=200 storage=LTO1
41 label barcodes pool=Scratch slots=1-40 storage=LTO3 drive=0
42 yes
43 messages
44 list volumes
45 END_OF_DATA
46
47 run_bacula
48
49 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
50 @$out $tmp/log1.out
51 run storage=LTO3 job=NightlySave spooldata=no pool=Inc  yes
52 wait
53 messages
54 @sleep 3
55 @$out $tmp/log3.out
56 @#setdebug level=150 Storage=LTO3
57 run storage=LTO3 job=NightlySave spooldata=no level=full pool=Inc  yes
58 wait
59 setdebug level=0 Storage=LTO3
60 messages
61 quit
62 END_OF_DATA
63
64 run_bconsole
65
66 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
67 @$out $tmp/log2.out  
68 @# 
69 @# now do a restore
70 @#
71 restore client=$clientname fileset="Full Set" pool=Inc where=${cwd}/tmp/bacula-restores select all done
72 yes
73 wait
74 messages
75 wait
76 messages
77 END_OF_DATA
78
79 run_bconsole
80
81 stop_bacula
82
83 check_two_logs
84 check_restore_diff
85
86 # Get the first slot used
87 s=`awk '/Issuing autochanger/ { print $13;exit }' $tmp/log3.out`
88
89 # count how many times we unload this volume
90 # Note the second job output is in log3.out
91 nb=`grep "unload .* Slot $s" $tmp/log3.out | wc -l`
92 if [ $nb -gt 1 ]; then
93     estat=1
94     print_debug "ERROR: Found $nb 'unload slot $s' instead of 1 for the second job in $tmp/log3.out"
95 fi
96
97 end_test