3 # Run a backup of the Bacula build directory on two Volumes
4 # then copy it to another device.
6 # This script uses the virtual disk autochanger and migration scripts
8 TestName="copy-uncopied-test"
14 scripts/copy-migration-confs
15 scripts/prepare-disk-changer
16 echo "${cwd}/build" >${cwd}/tmp/file-list
17 #cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
18 #sed "s%# Maximum File Size% Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
20 change_jobname NightlySave $JobName
21 sed 's/migrate/copy/g' ${cwd}/bin/bacula-dir.conf > ${cwd}/tmp/1
22 sed 's/Migrate/Copy/g' ${cwd}/tmp/1 > ${cwd}/bin/bacula-dir.conf
23 rm -f ${cwd}/build/po/test.po >/dev/null
25 touch ${cwd}/tmp/log2.out
30 # Note, we first backup into Pool Default,
31 # then Copy into Pool Full.
32 # Pool Default uses Storage=File
33 # Pool Full uses Storage=DiskChanger
35 # Write out bconsole commands
36 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
39 @$out ${cwd}/tmp/log1.out
40 label storage=File volume=FileVolume001 Pool=Default
41 label storage=File volume=FileVolume002 Pool=Scratch
42 label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Scratch drive=0
43 label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Scratch drive=0
45 run job=$JobName level=Full yes
47 run job=$JobName level=Full yes
49 update volume=FileVolume001 VolStatus=Used
50 run job=$JobName level=Full yes
53 @$out ${cwd}/tmp/log11.out
54 @############################################################
55 @# should copy job 1,2,3
56 @# Expect: 3 copies (1,2,3)
57 @############################################################
58 @#setdebug level=100 dir
59 run job=copy-uncopied yes
66 @$out ${cwd}/tmp/log12.out
67 @############################################################
68 @# should not copy jobs
69 @# Expect: 3 copies (1,2,3)
70 @############################################################
71 run job=copy-uncopied yes
75 @$out ${cwd}/tmp/log13.out
76 @############################################################
77 @# should not have a copy of the copy
78 @# Expect: 2 copies (2,3)
79 @############################################################
81 run job=copy-uncopied yes
85 @$out ${cwd}/tmp/log14.out
86 @############################################################
87 @# should copy jobid=2
88 @# Expect: 2 copies (2,3)
89 @############################################################
91 run job=copy-uncopied yes
98 check_for_zombie_jobs storage=File
106 for i in tmp/log1[0-9].out; do
108 /list copies/ { ok=1; delete already }
114 if (already[jobid]) {
115 print "ERROR: " jobid " " copyid " " already[jobid]
117 print "OK: " jobid " " copyid
120 already[jobid]=copyid
125 grep ERROR tmp/log*result
126 if [ $? -eq 0 ]; then
127 print_debug "Found multiple copies"
131 n=`wc -l tmp/log11.out.result | awk '{ print $1 }'`
132 if [ $n -ne 3 ]; then
133 print_debug "log11: Bad copies number"
137 n=`wc -l tmp/log12.out.result| awk '{ print $1 }'`
138 if [ $n -ne 3 ]; then
139 print_debug "log12: Bad copies number"
143 n=`wc -l tmp/log13.out.result| awk '{ print $1 }'`
144 if [ $n -ne 2 ]; then
145 print_debug "log13: Bad copies number"
149 n=`wc -l tmp/log14.out.result| awk '{ print $1 }'`
150 if [ $n -ne 2 ]; then
151 print_debug "log14: Bad copies number"