3 # Set prefer mounted volumes to no to try to force use of
6 # This script uses the virtual disk autochanger and two drives
8 # It tests starting job 1, which will not complete because FD is
9 # offline, then starting job 2, which wants to swap the volume.
11 TestName="2drive-offline"
12 JobName="2driveoffline"
16 scripts/copy-2client-confs
17 scripts/prepare-disk-changer
20 change_jobname NightlySave $JobName
23 echo "${cwd}/build" >${cwd}/tmp/file-list
25 # Turn off Prefer Mounted Volumes so we use 2 drives
26 outf="${cwd}/tmp/sed_tmp"
27 echo "s%# Prefer Mounted Volumes% Prefer Mounted Volumes%g" >${outf}
28 cp ${cwd}/bin/bacula-dir.conf ${cwd}/tmp/1
29 # Comment the next line out to write everything to one drive
30 # otherwise, it writes the two jobs to different drives
31 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf
33 # One FD is not reachable, try to speed up the test
34 $bperl -e 'add_attribute("$conf/bacula-dir.conf", "FdConnectTimeout", "10", "Director")'
36 # Write out bconsole commands
37 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
40 @$out ${cwd}/tmp/log1.out
41 label storage=tape volume=TestVolume001 slot=2 Pool=Default drive=0
42 label storage=tape volume=TestVolume002 slot=1 Pool=Default drive=1
44 @#setdebug level=120 storage=tape
45 run job=Offline comment="This job will fail, the client is not here" level=Full yes
47 run job=$JobName spooldata=no level=Full yes
53 @$out ${cwd}/tmp/log3.out
54 @# TODO: We see that one volume is still reserved while the job is not here
61 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
66 @$out ${cwd}/tmp/log2.out
67 @#unmount storage=tape drive=0
68 @#unmount storage=tape drive=1
69 @#mount storage=tape slot=1 drive=0
70 @#mount storage=tape slot=2 drive=1
71 restore where=${cwd}/tmp/bacula-restores client=$HOST-fd select all storage=tape done
79 check_for_zombie_jobs storage=tape client=$HOST-fd
82 grep 'Reserved volume: TestVolume002 on File device "Drive-0"' $tmp/log1.out
84 print_debug "ERROR: TestVolume001 should be used on Drive-0, not TestVolume002"
88 grep 'Reserved volume: TestVolume001 on File device "Drive-1"' $tmp/log1.out
90 print_debug "ERROR: TestVolume002 should be used on Drive-1, not TestVolume001"
94 grep 'No Jobs running.' $tmp/log3.out > /dev/null
96 grep 'Reserved volume: TestVolume001 on File device "Drive-0"' $tmp/log3.out
98 print_debug "WARNING: TestVolume001 is still reserved on Drive-0 in $tmp/log3.out"