From c1bed1760da7956b0be6530e7362bacf108dd008 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Thu, 10 Apr 2008 07:27:19 +0000 Subject: [PATCH] Update git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.2@6786 91ce42f0-d328-0410-95d8-f526ca767f89 --- regress/DartTestfile.txt.in | 1 + regress/scripts/bacula-dir-tape.conf.in | 25 ++++++ regress/scripts/bacula-sd-2disk-drive.conf.in | 32 +++++++ regress/scripts/bacula-sd-2disk.conf.in | 49 ++++++++++- regress/tests/recycle-test | 9 +- regress/tests/virtual-changer-test | 83 +++++++++++++++++++ 6 files changed, 197 insertions(+), 2 deletions(-) create mode 100755 regress/tests/virtual-changer-test diff --git a/regress/DartTestfile.txt.in b/regress/DartTestfile.txt.in index 00cadf48a5..9d0691576f 100644 --- a/regress/DartTestfile.txt.in +++ b/regress/DartTestfile.txt.in @@ -43,6 +43,7 @@ ADD_TEST(disk:two-vol-test "@regressdir@/tests/two-vol-test") ADD_TEST(disk:two-volume-test "@regressdir@/tests/two-volume-test") ADD_TEST(disk:verify-cat-test "@regressdir@/tests/verify-cat-test") ADD_TEST(disk:verify-vol-test "@regressdir@/tests/verify-vol-test") +ADD_TEST(disk:virtual-changer-test "@regressdir@/tests/virtual-changer-test") ADD_TEST(disk:weird-files2-test "@regressdir@/tests/weird-files2-test") ADD_TEST(disk:weird-files-test "@regressdir@/tests/weird-files-test") ADD_TEST(disk:2drive-3pool-test "@regressdir@/tests/2drive-3pool-test") diff --git a/regress/scripts/bacula-dir-tape.conf.in b/regress/scripts/bacula-dir-tape.conf.in index 35846294a5..3eca3aca5b 100644 --- a/regress/scripts/bacula-dir-tape.conf.in +++ b/regress/scripts/bacula-dir-tape.conf.in @@ -84,6 +84,19 @@ Job { # Prefer Mounted Volumes = no } +Job { + Name = "Virtual" + Type = Backup + Client=@hostname@-fd + FileSet="Full Set" + Storage = Virtual + Messages = Standard + Pool = Default + Write Bootstrap = "@working_dir@/NightlySave.bsr" + Maximum Concurrent Jobs = 4 + SpoolData = yes +# Prefer Mounted Volumes = no +} @@ -169,6 +182,18 @@ Storage { Maximum Concurrent Jobs = 4 } +# Definition of Virtual storage device +Storage { + Name = Virtual + Address = @hostname@ # N.B. Use a fully qualified name here + SDPort = @sdport@ + Password = "ccV3lVTsQRsdIUGyab0N4sMDavui2hOBkmpBU0aQKOr9" # password for Storage daemon + Device = Virtual # must be same as Device in Storage daemon + Media Type = Disk # must be same as MediaType in Storage daemon + Maximum Concurrent Jobs = 4 +} + + # Generic catalog service diff --git a/regress/scripts/bacula-sd-2disk-drive.conf.in b/regress/scripts/bacula-sd-2disk-drive.conf.in index 10754d9e94..4515375d2e 100644 --- a/regress/scripts/bacula-sd-2disk-drive.conf.in +++ b/regress/scripts/bacula-sd-2disk-drive.conf.in @@ -64,6 +64,38 @@ Device { # Maximum File Size = 1000000 } +Autochanger { + Name = Virtual + Changer Device = /dev/null + Changer Command ="" + Device = Virtual-1, Virtual-2 +} + +Device { + Name = Virtual-1 + Device Type = File + Media Type = Disk + Archive Device = tmp + AutomaticMount = yes; # when device opened, read it + Autochanger = yes + Drive Index = 0 + AlwaysOpen = yes; + RemovableMedia = yes; +# Maximum File Size = 1000000 +} + +Device { + Name = Virtual-2 + Device Type = File + Media Type = Disk + Archive Device = tmp + AutomaticMount = yes; # when device opened, read it + Autochanger = yes + Drive Index = 1 + AlwaysOpen = yes; + RemovableMedia = yes; +# Maximum File Size = 1000000 +} # # Send all messages to the Director, diff --git a/regress/scripts/bacula-sd-2disk.conf.in b/regress/scripts/bacula-sd-2disk.conf.in index fd5f973f1a..95376203c3 100644 --- a/regress/scripts/bacula-sd-2disk.conf.in +++ b/regress/scripts/bacula-sd-2disk.conf.in @@ -35,7 +35,7 @@ Autochanger { Name = DDS-4 Changer Device = @disk_drive@/conf Changer Command ="@scriptdir@/disk-changer %c %o %S %a %d" - Device = Drive-0 + Device = Drive-0, Drive-1 } Device { @@ -51,6 +51,53 @@ Device { # Maximum File Size = 1000000 } +Device { + Name = Drive-1 # + Device Type = File + Media Type = DDS-4 + Archive Device = @disk_drive@/drive0 + AutomaticMount = yes; # when device opened, read it + Autochanger = yes + Drive Index = 1 + AlwaysOpen = yes; + RemovableMedia = yes; +# Maximum File Size = 1000000 +} + + +Autochanger { + Name = Virtual + Changer Device = /dev/null + Changer Command ="" + Device = Virtual-1, Virtual-2 +} + +Device { + Name = Virtual-1 + Device Type = File + Media Type = Disk + Archive Device = @tmpdir@ + AutomaticMount = yes; # when device opened, read it + Autochanger = yes + Drive Index = 0 + AlwaysOpen = yes; + RemovableMedia = yes; +# Maximum File Size = 1000000 +} + +Device { + Name = Virtual-2 + Device Type = File + Media Type = Disk + Archive Device = @tmpdir@ + AutomaticMount = yes; # when device opened, read it + Autochanger = yes + Drive Index = 1 + AlwaysOpen = yes; + RemovableMedia = yes; +# Maximum File Size = 1000000 +} + Device { Name = FileStorage Media Type = FileMedia diff --git a/regress/tests/recycle-test b/regress/tests/recycle-test index 712b1d32f9..066217fbc3 100755 --- a/regress/tests/recycle-test +++ b/regress/tests/recycle-test @@ -23,14 +23,21 @@ messages label storage=File1 volume=TestVolume001 label storage=File1 volume=TestVolume002 label storage=File1 volume=TestVolume003 +label storage=File1 volume=TestVolume004 +@# Note, this is going to fail if the pruning gets +@# to tight because the saved volume is too large. +@# In that case, either add another volume, or +@# increase the volume capacity a bit. update Volume=TestVolume001 volretention=10s update Volume=TestVolume001 maxvolbytes=200000000 update Volume=TestVolume002 volretention=10s update Volume=TestVolume002 maxvolbytes=200000000 update Volume=TestVolume003 volretention=10s update Volume=TestVolume003 maxvolbytes=200000000 +update Volume=TestVolume004 volretention=10s +update Volume=TestVolume004 maxvolbytes=200000000 list volumes -@#setdebug level=100 storage=File1 +setdebug level=150 storage=File1 run job=$JobName storage=File1 level=full yes run job=$JobName storage=File1 level=full yes run job=$JobName storage=File1 level=full yes diff --git a/regress/tests/virtual-changer-test b/regress/tests/virtual-changer-test new file mode 100755 index 0000000000..33178f57ef --- /dev/null +++ b/regress/tests/virtual-changer-test @@ -0,0 +1,83 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory. Create three +# tapes, each in a different pool, then run two jobs both of which +# want the disk that is not loaded. Note, they both have +# prefers non-mounted tapes. This should expose bug #801 +# +# This script uses the virtual disk autochanger and two drives +# +TestName="virtual-changer-disk" +JobName="virtualchangerdisk" +. scripts/functions + +scripts/cleanup +scripts/copy-2disk-drive-confs +scripts/prepare-two-disks + +echo "${cwd}/build" >${cwd}/tmp/file-list +#change_jobname Virtual $JobName +start_test + +# Turn off Prefer Mounted Volumes so we use 2 drives +outf="${cwd}/tmp/sed_tmp" +echo "s%# Prefer Mounted Volumes% Prefer Mounted Volumes%g" >${outf} +cp ${cwd}/bin/bacula-dir.conf ${cwd}/tmp/1 +# Comment the next line out to write everything to one drive +# otherwise, it writes the two jobs to different drives +sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf + +# Write out bconsole commands +cat <${cwd}/tmp/bconcmds +@output /dev/null +messages +@$out ${cwd}/tmp/log1.out +@#setdebug level=200 storage=Virtual +@#setdebug level=200 client +label storage=Virtual volume=TestVolume001 slot=1 Pool=Default drive=0 +label storage=Virtual volume=TestVolume002 slot=2 Pool=Full drive=0 +label storage=Virtual volume=TestVolume003 slot=3 Pool=Inc drive=1 +status storage=Virtual +run job=Virtual level=Full Pool=Default yes +run job=Virtual level=Full Pool=Default yes +run job=Virtual level=Full Pool=Default yes +run job=Virtual level=Full Pool=Default yes +run job=Virtual level=Full Pool=Default yes +@sleep 10 +status storage=Virtual +list volumes +wait +list volumes +list jobs +status storage=Virtual +messages +quit +END_OF_DATA + +# exit + +run_bacula +cat <${cwd}/tmp/bconcmds +@$out /dev/null +messages +@# +@# now do a restore +@# +@$out ${cwd}/tmp/log2.out +restore where=${cwd}/tmp/bacula-restores select all storage=Virtual done +yes +wait +messages +@$out +quit +END_OF_DATA + +run_bconsole + +check_for_zombie_jobs storage=Virtual +stop_bacula + +check_two_logs +check_restore_diff + +end_test -- 2.39.5