1#!/bin/sh 2# 3# Run a backup on two Volumes 4# then copy it to another device. 5# 6# This script uses the virtual disk autochanger and migration scripts 7# 8TestName="copy-uncopied-test" 9JobName=MigVolBackup 10. scripts/functions 11 12 13scripts/cleanup 14scripts/copy-migration-confs 15scripts/prepare-disk-changer 16#cp ${cwd}/bin/bareos-sd.conf ${cwd}/tmp/1 17#sed "s%# Maximum File Size% Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bareos-sd.conf 18change_jobname NightlySave $JobName 19sed 's/migrate/copy/g' ${cwd}/bin/bareos-dir.conf > ${cwd}/tmp/1 20sed 's/Migrate/Copy/g' ${cwd}/tmp/1 > ${cwd}/bin/bareos-dir.conf 21 22# Directory to backup. 23# This directory will be created by setup_data(). 24BackupDirectory="${tmp}/data" 25 26# Use a tgz to setup data to be backed up. 27# Data will be placed at "${tmp}/data/". 28setup_data data/small.tgz 29 30touch ${cwd}/tmp/log2.out 31 32$bperl -e 'add_attribute("$conf/bareos-dir.conf", "Allow Duplicate Jobs", "no", "Job", "MigVolBackup")' 33 34start_test 35 36# 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 41 42# Write out bconsole commands 43cat <<END_OF_DATA >${cwd}/tmp/bconcmds 44@$out /dev/null 45messages 46@$out ${cwd}/tmp/log1.out 47label storage=File volume=FileVolume001 Pool=Default 48label storage=File volume=FileVolume002 Pool=Scratch 49label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Scratch drive=0 50label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Scratch drive=0 51@# 52run job=$JobName level=Full yes 53wait 54run job=$JobName level=Full yes 55wait 56update volume=FileVolume001 VolStatus=Used 57run job=$JobName level=Full yes 58wait 59messages 60@$out ${cwd}/tmp/log11.out 61@############################################################ 62@# should copy job 1,2,3 63@# Expect: 3 copies (1,2,3) 64@############################################################ 65setdebug level=200 dir 66run job=copy-uncopied yes 67@sleep 5 68wait 69messages 70list jobs 71list volumes 72list copies 73@$out ${cwd}/tmp/log12.out 74@############################################################ 75@# should not copy jobs 76@# Expect: 3 copies (1,2,3) 77@############################################################ 78run job=copy-uncopied yes 79wait 80messages 81list copies 82@$out ${cwd}/tmp/log13.out 83@############################################################ 84@# should not have a copy of the copy 85@# Expect: 2 copies (2,3) 86@############################################################ 87delete jobid=1 88run job=copy-uncopied yes 89wait 90messages 91list copies 92@$out ${cwd}/tmp/log14.out 93@############################################################ 94@# should copy jobid=2 95@# Expect: 2 copies (2,3) 96@############################################################ 97delete jobid=8 98run job=copy-uncopied yes 99wait 100messages 101list copies 102END_OF_DATA 103 104run_bareos 105check_for_zombie_jobs storage=File 106stop_bareos 107 108bstat=0 109rstat=0 110dstat=0 111zstat=0 112 113perl -Mscripts::functions -e 'check_multiple_copies(3)' tmp/log11.out 114bstat=`expr $bstat + $?` 115 116perl -Mscripts::functions -e 'check_multiple_copies(3)' tmp/log12.out 117bstat=`expr $bstat + $?` 118 119perl -Mscripts::functions -e 'check_multiple_copies(2)' tmp/log13.out 120bstat=`expr $bstat + $?` 121 122perl -Mscripts::functions -e 'check_multiple_copies(2)' tmp/log14.out 123bstat=`expr $bstat + $?` 124 125check_two_logs 126end_test 127