]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/two-vol-manual-tape
6d38dd9928ad0f5af36e5f91dd9e6f63c5cf6cf6
[bacula/bacula] / regress / tests / two-vol-manual-tape
1 #!/bin/sh
2 #
3 # Run a job with a limited tape size so that the tape fills up.
4 #  Then manually unload the tape and load a new one, label
5 #  it.
6 #
7 TestName="two-vol-manual-tape"
8 JobName=twovolmanualtape
9 . scripts/functions
10
11 require_tape_drive
12 require_autochanger
13
14 scripts/cleanup
15 scripts/copy-tape-confs
16 echo "${cwd}/build" >${cwd}/tmp/file-list
17 MTX=$AUTOCHANGER_SCRIPT
18
19 # Sleep longer if real tape
20 if [ x${USE_VTAPE} = xyes ] ; then
21    sleep=20 
22 else
23    sleep=90
24 fi
25
26 slot=0
27 export slot
28
29 # TODO -- check this
30 init_slot $TAPE_DRIVE $SLOT1
31 init_slot $TAPE_DRIVE $SLOT2
32
33 # Get a tape from slot1
34 slot=`bin/$MTX ${AUTOCHANGER} loaded 0 ${TAPE_DRIVE} $DRIVE1`
35 case $slot in
36  0)
37     bin/$MTX ${AUTOCHANGER} load $SLOT1 ${TAPE_DRIVE} $DRIVE1
38     slot=$SLOT1
39     ;;
40  $SLOT1)
41     slot=$SLOT1
42     ;;
43  *)
44     rewind_drive ${TAPE_DRIVE}
45     bin/$MTX ${AUTOCHANGER} unload $slot  ${TAPE_DRIVE} $DRIVE1
46     bin/$MTX ${AUTOCHANGER} load   $SLOT1 ${TAPE_DRIVE} $DRIVE1
47     slot=$SLOT1
48     ;;
49 esac
50
51 init_drive ${TAPE_DRIVE}
52
53 change_jobname $JobName
54 start_test
55
56 # Label second volume
57 cat <<END_OF_DATA >tmp/bconcmds
58 @out /dev/null
59 messages
60 @$out tmp/log1.out
61 label storage=DDS-4 volume=TestVolume002 slot=0 pool=Default drive=0
62 unmount storage=DDS-4
63 END_OF_DATA
64
65 run_bacula
66
67 load_other_slot $slot
68 init_drive ${TAPE_DRIVE}
69
70 # label first volume, and run first half of job
71 cat <<END_OF_DATA >tmp/bconcmds
72 @$out tmp/log1.out
73 label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default drive=0
74 update Volume=TestVolume001 MaxVolBytes=500000 pool=Default drive=0
75 list volumes
76 setdebug level=150 storage=DDS-4
77 run job=$JobName yes
78 @# This sleep must be long enough for the first tape to fill (4MB)
79 @#  otherwise the following mtx-changer commands will fail
80 @sleep $sleep
81 list volumes
82 unmount storage=DDS-4
83 list volumes
84 status storage=DDS-4
85 messages
86 quit
87 END_OF_DATA
88
89 run_bconsole
90
91 load_other_slot $slot
92 init_drive ${TAPE_DRIVE}
93
94 cat <<END_OF_DATA >tmp/bconcmds
95 mount storage=DDS-4
96 @# backup should continue
97 wait
98 @# 
99 @# now do a restore
100 @#
101 @#restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
102 @#yes
103 wait
104 list volumes
105 messages
106 @$out
107 quit
108 END_OF_DATA
109
110 # run second half of backup + restore
111 run_bconsole
112
113 touch tmp/log2.out
114  
115 check_for_zombie_jobs storage=DDS-4
116 stop_bacula
117
118 check_two_logs
119 #check_restore_diff
120 dstat=0   # no diff
121 rstat=0   # no restore
122 end_test