]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/virtual-changer-test
Merge branch 'master' of ssh://bacula.git.sourceforge.net/gitroot/bacula
[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 # This script uses the Virtual disk autochanger and two drives
12 #
13 TestName="virtual-changer-disk"
14 JobName="virtualchangerdisk"
15 . scripts/functions
16
17 scripts/cleanup
18 scripts/copy-2disk-drive-confs
19 scripts/prepare-disk-changer
20
21 CLIENT=2drive2disk
22
23 echo "${cwd}/build" >${cwd}/tmp/file-list
24 #change_jobname Virtual $JobName
25 start_test
26
27 # Turn off Prefer Mounted Volumes so we use 2 drives
28 outf="${cwd}/tmp/sed_tmp"
29 echo "s%# Prefer Mounted Volumes%  Prefer Mounted Volumes%g" >${outf}
30 cp ${cwd}/bin/bacula-dir.conf ${cwd}/tmp/1
31 # Comment the next line out to write everything to one drive
32 #  otherwise, it writes the two jobs to different drives
33 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf
34
35 # Write out bconsole commands
36 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
37 @output /dev/null
38 messages
39 @$out ${cwd}/tmp/log1.out
40 setdebug level=200 storage=Virtual
41 @#setdebug level=200 client=$CLIENT 
42 label storage=Virtual volume=TestVolume001 slot=1 Pool=Default drive=0
43 label storage=Virtual volume=TestVolume002 slot=2 Pool=Full    drive=0
44 label storage=Virtual volume=TestVolume003 slot=3 Pool=Inc     drive=1
45 status storage=Virtual
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 run job=Virtual level=Full Pool=Default yes
50 run job=Virtual level=Full Pool=Default yes
51 @sleep 10
52 status storage=Virtual
53 list volumes
54 wait
55 list volumes
56 list jobs
57 status storage=Virtual
58 messages
59 quit
60 END_OF_DATA
61
62 # exit
63
64 run_bacula
65 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
66 @$out /dev/null
67 messages
68 @# 
69 @# now do a restore
70 @#
71 @$out ${cwd}/tmp/log2.out
72 restore where=${cwd}/tmp/bacula-restores select all storage=Virtual done
73 yes
74 wait
75 messages
76 @$out
77 quit
78 END_OF_DATA
79
80 run_bconsole
81
82 check_for_zombie_jobs storage=Virtual
83 stop_bacula
84
85 check_two_logs
86 check_restore_diff
87
88 end_test