From bb4997398712821a17d89dc7f3eb01c886bd2926 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 13 Feb 2010 14:45:58 +0100 Subject: [PATCH] Tweak multi-storage-test --- regress/scripts/bacula-dir-tape.conf.in | 36 ++++++++ regress/tests/multi2-storage-test | 107 ++++++++++++++++++++++++ 2 files changed, 143 insertions(+) create mode 100755 regress/tests/multi2-storage-test diff --git a/regress/scripts/bacula-dir-tape.conf.in b/regress/scripts/bacula-dir-tape.conf.in index 24229a6d6c..0a71657ba4 100644 --- a/regress/scripts/bacula-dir-tape.conf.in +++ b/regress/scripts/bacula-dir-tape.conf.in @@ -190,6 +190,42 @@ Storage { Maximum Concurrent Jobs = 100 } +# Definition of File2 storage device +Storage { + Name = File2 + Address = @hostname@ # N.B. Use a fully qualified name here + SDPort = @sdport@ + Password = "ccV3lVTsQRsdIUGyab0N4sMDavui2hOBkmpBU0aQKOr9" # password for Storage daemon + Device = FileStorage # must be same as Device in Storage daemon + Media Type = FileMedia # must be same as MediaType in Storage daemon + Maximum Concurrent Jobs = 100 +} + + +# Definition of File3 storage device +Storage { + Name = File3 + Address = @hostname@ # N.B. Use a fully qualified name here + SDPort = @sdport@ + Password = "ccV3lVTsQRsdIUGyab0N4sMDavui2hOBkmpBU0aQKOr9" # password for Storage daemon + Device = FileStorage # must be same as Device in Storage daemon + Media Type = FileMedia # must be same as MediaType in Storage daemon + Maximum Concurrent Jobs = 100 +} + +# Definition of File4 storage device +Storage { + Name = File4 + Address = @hostname@ # N.B. Use a fully qualified name here + SDPort = @sdport@ + Password = "ccV3lVTsQRsdIUGyab0N4sMDavui2hOBkmpBU0aQKOr9" # password for Storage daemon + Device = FileStorage # must be same as Device in Storage daemon + Media Type = FileMedia # must be same as MediaType in Storage daemon + Maximum Concurrent Jobs = 100 +} + + + # Definition of Virtual storage device Storage { Name = Virtual diff --git a/regress/tests/multi2-storage-test b/regress/tests/multi2-storage-test new file mode 100755 index 0000000000..c33daed797 --- /dev/null +++ b/regress/tests/multi2-storage-test @@ -0,0 +1,107 @@ +#!/bin/sh +# +# This script uses the virtual disk autochanger +# +TestName="multi-storage-test" +JobName=backup +. scripts/functions + +scripts/cleanup +scripts/copy-2disk-confs +scripts/prepare-disk-changer + +# create a new bacula-sd.confs +for sd in 2 3 4; do + perl -ne ' + if (/SDPort = /) { $_ =~ s/(\d+)/1810$sd/;} + if (/Name = .+?-sd/) { $_ =~ s/-sd/-sd$sd/;} + if (/WorkingDirectory/) { $_ =~ s/"$/$sd"/; } + if (/Pid Directory/) { $_ =~ s/"$/$sd"/; } + print; + ' $conf/bacula-sd.conf > $conf/bacula-sd$sd.conf + mkdir -p ${working}$sd + sed 's/bacula-sd.conf/bacula-sd$sd.conf/' $scripts/bacula-ctl-sd \ + > $tmp/bacula-ctl-sd$sd + chmod +x $tmp/bacula-ctl-sd$sd +done + +# Patch up bacula-dir.conf +perl -ne ' +if (/^Storage {/) { $in=1; $nb++; } +if (/^}/) { $in=0 } +if (/SDPort = (\d+)/ && $in) {if ($nb == 2) { $_ = " SDPort = 18102\n"; }} +if (/SDPort = (\d+)/ && $in) {if ($nb == 3) { $_ = " SDPort = 18103\n"; }} +if (/SDPort = (\d+)/ && $in) {if ($nb == 4) { $_ = " SDPort = 18104\n"; }} +print; +' $conf/bacula-dir.conf > $tmp/1 +cp $tmp/1 $conf/bacula-dir.conf + +disable_pluguins + +echo "${cwd}/build" >${cwd}/tmp/file-list + +change_jobname $JobName +start_test + +# Write out bconsole commands +cat <${cwd}/tmp/bconcmds +@$out /dev/null +messages +@$out ${cwd}/tmp/log1.out +label storage=tape volume=TestVolume001 Pool=Default slot=1 drive=0 +label storage=File volume=TestVolume002 Pool=Default +run job=$JobName storage=tape yes +wait +messages +quit +END_OF_DATA + +# Start SDs +for sd in 2 3 4; do + $tmp/bacula-ctl-sd$sd start &> /dev/null +done + +run_bacula + +echo "ficheriro1.txt" >${cwd}/build/po/ficheriro1.txt +echo "ficheriro2.txt" >${cwd}/build/po/ficheriro2.txt + + +cat <${cwd}/tmp/bconcmds +@$out /dev/null +messages +@$out ${cwd}/tmp/log1.out +@# Force Incremental on the second Volume +run level=Incremental storage=File job=$JobName yes +wait +messages +@# +@# now do a restore +@# +@$out ${cwd}/tmp/log2.out +setdebug trace=1 level=110 client +setdebug trace=1 level=110 director +restore where=${cwd}/tmp/bacula-restores select all done yes +wait +messages +sql +select * in Storage; + + +quit +END_OF_DATA + +run_bconsole + +check_for_zombie_jobs storage=File +check_for_zombie_jobs storage=tape + +stop_bacula +for sd in 2 3 4; do + $tmp/bacula-ctl-sd$sd stop &> /dev/null +done + +check_two_logs +check_restore_diff + +end_test -- 2.39.5