3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
8 # Run a backup of the Bacula build directory on two Volumes
9 # then copy it to another device.
11 # This script uses the virtual disk autochanger and migration scripts
13 TestName="copy-uncopied-test"
19 scripts/copy-migration-confs
20 scripts/prepare-disk-changer
21 echo "${cwd}/build" >${cwd}/tmp/file-list
22 #cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
23 #sed "s%# Maximum File Size% Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
25 change_jobname NightlySave $JobName
26 sed 's/migrate/copy/g' ${cwd}/bin/bacula-dir.conf > ${cwd}/tmp/1
27 sed 's/Migrate/Copy/g' ${cwd}/tmp/1 > ${cwd}/bin/bacula-dir.conf
28 rm -f ${cwd}/build/po/test.po >/dev/null
30 touch ${cwd}/tmp/log2.out
32 $bperl -e 'add_attribute("$conf/bacula-dir.conf", "Allow Duplicate Jobs", "no", "Job", "MigVolBackup")'
37 # Note, we first backup into Pool Default,
38 # then Copy into Pool Full.
39 # Pool Default uses Storage=File
40 # Pool Full uses Storage=DiskChanger
42 # Write out bconsole commands
43 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
46 @$out ${cwd}/tmp/log1.out
47 label storage=File volume=FileVolume001 Pool=Default
48 label storage=File volume=FileVolume002 Pool=Scratch
49 label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Scratch drive=0
50 label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Scratch drive=0
52 run job=$JobName level=Full yes
54 run job=$JobName level=Full yes
56 update volume=FileVolume001 VolStatus=Used
57 run job=$JobName level=Full yes
60 @$out ${cwd}/tmp/log11.out
61 @############################################################
62 @# should copy job 1,2,3
63 @# Expect: 3 copies (1,2,3)
64 @############################################################
65 setdebug level=200 dir
66 run job=copy-uncopied yes
73 @$out ${cwd}/tmp/log12.out
74 @############################################################
75 @# should not copy jobs
76 @# Expect: 3 copies (1,2,3)
77 @############################################################
78 run job=copy-uncopied yes
82 @$out ${cwd}/tmp/log13.out
83 @############################################################
84 @# should not have a copy of the copy
85 @# Expect: 2 copies (2,3)
86 @############################################################
88 run job=copy-uncopied yes
92 @$out ${cwd}/tmp/log14.out
93 @############################################################
94 @# should copy jobid=2
95 @# Expect: 2 copies (2,3)
96 @############################################################
98 run job=copy-uncopied yes
105 check_for_zombie_jobs storage=File
113 perl -Mscripts::functions -e 'check_multiple_copies(3)' tmp/log11.out
114 bstat=`expr $bstat + $?`
116 perl -Mscripts::functions -e 'check_multiple_copies(3)' tmp/log12.out
117 bstat=`expr $bstat + $?`
119 perl -Mscripts::functions -e 'check_multiple_copies(2)' tmp/log13.out
120 bstat=`expr $bstat + $?`
122 perl -Mscripts::functions -e 'check_multiple_copies(2)' tmp/log14.out
123 bstat=`expr $bstat + $?`