3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
8 # Run a simple backup of the Bacula build directory. Create three
9 # tapes, each in a different pool, then run two jobs both of which
10 # want the disk that is not loaded. Note, they both have
11 # prefers non-mounted tapes. This should expose bug #801
13 # This test the SD Virtual autochanger feature. It is a disk based
14 # "autochanger", but does not use any changer script.
16 # Note, because we limit each drive to a maximum of 3 jobs,
17 # the first three start on Drive-0, and the second three start
18 # on drive-1 (Prefer Mounted Volumes = no). Thus since there
19 # is only one Volume (TestVolume001) that is valid, three jobs
20 # block and ask the user to create a new volume. However, at some
21 # point, the first three jobs finish and free up TestVolum001, and
22 # Since we set a poll interval of 15 seconds, after a short wait
23 # TestVolume001 will be mounted on drive-1 and the job will
24 # complete. This tests a good number of things.
26 TestName="virtual-changer-test"
27 JobName="virtualchangertest"
31 scripts/copy-2disk-drive-confs
32 scripts/prepare-disk-changer
36 echo "${cwd}/build" >${cwd}/tmp/file-list
37 #change_jobname Virtual $JobName
40 # Turn off Prefer Mounted Volumes so we use 2 drives
41 outf="${cwd}/tmp/sed_tmp"
42 echo "s%# Prefer Mounted Volumes% Prefer Mounted Volumes%g" >${outf}
43 cp ${cwd}/bin/bacula-dir.conf ${cwd}/tmp/1
44 # Comment the next line out to write everything to one drive
45 # otherwise, it writes the two jobs to different drives
46 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf
48 # Write out bconsole commands
49 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
52 @$out ${cwd}/tmp/log1.out
53 setdebug level=50 storage=Virtual
54 @#setdebug level=200 client=$CLIENT
55 label storage=Virtual volume=TestVolume001 slot=1 Pool=Default drive=0
56 label storage=Virtual volume=TestVolume002 slot=2 Pool=Full drive=0
57 label storage=Virtual volume=TestVolume003 slot=3 Pool=Inc drive=1
58 status storage=Virtual
59 run job=Virtual level=Full Pool=Default yes
60 run job=Virtual level=Full Pool=Default yes
61 run job=Virtual level=Full Pool=Default yes
62 run job=Virtual level=Full Pool=Default yes
63 run job=Virtual level=Full Pool=Default yes
65 status storage=Virtual
70 status storage=Virtual
78 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
84 @$out ${cwd}/tmp/log2.out
85 restore where=${cwd}/tmp/bacula-restores select all storage=Virtual done
94 check_for_zombie_jobs storage=Virtual