3 # Copyright (C) 2000-2017 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
6 # Run a backup of the Bacula build directory on two Volumes
7 # then copy it to another device.
9 # This script uses the virtual disk autochanger and migration scripts
11 TestName="copy-uncopied-test"
17 scripts/copy-migration-confs
18 echo "${cwd}/build" >${cwd}/tmp/file-list
19 #cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
20 #sed "s%# Maximum File Size% Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
22 change_jobname NightlySave $JobName
23 sed 's/migrate/copy/g' ${cwd}/bin/bacula-dir.conf > ${cwd}/tmp/1
24 sed 's/Migrate/Copy/g' ${cwd}/tmp/1 > ${cwd}/bin/bacula-dir.conf
25 rm -f ${cwd}/build/po/test.po >/dev/null
27 touch ${cwd}/tmp/log2.out
29 $bperl -e 'add_attribute("$conf/bacula-dir.conf", "Allow Duplicate Jobs", "no", "Job", "MigVolBackup")'
34 # Note, we first backup into Pool Default,
35 # then Copy into Pool Full.
36 # Pool Default uses Storage=File
37 # Pool Full uses Storage=DiskChanger
39 # Write out bconsole commands
40 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
43 @$out ${cwd}/tmp/log1.out
44 label storage=File volume=FileVolume001 Pool=Default
45 label storage=File volume=FileVolume002 Pool=Scratch
46 label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Scratch drive=0
47 label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Scratch drive=0
49 run job=$JobName level=Full yes
51 run job=$JobName level=Full yes
53 update volume=FileVolume001 VolStatus=Used
54 run job=$JobName level=Full yes
57 @$out ${cwd}/tmp/log11.out
58 @############################################################
59 @# should copy job 1,2,3
60 @# Expect: 3 copies (1,2,3)
61 @############################################################
62 setdebug level=200 dir
63 run job=copy-uncopied yes
70 @$out ${cwd}/tmp/log12.out
71 @############################################################
72 @# should not copy jobs
73 @# Expect: 3 copies (1,2,3)
74 @############################################################
75 run job=copy-uncopied yes
79 @$out ${cwd}/tmp/log13.out
80 @############################################################
81 @# should not have a copy of the copy
82 @# Expect: 2 copies (2,3)
83 @############################################################
85 run job=copy-uncopied yes
89 @$out ${cwd}/tmp/log14.out
90 @############################################################
91 @# should copy jobid=2
92 @# Expect: 2 copies (2,3)
93 @############################################################
95 run job=copy-uncopied yes
102 check_for_zombie_jobs storage=File
110 perl -Mscripts::functions -e 'check_multiple_copies(3)' tmp/log11.out
111 bstat=`expr $bstat + $?`
113 perl -Mscripts::functions -e 'check_multiple_copies(3)' tmp/log12.out
114 bstat=`expr $bstat + $?`
116 perl -Mscripts::functions -e 'check_multiple_copies(2)' tmp/log13.out
117 bstat=`expr $bstat + $?`
119 perl -Mscripts::functions -e 'check_multiple_copies(2)' tmp/log14.out
120 bstat=`expr $bstat + $?`