1#!/bin/sh
2#
3# Run a simple backup  then migrate it
4#   to another device.
5#
6# Test migrating a job that spans two Volumes
7#
8# This script uses the virtual disk autochanger
9#
10TestName="migration-jobspan-test"
11JobName=MigrationJobSpanSave
12. scripts/functions
13
14
15scripts/cleanup
16scripts/copy-migration-confs
17scripts/prepare-disk-changer
18
19# Directory to backup.
20# This directory will be created by setup_data().
21BackupDirectory="${tmp}/data"
22
23# Use a tgz to setup data to be backuped.
24# Data will be placed at "${tmp}/data/".
25setup_data data/small.tgz
26
27# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list".
28echo "${BackupDirectory}" >${tmp}/file-list
29
30
31cp ${cwd}/bin/bareos-sd.conf ${cwd}/tmp/1
32sed "s%# Maximum File Size%  Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bareos-sd.conf
33
34
35change_jobname NightlySave $JobName
36start_test
37
38#
39# Note, we first backup into Pool Default,
40#          then Migrate into Pool Full.
41#              Pool Default uses Storage=File
42#              Pool Full    uses Storage=DiskChanger
43
44# Write out bconsole commands
45cat <<END_OF_DATA >${cwd}/tmp/bconcmds
46@$out /dev/null
47messages
48@$out ${cwd}/tmp/log1.out
49@#setdebug level=10 dir
50@#setdebug level=100 storage=File
51label storage=File volume=FileVolume001 Pool=Default
52label storage=File volume=FileVolume002 Pool=Default
53update Volume=FileVolume001 MaxVolBytes=3000000 pool=Default
54label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0
55label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0
56list volumes
57@#
58run job=$JobName yes
59@#run job=$JobName yes
60wait
61list volumes
62@#setdebug level=200 dir
63@# should migrate both Volumes
64run job=migrate-job yes
65wait
66purge volume=FileVolume001
67purge volume=FileVolume002
68list volumes
69list jobs
70messages
71wait
72@#
73@# now do a restore
74@#
75@$out ${cwd}/tmp/log2.out
76setdebug level=500 storage=File
77restore where=${cwd}/tmp/bareos-restores select storage=DiskChanger
78unmark *
79mark *
80done
81yes
82wait
83messages
84quit
85END_OF_DATA
86
87run_bareos
88check_for_zombie_jobs storage=File
89stop_bareos
90
91check_two_logs
92check_restore_diff
93end_test
94