1#!/bin/sh 2# 3# Run a simple backup 4# to two tapes where the maximum tape file size is set to 1M 5# Note, this test simulates the tape filling and writing to 6# the next tape. 7# 8TestName="two-volume-changer" 9JobName=twovolchanger 10. scripts/functions 11 12require_tape_drive 13require_autochanger 14 15scripts/cleanup 16scripts/copy-2tape-confs 17scripts/prepare-two-tapes 18 19outf="tmp/sed_tmp" 20echo "s%# Maximum File Size% Maximum File Size%g" >${outf} 21cp ${cwd}/bin/bareos-sd.conf ${cwd}/tmp/1 22sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bareos-sd.conf 23 24change_jobname $JobName 25 26# Directory to backup. 27# This directory will be created by setup_data(). 28BackupDirectory="${tmp}/data" 29 30# Use a tgz to setup data to be backuped. 31# Data will be placed at "${tmp}/data/". 32setup_data data/small.tgz 33 34# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list". 35echo "${BackupDirectory}" >${tmp}/file-list 36 37 38start_test 39 40# Write out bconsole commands 41cat <<END_OF_DATA >tmp/bconcmds 42@$out /dev/null 43messages 44@$out tmp/log1.out 45label storage=tape volume=TestVolume001 slot=$SLOT1 pool=Default drive=$DRIVE1 46label storage=tape volume=TestVolume002 slot=$SLOT2 pool=Default drive=$DRIVE1 47update Volume=TestVolume002 MaxVolBytes=3000000 pool=Default drive=$DRIVE1 48sql 49select * from Storage; 50select VolumeName,InChanger,Slot,StorageId from Media; 51 52@#setdebug level=1000 client=$CLIENT 53setdebug level=150 storage=tape 54run job=$JobName yes 55wait 56sql 57select * from Storage; 58select VolumeName,InChanger,Slot,StorageId from Media; 59 60messages 61quit 62END_OF_DATA 63 64run_bareos 65check_for_zombie_jobs storage=tape 66stop_bareos 67 68$scripts/${AUTOCHANGER_SCRIPT} ${AUTOCHANGER} unload $SLOT2 ${TAPE_DRIVE} 0 69 70cat <<END_OF_DATA >tmp/bconcmds 71@$out /dev/null 72messages 73@# 74@# now do a restore 75@# 76@$out tmp/log2.out 77restore where=${cwd}/tmp/bareos-restores select all storage=tape done 78yes 79wait 80messages 81quit 82END_OF_DATA 83 84run_bareos 85check_for_zombie_jobs storage=tape 86stop_bareos 87 88check_two_logs 89check_restore_diff 90end_test 91