From: Kern Sibbald Date: Tue, 23 Dec 2008 14:24:24 +0000 (+0000) Subject: Add Graham's second test X-Git-Tag: Release-7.0.0~3561 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e45deff440f14b907486f61a0ffaf8a494dfcce1;p=bacula%2Fbacula Add Graham's second test git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8239 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/regress/scripts/broken-media-bug-2-bacula-dir.conf.in b/regress/scripts/broken-media-bug-2-bacula-dir.conf.in new file mode 100644 index 0000000000..fc13bc9157 --- /dev/null +++ b/regress/scripts/broken-media-bug-2-bacula-dir.conf.in @@ -0,0 +1,160 @@ +# Configuration for the director for testing for the broken media bug. +# Test written by Graham Keeling + +Director { # define myself + Name = @hostname@-dir + DIRPort = @dirport@ # where we listen for UA connections + QueryFile = "@scriptdir@/query.sql" + WorkingDirectory = "@working_dir@" + PidDirectory = "@piddir@" + SubSysDirectory = "@subsysdir@" + PluginDirectory = "@sbindir@" + Maximum Concurrent Jobs = 4 + Password = "pNvX1WiXnwv2C/F7E52LGvw6rKjbbPvu2kyuPa9pVaL3" # Console password + Messages = Standard +} + +Job { + Name = "First" + Type = Backup + Client=@hostname@-fd + FileSet="Set1" + Storage = File + Messages = Standard + Pool = Pool1 + Write Bootstrap = "@working_dir@/NightlySave.bsr" + Maximum Concurrent Jobs = 4 +} + +Job { + Name = "Second" + Type = Backup + Client=@hostname@-fd + FileSet="Set2" + Storage = File + Messages = Standard + Pool = Pool2 + Write Bootstrap = "@working_dir@/NightlySave.bsr" + Maximum Concurrent Jobs = 4 +} + +# Standard Restore template, to be changed by Console program +Job { + Name = "RestoreFiles" + Type = Restore + Client=@hostname@-fd + FileSet="Set1" + Storage = File + Messages = Standard + Pool = Pool1 + Where = @tmpdir@/bacula-restores +} + + +# List of files to be backed up +FileSet { + Name = "Set1" + Include { + Options { signature=MD5; } + File = <@tmpdir@/file-list + } +} + +FileSet { + Name = "Set2" + Include { + Options { signature=MD5; } + File = <@tmpdir@/file-list + } +} + + +# Client (File Services) to backup +Client { + Name = @hostname@-fd + Address = @hostname@ + FDPort = @fdport@ + Catalog = MyCatalog + Password = "xevrjURYoCHhn26RaJoWbeWXEY/a3VqGKp/37tgWiuHc" # password for FileDaemon + File Retention = 30d # 30 days + Job Retention = 180d # six months + AutoPrune = yes # Prune expired Jobs/Files + Maximum Concurrent Jobs = 4 +} + +# Definiton of file storage device +Storage { + Name = File + Address = @hostname@ # N.B. Use a fully qualified name here + SDPort = @sdport@ + Password = "ccV3lVTsQRsdIUGyab0N4sMDavui2hOBkmpBU0aQKOr9" + Device = FileStorage + Device = FileStorage1 + Media Type = File + Maximum Concurrent Jobs = 4 +} + +# Generic catalog service +Catalog { + Name = MyCatalog + + dbname = @db_name@; user = @db_user@; password = "@db_password@" +} + +# Reasonable message delivery -- send most everything to email address +# and to the console +Messages { + Name = Standard + mailcommand = "@sbindir@/bsmtp -h localhost -f \"\(Bacula regression\) %r\" +-s \"Regression: %t %e of %c %l\" %r" + operatorcommand = "@sbindir@/bsmtp -h localhost -f \"\(Bacula regression\) % +r\" -s \"Regression: Intervention needed for %j\" %r" +# MailOnError = @job_email@ = all +# operator = @job_email@ = mount + + console = all, !skipped, !terminate, !restored +# +# WARNING! the following will create a file that you must cycle from +# time to time as it will grow indefinitely. However, it will +# also keep all your messages if the scroll off the console. +# + append = "@working_dir@/log" = all, !skipped + catalog = all, !skipped +} + +Pool { + Name = "Scratch" + Pool Type = Scratch + Recycle = yes # automatically recycle Volumes + AutoPrune = yes # Prune expired volumes + Volume Retention = 0 + Maximum Volume Jobs = 1 + Label Format = backup- + Maximum Volumes = 0 # unlimited + RecyclePool = Scratch +} + +# Pool definitions +Pool { + Name = Pool1 + Pool Type = Backup + Recycle = yes # Bacula can automatically recycle Volumes + AutoPrune = yes # Prune expired volumes + Volume Retention = 365d # one year + Maximum Volume Jobs = 1 + Label Format = TestVolume + Maximum Volumes = 0 + RecyclePool = Scratch +} + +Pool { + Name = Pool2 + Pool Type = Backup + Recycle = yes # Bacula can automatically recycle Volumes + AutoPrune = yes # Prune expired volumes + Volume Retention = 365d # one year + Maximum Volume Jobs = 1 + Label Format = TestVolume + Maximum Volumes = 0 + RecyclePool = Scratch +} diff --git a/regress/scripts/broken-media-bug-2-bacula-sd.conf.in b/regress/scripts/broken-media-bug-2-bacula-sd.conf.in new file mode 100644 index 0000000000..a2c61323c5 --- /dev/null +++ b/regress/scripts/broken-media-bug-2-bacula-sd.conf.in @@ -0,0 +1,107 @@ +# +# Default Bacula Storage Daemon Configuration file +# +# For Bacula release 1.33 +# +# You may need to change the name of your tape drive +# on the "Archive Device" directive in the Device +# resource. If you change the Name and/or the +# "Media Type" in the Device resource, please ensure +# that dird.conf has corresponding changes. +# + +Storage { # definition of myself + Name = @hostname@-sd + SDPort = @sdport@ # Director's port + WorkingDirectory = "@working_dir@" + Pid Directory = "@piddir@" + Subsys Directory = "@subsysdir@" +} + +# +# List Directors who are permitted to contact Storage daemon +# +Director { + Name = @hostname@-dir + Password = "ccV3lVTsQRsdIUGyab0N4sMDavui2hOBkmpBU0aQKOr9" +} + +# +# Devices supported by this Storage daemon +# To connect, the Director's bacula-dir.conf must have the +# same Name and MediaType. +# + +Device { + Name = FileStorage + Media Type = File + Archive Device = @tmpdir@ + LabelMedia = yes; # lets Bacula label unlabelled media + Random Access = Yes; + AutomaticMount = yes; # when device opened, read it + RemovableMedia = no; + AlwaysOpen = no; +# Maximum File Size = 10KB +} + +Device { + Name = FileStorage1 + Media Type = File + Archive Device = @tmpdir@ + LabelMedia = yes; # lets Bacula label unlabelled media + Random Access = Yes; + AutomaticMount = yes; # when device opened, read it + RemovableMedia = no; + AlwaysOpen = no; +} + + +#Device { +# Name = "HP DLT 80" +# Media Type = DLT8000 +# Archive Device = /dev/nst0 +# AutomaticMount = yes; # when device opened, read it +# AlwaysOpen = yes; +# RemovableMedia = yes; +#} + +#Device { +# Name = SDT-7000 # +# Media Type = DDS-2 +# Archive Device = /dev/nst0 +# AutomaticMount = yes; # when device opened, read it +# AlwaysOpen = yes; +# RemovableMedia = yes; +#} + +#Device { +# Name = Floppy +# Media Type = Floppy +# Archive Device = /mnt/floppy +# RemovableMedia = yes; +# Random Access = Yes; +# AutomaticMount = yes; # when device opened, read it +# AlwaysOpen = no; +#} + +# +# A very old Exabyte with no end of media detection +# +#Device { +# Name = "Exabyte 8mm" +# Media Type = "8mm" +# Archive Device = /dev/nst0 +# Hardware end of medium = No; +# AutomaticMount = yes; # when device opened, read it +# AlwaysOpen = Yes; +# RemovableMedia = yes; +#} + +# +# Send all messages to the Director, +# mount messages also are sent to the email address +# +Messages { + Name = Standard + director = @hostname@-dir = all, !terminate +} diff --git a/regress/scripts/do_sed b/regress/scripts/do_sed index 4e3a82d394..e986456e9e 100755 --- a/regress/scripts/do_sed +++ b/regress/scripts/do_sed @@ -40,6 +40,8 @@ sed -f ${out} ${cwd}/scripts/bacula-sd-2disk.conf.in >${cwd}/scripts/bacula-sd-2 sed -f ${out} ${cwd}/scripts/bacula-sd-2drive.conf.in >${cwd}/scripts/bacula-sd-2drive.conf sed -f ${out} ${cwd}/scripts/bacula-sd-2disk-drive.conf.in >${cwd}/scripts/bacula-sd-2disk-drive.conf sed -f ${out} ${cwd}/scripts/broken-media-bug-bacula-dir.conf.in >${cwd}/scripts/broken-media-bug-bacula-dir.conf +sed -f ${out} ${cwd}/scripts/broken-media-bug-2-bacula-dir.conf.in >${cwd}/scripts/broken-media-bug-2-bacula-dir.conf +sed -f ${out} ${cwd}/scripts/broken-media-bug-2-bacula-sd.conf.in >${cwd}/scripts/broken-media-bug-2-bacula-sd.conf sed -f ${out} ${cwd}/scripts/cleanup-tape.in >${cwd}/scripts/cleanup-tape sed -f ${out} ${cwd}/scripts/cleanup-2tape.in >${cwd}/scripts/cleanup-2tape sed -f ${out} ${cwd}/scripts/cleanup-2drive.in >${cwd}/scripts/cleanup-2drive diff --git a/regress/tests/broken-media-bug-2-test b/regress/tests/broken-media-bug-2-test new file mode 100755 index 0000000000..d57a8d1a2a --- /dev/null +++ b/regress/tests/broken-media-bug-2-test @@ -0,0 +1,106 @@ +#!/bin/sh +# +# Show the broken media bug(s) again. Test by Graham Keeling. +# +# This test will wait forever whilst the last job waits for an appendable +# volume. +# You can run ./bin/bconsole -c bin/bconsole.conf from within the regress +# directory, and use 'list media' to see where the volumes have ended up, as +# well as any other commands you like. +# +# The problem(s): +# - Write two jobs to two different volumes. +# - Purge them manually. The two volumes end up in the Scratch pool. +# - Start a large job. It takes a volume from the Scratch pool, places it +# in its own pool and starts writing to it. +# - While the first job is still running, start a second job. +# - A sort of chaos then follows. +# The second job sees that there are no JobMedia records associated with the +# first volume (which is in a separate pool), and purges it, moving it +# through Scratch and into its own pool. It then decides not to use that +# volume and hangs around 'waiting for an appendable Volume' - even though +# there is the other purged volume sitting untouched in the Scratch pool. +# Meanwhile, the first job finishes and sets the volume status of its volume +# (that is now in the wrong pool) to 'Used'. + +TestName="broken-media-bug-2-test" +. scripts/functions + +cwd=`pwd` +scripts/cleanup +/bin/cp -f scripts/broken-media-bug-2-bacula-dir.conf bin/bacula-dir.conf +/bin/cp -f scripts/broken-media-bug-2-bacula-sd.conf bin/bacula-sd.conf +/bin/cp -f scripts/test-bacula-fd.conf bin/bacula-fd.conf +/bin/cp -f scripts/test-console.conf bin/bconsole.conf +hugefile=${cwd}/build/hugefile +hugefilesize=300 +echo "${cwd}/build" >${cwd}/tmp/file-list + +start_test + +echo "Creating huge ${hugefilesize}M file..." +dd if=/dev/urandom of="$hugefile" bs=1M count="$hugefilesize" +echo "Done" + +cat >tmp/bconcmds <tmp/bconcmds <tmp/bconcmds <