]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/virtual-changer-test
Tweak virtual changer scripts
[bacula/bacula] / regress / tests / virtual-changer-test
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory. Create three
4 #   tapes, each in a different pool, then run two jobs both of which
5 #   want the disk that is not loaded.  Note, they both have     
6 #   prefers non-mounted tapes.  This should expose bug #801
7 #
8 #  This test the SD Virtual autochanger feature.  It is a disk based
9 #    "autochanger", but does not use any changer script.
10 #
11 TestName="virtual-changer-test"
12 JobName="virtualchangertest"
13 . scripts/functions
14
15 scripts/cleanup
16 scripts/copy-2disk-drive-confs
17 scripts/prepare-disk-changer
18
19 CLIENT=2drive2disk
20
21 echo "${cwd}/build" >${cwd}/tmp/file-list
22 #change_jobname Virtual $JobName
23 start_test
24
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
32
33 # Write out bconsole commands
34 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
35 @output /dev/null
36 messages
37 @$out ${cwd}/tmp/log1.out
38 setdebug level=200 storage=Virtual
39 @#setdebug level=200 client=$CLIENT 
40 label storage=Virtual volume=TestVolume001 slot=1 Pool=Default drive=0
41 label storage=Virtual volume=TestVolume002 slot=2 Pool=Full    drive=0
42 label storage=Virtual volume=TestVolume003 slot=3 Pool=Inc     drive=1
43 status storage=Virtual
44 run job=Virtual level=Full Pool=Default yes
45 run job=Virtual level=Full Pool=Default yes
46 run job=Virtual level=Full Pool=Default yes
47 run job=Virtual level=Full Pool=Default yes
48 run job=Virtual level=Full Pool=Default yes
49 @sleep 10
50 status storage=Virtual
51 list volumes
52 wait
53 list volumes
54 list jobs
55 status storage=Virtual
56 messages
57 quit
58 END_OF_DATA
59
60 # exit
61
62 run_bacula
63 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
64 @$out /dev/null
65 messages
66 @# 
67 @# now do a restore
68 @#
69 @$out ${cwd}/tmp/log2.out
70 restore where=${cwd}/tmp/bacula-restores select all storage=Virtual done
71 yes
72 wait
73 messages
74 @$out
75 quit
76 END_OF_DATA
77
78 run_bconsole
79
80 check_for_zombie_jobs storage=Virtual
81 stop_bacula
82
83 check_two_logs
84 check_restore_diff
85
86 end_test