1#!/bin/sh 2# 3# Run a simple backup . Create three 4# tapes, each in a different pool, then run two jobs both of which 5# want the disk that is not loaded. Note, they both have 6# prefers non-mounted tapes. This should expose bug #801 7# 8# This test the SD Virtual autochanger feature. It is a disk based 9# "autochanger", but does not use any changer script. 10# 11# Note, because we limit each drive to a maximum of 3 jobs, 12# the first three start on Drive-0, and the second three start 13# on drive-1 (Prefer Mounted Volumes = no). Thus since there 14# is only one Volume (TestVolume001) that is valid, three jobs 15# block and ask the user to create a new volume. However, at some 16# point, the first three jobs finish and free up TestVolum001, and 17# Since we set a poll interval of 15 seconds, after a short wait 18# TestVolume001 will be mounted on drive-1 and the job will 19# complete. This tests a good number of things. 20# 21TestName="virtual-changer-test" 22JobName="virtualchangertest" 23. scripts/functions 24 25scripts/cleanup 26scripts/copy-2disk-drive-confs 27scripts/prepare-disk-changer 28 29CLIENT=2drive2disk 30 31 32# Directory to backup. 33# This directory will be created by setup_data(). 34BackupDirectory="${tmp}/data" 35 36# Use a tgz to setup data to be backuped. 37# Data will be placed at "${tmp}/data/". 38setup_data data/small.tgz 39 40# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list". 41echo "${BackupDirectory}" >${tmp}/file-list 42 43 44#change_jobname Virtual $JobName 45start_test 46 47# Turn off Prefer Mounted Volumes so we use 2 drives 48outf="${cwd}/tmp/sed_tmp" 49echo "s%# Prefer Mounted Volumes% Prefer Mounted Volumes%g" >${outf} 50cp ${cwd}/bin/bareos-dir.conf ${cwd}/tmp/1 51# Comment the next line out to write everything to one drive 52# otherwise, it writes the two jobs to different drives 53sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bareos-dir.conf 54 55# Write out bconsole commands 56cat <<END_OF_DATA >${cwd}/tmp/bconcmds 57@$out /dev/null 58messages 59@$out ${cwd}/tmp/log1.out 60setdebug level=200 storage=Virtual 61@#setdebug level=200 client=$CLIENT 62label storage=Virtual volume=TestVolume001 slot=1 Pool=Default drive=0 63label storage=Virtual volume=TestVolume002 slot=2 Pool=Full drive=0 64label storage=Virtual volume=TestVolume003 slot=3 Pool=Inc drive=1 65status storage=Virtual 66run job=Virtual level=Full Pool=Default yes 67run job=Virtual level=Full Pool=Default yes 68run job=Virtual level=Full Pool=Default yes 69run job=Virtual level=Full Pool=Default yes 70run job=Virtual level=Full Pool=Default yes 71@sleep 10 72status storage=Virtual 73list volumes 74wait 75list volumes 76list jobs 77status storage=Virtual 78messages 79quit 80END_OF_DATA 81 82# exit 83 84run_bareos 85cat <<END_OF_DATA >${cwd}/tmp/bconcmds 86@$out /dev/null 87messages 88@# 89@# now do a restore 90@# 91@$out ${cwd}/tmp/log2.out 92restore where=${cwd}/tmp/bareos-restores select all storage=Virtual done 93yes 94wait 95messages 96quit 97END_OF_DATA 98 99run_bconsole 100 101check_for_zombie_jobs storage=Virtual 102stop_bareos 103 104check_two_logs 105check_restore_diff 106 107end_test 108