]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/two-vol-manual-tape
0eae8e2ed9ffdc68c26ff1eea01a42d3514efe36
[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-tape
15 scripts/copy-tape-confs
16 echo "${cwd}/build" >${cwd}/tmp/file-list
17
18 change_jobname $JobName
19 start_test
20
21 # Write out bconsole commands
22 cat <<END_OF_DATA >tmp/bconcmds
23 @out /dev/null
24 messages
25 @$out tmp/log1.out
26 label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default drive=0
27 update Volume=TestVolume001 MaxVolBytes=4000000 pool=Default drive=0
28 sql                               
29 select * from Storage;
30 select VolumeName,InChanger,StorageId from Media;
31
32 @#setdebug level=150 storage=DDS-4
33 run job=$JobName yes
34 @# This sleep must be long enough for the first tape to fill (4MB)
35 @#  otherwise the following mtx-changer commands will fail
36 @sleep 80
37 sql                               
38 select * from Storage;
39 select VolumeName,InChanger,StorageId from Media;
40
41 unmount storage=DDS-4
42 list volumes
43 status storage=DDS-4
44 messages
45 quit
46 END_OF_DATA
47
48 run_bacula
49
50 # load the other slot
51 mt -f ${TAPE_DRIVE} rewind
52 case $slot in
53  $SLOT1)
54     bin/mtx-changer ${AUTOCHANGER} unload $slot ${TAPE_DRIVE} $DRIVE1
55     bin/mtx-changer ${AUTOCHANGER} load $SLOT2 ${TAPE_DRIVE} $DRIVE1
56     ;;
57  $SLOT2)
58     bin/mtx-changer ${AUTOCHANGER} unload $slot ${TAPE_DRIVE} $DRIVE1
59     bin/mtx-changer ${AUTOCHANGER} load $SLOT1 ${TAPE_DRIVE} $DRIVE1
60     ;;
61  default)
62     echo "Something went wrong. Expected $SLOT1 or $SLOT2, got $slot"
63     exit 1
64 esac
65
66 mt -f ${TAPE_DRIVE} rewind
67 mt -f ${TAPE_DRIVE} weof
68
69 # second half of job -- write on next tape
70 cat <<END_OF_DATA >tmp/bconcmds
71 @$out tmp/log1.out
72 label storage=DDS-4 volume=TestVolume002 slot=0 pool=Default drive=0
73 mount storage=DDS-4
74 @# 
75 @# now do a restore
76 @#
77 @#restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
78 @#yes
79 wait
80 list volumes
81 messages
82 @$out
83 quit
84 END_OF_DATA
85
86 # run second half
87 run_bconsole
88
89 touch tmp/log2.out
90  
91 check_for_zombie_jobs storage=DDS-4
92 stop_bacula
93
94 check_two_logs
95 #check_restore_diff
96 dstat=0   # no diff
97 rstat=0   # no restore
98 end_test