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