3 # Copyright (C) 2000-2017 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
6 # Test SD to SD copy/migration
9 JobName=MigrationJobSave
11 # the procedure to test volumes is not working with 2 SD
12 REGRESS_CHECK_CORRUPTION=no
17 scripts/copy-migration-confs
18 scripts/prepare-disk-changer
19 echo "${cwd}/build" >${cwd}/tmp/file-list
21 sed -e "s:$cwd/working:$cwd/working2: " \
22 -e "s:$cwd/tmp:$cwd/tmp2:" $conf/bacula-sd.conf > $conf/bacula-sd2.conf
24 $bperl -e "add_attribute('$conf/bacula-sd2.conf', 'Name', 'sd2', 'Storage')"
25 $bperl -e "add_attribute('$conf/bacula-sd2.conf', 'SDPort', $BASEPORT + 10, 'Storage')"
26 $bperl -e "add_attribute('$conf/bacula-sd2.conf', 'Media Type', 'DiskChangerMedia2', 'Device', 'Drive-0')"
27 $bperl -e "add_attribute('$conf/bacula-sd2.conf', 'Media Type', 'File2', 'Device', 'FileStorage')"
28 if [ x$FORCE_DEDUP = xyes ]; then
29 DEDUP_FS_OPTION=${DEDUP_FS_OPTION:-bothsides}
30 $bperl -e 'add_attribute("$conf/bacula-sd2.conf", "Plugin Directory", "$plugins", "Storage")'
31 $bperl -e 'add_attribute("$conf/bacula-sd2.conf", "Device Type", "Dedup", "Device")'
32 $bperl -e 'add_attribute("$conf/bacula-sd2.conf", "DedupDirectory", "${working}2", "Storage")'
33 $bperl -e 'add_attribute("$conf/bacula-sd2.conf", "MaximumContainerSize", "50MB", "Storage")'
37 rm -rf $cwd/working2 $cwd/tmp2
38 mkdir -p $cwd/working2 $cwd/tmp2
39 cp -r $tmp/disk-changer $cwd/tmp2
41 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'SDPort', $BASEPORT + 10, 'Storage', 'File')"
42 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'Media Type', 'File2', 'Storage', 'File')"
44 # Here, File is pointing to SD2 and DiskChanger is pointing to SD1
46 $bin/bacula-sd -c $conf/bacula-sd2.conf
48 pid=`cat $cwd/working2/bacula-sd.*.pid`
52 change_jobname NightlySave $JobName
56 # Note, we first backup into Pool Default,
57 # then Migrate into Pool Full.
58 # Pool Default uses Storage=File (SD2)
59 # Pool Full uses Storage=DiskChanger (SD1)
61 # Write out bconsole commands
62 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
65 @$out ${cwd}/tmp/log1.out
66 label storage=File volume=FileVolume001 Pool=Default
67 label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0
68 label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0
69 @# run two jobs (both will be migrated)
75 @#setdebug level=100 dir
76 @# should migrate two jobs
77 @#setdebug level=51 storage=DiskChanger
80 st storage=DiskChanger
81 @# setdebug level=200 dir
82 @# setdebug level=200 storage=File
83 @# setdebug level=200 storage=DiskChanger
84 setdebug level=700 storage=File trace=1 flags=dedup,asx,dde
85 setdebug level=700 storage=DiskChanger trace=1 flags=dedup,asx,dde
86 run job=migrate-job yes
91 @# purge volume=FileVolume001
97 @# Now do another backup, but level Incremental
99 run job=$JobName level=Incremental yes
103 @# This final job that runs should be Incremental and
104 @# not upgraded to full.
109 @$out ${cwd}/tmp/log2.out
111 restore where=${cwd}/tmp/bacula-restores select storage=DiskChanger
123 check_for_zombie_jobs storage=File
131 PID=`cat $cwd/working2/bacula-sd.*.pid`
132 if [ "$PID" != "" ]; then
133 kill $PID >/dev/null 2>/dev/null