1#!/bin/sh
2#
3# Run a simple backup . Create three
4#   tapes, each in a different pool, then run two jobs both of which
5#   want the tape that is not loaded.  Note, they both have
6#   prefers non-mounted tapes.  This should expose bug #801
7#
8# This script uses the virtual disk autochanger and two drives
9#
10TestName="three-pool-disk"
11JobName="threepooldisk"
12. scripts/functions
13
14scripts/cleanup
15scripts/copy-2disk-drive-confs
16scripts/prepare-disk-changer
17CLIENT=2drive2disk
18
19
20# Directory to backup.
21# This directory will be created by setup_data().
22BackupDirectory="${tmp}/data"
23
24# Use a tgz to setup data to be backuped.
25# Data will be placed at "${tmp}/data/".
26setup_data data/small.tgz
27
28# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list".
29echo "${BackupDirectory}" >${tmp}/file-list
30
31
32change_jobname NightlySave $JobName
33start_test
34
35# Turn off Prefer Mounted Volumes so we use 2 drives
36outf="${cwd}/tmp/sed_tmp"
37echo "s%# Prefer Mounted Volumes%  Prefer Mounted Volumes%g" >${outf}
38cp ${cwd}/bin/bareos-dir.conf ${cwd}/tmp/1
39# Comment the next line out to write everything to one drive
40#  otherwise, it writes the two jobs to different drives
41sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bareos-dir.conf
42
43# Write out bconsole commands
44cat <<END_OF_DATA >${cwd}/tmp/bconcmds
45@out /dev/null
46messages
47@$out ${cwd}/tmp/log1.out
48@#setdebug level=200 storage=tape
49@#setdebug level=200 client=$CLIENT
50label storage=tape volume=TestVolume001 slot=1 Pool=Default drive=0
51label storage=tape volume=TestVolume002 slot=2 Pool=Full    drive=0
52label storage=tape volume=TestVolume003 slot=3 Pool=Inc     drive=1
53status storage=tape
54run job=$JobName level=Full Pool=Default yes
55run job=$JobName level=Full Pool=Default yes
56run job=$JobName level=Full Pool=Default yes
57run job=$JobName level=Full Pool=Default yes
58run job=$JobName level=Full Pool=Default yes
59setdebug level=200 storage=tape
60@sleep 10
61status storage=tape
62list volumes
63wait
64list volumes
65list jobs
66status storage=tape
67messages
68quit
69END_OF_DATA
70
71# exit
72
73run_bareos
74cat <<END_OF_DATA >${cwd}/tmp/bconcmds
75@out /dev/null
76messages
77@#
78@# now do a restore
79@#
80@$out ${cwd}/tmp/log2.out
81restore where=${cwd}/tmp/bareos-restores select all storage=tape done
82yes
83wait
84messages
85quit
86END_OF_DATA
87
88run_bconsole
89
90check_for_zombie_jobs storage=tape
91stop_bareos
92
93check_two_logs
94check_restore_diff
95
96end_test
97