]> git.sur5r.net Git - bacula/bacula/commitdiff
Add migration job test
authorKern Sibbald <kern@sibbald.com>
Wed, 5 Jul 2006 20:27:04 +0000 (20:27 +0000)
committerKern Sibbald <kern@sibbald.com>
Wed, 5 Jul 2006 20:27:04 +0000 (20:27 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3125 91ce42f0-d328-0410-95d8-f526ca767f89

12 files changed:
regress/scripts/bacula-dir-migration.conf.in [new file with mode: 0644]
regress/scripts/bacula-sd-2disk.conf
regress/scripts/bacula-sd-2disk.conf.in
regress/scripts/cleanup
regress/scripts/copy-2disk-confs
regress/scripts/copy-migration-confs [new file with mode: 0755]
regress/scripts/do_sed
regress/scripts/functions
regress/scripts/prepare-two-disks
regress/tests/incremental-2disk
regress/tests/migration-job-test [new file with mode: 0755]
regress/tests/migration-test [new file with mode: 0755]

diff --git a/regress/scripts/bacula-dir-migration.conf.in b/regress/scripts/bacula-dir-migration.conf.in
new file mode 100644 (file)
index 0000000..088ad3e
--- /dev/null
@@ -0,0 +1,180 @@
+#
+# Default Bacula Director Configuration file
+#
+#  The only thing that MUST be changed is to add one or more
+#   file or directory names in the Include directive of the
+#   FileSet resource.
+#
+#  For Bacula release 1.39
+#
+#  You might also want to change the default email address
+#   from root to your address.  See the "mail" and "operator"
+#   directives in the Messages resource.
+#
+
+Director {                            # define myself
+  Name = @hostname@-dir
+  DIRport = 8101                # where we listen for UA connections
+  QueryFile = "@scriptdir@/query.sql"
+  WorkingDirectory = "@working_dir@"
+  PidDirectory = "@piddir@"
+  Maximum Concurrent Jobs = 4
+  Password = "pNvX1WiXnwv2C/F7E52LGvw6rKjbbPvu2kyuPa9pVaL3"
+  Messages = Daemon
+}
+
+#
+# Define the main nightly save backup job
+#   By default, this job will back up to disk in /tmp
+Job {
+  Name = "NightlySave"
+  Type = Backup
+  Client=@hostname@-fd 
+  FileSet="Full Set"
+  Storage = File
+  Messages = Standard
+  Pool = Default
+  Write Bootstrap = "@working_dir@/NightlySave.bsr"
+  Maximum Concurrent Jobs = 4
+  SpoolData = yes
+# Prefer Mounted Volumes = no
+}
+
+Job {
+  Name = "migrate"
+  Type = Migrate
+  Level = Full
+  Client=@hostname@-fd 
+  FileSet="Full Set"
+  Messages = Standard
+  Storage = DiskChanger
+  Write Bootstrap = "@working_dir@/migrate.bsr"
+  Pool = Default
+  Maximum Concurrent Jobs = 4
+  Selection Type = Job 
+  Selection Pattern = ".*Save"
+}
+
+# Standard Restore template, to be changed by Console program
+Job {
+  Name = "RestoreFiles"
+  Type = Restore
+  Client=@hostname@-fd 
+  FileSet="Full Set"
+  Storage = File
+  Messages = Standard
+  Pool = Default
+  Where = /tmp/bacula-restores
+}
+
+
+# List of files to be backed up
+FileSet {
+  Name = "Full Set"
+  Include { Options { signature=MD5 }
+    File =  </tmp/file-list
+  }
+}
+
+
+#
+# When to do the backups, full backup on first sunday of the month,
+#  differential (i.e. incremental since full) every other sunday,
+#  and incremental backups other days
+Schedule {
+  Name = "WeeklyCycle"
+  Run = Full 1st sun at 1:05
+  Run = Differential 2nd-5th sun at 1:05
+  Run = Incremental mon-sat at 1:05
+}
+
+# Client (File Services) to backup
+Client {
+  Name = @hostname@-fd
+  Address = @hostname@
+  FDPort = 8102
+  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
+}
+
+# Definition of DDS Virtual tape disk storage device
+Storage {
+  Name = DiskChanger
+  Address = @hostname@                # N.B. Use a fully qualified name here
+  SDPort = 8103
+  Password = "ccV3lVTsQRsdIUGyab0N4sMDavui2hOBkmpBU0aQKOr9"          # password for Storage daemon
+  Device = DiskChanger                      # must be same as Device in Storage daemon
+  Media Type = DiskChanger                  # must be same as MediaType in Storage daemon
+  Maximum Concurrent Jobs = 4
+  Autochanger = yes
+}
+
+# Definition of file storage device
+Storage {           
+  Name = File
+  Address = @hostname@
+  SDPort = 8103
+  Password = "ccV3lVTsQRsdIUGyab0N4sMDavui2hOBkmpBU0aQKOr9"          # password for Storage daemon
+  Device = FileStorage
+  Media Type = File
+  Maximum Concurrent Jobs = 5
+}
+
+
+# Generic catalog service
+Catalog {
+  Name = MyCatalog
+  dbname = bacula; user = bacula; 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 \"Bacula: %t %e of %c %l\" %r"
+  operatorcommand = "@sbindir@/bsmtp -h localhost -f \"\(Bacula Regression\) %r\" -s \"Bacula: Intervention needed for %j\" %r"
+  MailOnError = @job_email@ = all, !terminate
+  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
+}
+
+#
+# Message delivery for daemon messages (no job).
+Messages {
+  Name = Daemon
+  mailcommand = "@sbindir@/bsmtp -h @smtp_host@ -f \"\(Bacula\) %r\" -s \"Bacula daemon message\" %r"
+  mail = @job_email@ = all, !skipped            
+  console = all, !skipped, !saved
+  append = "@working_dir@/log" = all, !skipped
+}
+
+    
+# Default pool definition
+Pool {
+  Name = Default
+  Pool Type = Backup
+  Recycle = yes                       # Bacula can automatically recycle Volumes
+  AutoPrune = yes                     # Prune expired volumes
+  Volume Retention = 365d             # one year
+  NextPool = Full
+  Storage = File
+}
+
+Pool {
+  Name = Full
+  Pool Type = Backup
+  Recycle = yes                       # Bacula can automatically recycle Volumes
+  AutoPrune = yes                     # Prune expired volumes
+  Volume Retention = 365d             # one year
+  Storage = DiskChanger
+}
index 154d3d3c11375f2aa732a141c4d7a0f084b4ce11..00594665b52f063489864c618840436cf86356cf 100644 (file)
@@ -51,6 +51,7 @@ Device {
 # Maximum File Size = 1000000
 }
 
+
 # 
 # Send all messages to the Director, 
 # mount messages also are sent to the email address
index 313dfe42494175bfe738166a2651ff88a7f9fb41..5a1d8d88a2aa7fa6ba85a888c243dfa44fdd8a9b 100644 (file)
@@ -51,6 +51,7 @@ Device {
 # Maximum File Size = 1000000
 }
 
+
 # 
 # Send all messages to the Director, 
 # mount messages also are sent to the email address
index bca32b328dab0afb09a06def385169ed26b1b3f2..b44c59f0349824f8921315124a8bbf2554c212e2 100755 (executable)
@@ -2,6 +2,7 @@
 #
 # Cleanup left over files -- both before and after test run
 #
+rm -rf /tmp/FileVolume* tmp/FileVolume*  
 rm -rf /tmp/TestVolume001 /tmp/bacula-restores /tmp/Small*
 rm -rf tmp/original tmp/bacula-restores tmp/Small* tmp/TestVolume*
 rm -rf tmp/restored tmp/largefile tmp/bscan.bsr tmp/log*.out
index 40f18605c3d242c929db0517418409278f730be6..87790955f0c9939589334ee7bab34c3d698b6f04 100755 (executable)
@@ -1,4 +1,7 @@
 #!/bin/sh
+#
+# Setup for using the Virtual Disk Changer (simulates tape changer)
+#
 /bin/cp -f scripts/bacula-dir-tape.conf bin/bacula-dir.conf
 /bin/cp -f scripts/bacula-sd-2disk.conf bin/bacula-sd.conf
 /bin/cp -f scripts/test-bacula-fd.conf bin/bacula-fd.conf
@@ -7,4 +10,3 @@ outf="tmp/sed_tmp"
 echo "s%# Autochanger = yes%  Autochanger = yes%g" >${outf}
 cp bin/bacula-dir.conf tmp/1
 sed -f ${outf} tmp/1 >bin/bacula-dir.conf
-
diff --git a/regress/scripts/copy-migration-confs b/regress/scripts/copy-migration-confs
new file mode 100755 (executable)
index 0000000..c7680bc
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+#
+# Setup for using the Virtual Disk Changer (simulates tape changer)
+#
+/bin/cp -f scripts/bacula-dir-migration.conf bin/bacula-dir.conf
+/bin/cp -f scripts/bacula-sd-migration.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
index 8357611c507075f7d263cdb57e75519c68477a24..d59606e52b58f45108bf4a75bdfa458f3d334789 100755 (executable)
@@ -42,9 +42,11 @@ sed -f ${out} ${cwd}/scripts/test-bacula-sd.conf.in >${cwd}/scripts/test-bacula-
 sed -f ${out} ${cwd}/scripts/test-console.conf.in >${cwd}/scripts/test-console.conf
 sed -f ${out} ${cwd}/scripts/crypto-bacula-fd.conf.in >${cwd}/scripts/crypto-bacula-fd.conf
 sed -f ${out} ${cwd}/scripts/bacula-dir-tape.conf.in >${cwd}/scripts/bacula-dir-tape.conf
+sed -f ${out} ${cwd}/scripts/bacula-dir-migration.conf.in >${cwd}/scripts/bacula-dir-migration.conf
 sed -f ${out} ${cwd}/scripts/win32-bacula-dir-tape.conf.in >${cwd}/scripts/win32-bacula-dir-tape.conf
 sed -f ${out} ${cwd}/scripts/bacula-sd-tape.conf.in >${cwd}/scripts/bacula-sd-tape.conf
 sed -f ${out} ${cwd}/scripts/bacula-sd-2tape.conf.in >${cwd}/scripts/bacula-sd-2tape.conf
+sed -f ${out} ${cwd}/scripts/bacula-sd-migration.conf.in >${cwd}/scripts/bacula-sd-migration.conf
 sed -f ${out} ${cwd}/scripts/bacula-sd-2disk.conf.in >${cwd}/scripts/bacula-sd-2disk.conf
 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
index 12d05f4cccd944c69fab191e098173f993357f70..33dd28d86acc8cd08034f96ca75057581e41d3ad 100644 (file)
@@ -115,7 +115,9 @@ end_test()
    else
       echo "  ===== $TestName Bacula source OK `date +%R:%S` ===== "
       echo "  ===== $TestName OK `date +%R:%S` ===== " >>test.out
-      scripts/cleanup
+      if test "$debug" -eq 0 ; then
+         scripts/cleanup
+      fi
    fi
 }
 
index d7d97bdbb070f014bfe8f0a3e10ab998382bb1f8..1a8c6db46d81711faf95f2dd039862cc38241aeb 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Create two blank tapes
+# Cread fresh virtual disk changer directory
 #
 rm -rf tmp/disk-changer
 mkdir tmp/disk-changer
index 9294c3368633f77946fb839b6978cdc7cdc0fa67..68eb9f452dfaae94d87f1c4f65f4f137366c8c3f 100755 (executable)
@@ -11,10 +11,6 @@ JobName=Inc2disk
 set_debug 0
 
 . config.out
-if test x${AUTOCHANGER} = x/dev/null ; then
-   echo "incremental-2disk test skipped. No autochanger."
-   exit
-fi
 
 stop_bacula
 cd bin
diff --git a/regress/tests/migration-job-test b/regress/tests/migration-job-test
new file mode 100755 (executable)
index 0000000..dc8dff7
--- /dev/null
@@ -0,0 +1,66 @@
+#!/bin/sh
+#
+# Run a simple backup of the Bacula build directory then migrate it
+#   to another device.
+#
+# This script uses the virtual disk autochanger
+#
+TestName="migration-job-test"
+JobName=MigrationJobSave
+. scripts/functions
+set_debug 0
+
+. config.out
+
+scripts/copy-migration-confs
+scripts/prepare-two-disks
+scripts/cleanup
+echo "${cwd}/build" >/tmp/file-list
+
+change_jobname NightlySave $JobName
+start_test
+
+#
+# Note, we first backup into Pool Default, 
+#          then Migrate into Pool Full. 
+#              Pool Default uses Storage=File
+#              Pool Full    uses Storage=DiskChanger
+
+# Write out bconsole commands
+cat <<END_OF_DATA >tmp/bconcmds
+@output
+messages
+@$out tmp/log1.out
+label storage=File volume=FileVolume001 Pool=Default
+label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0
+label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0
+list volumes
+run job=$JobName yes
+wait
+list volumes
+run job=migrate yes
+list volumes
+wait
+messages
+@# 
+@# now do a restore
+@#
+@$out tmp/log2.out
+restore where=${cwd}/tmp/bacula-restores select storage=DiskChanger
+unmark *
+mark *
+done
+yes
+wait
+messages
+@output
+quit
+END_OF_DATA
+
+run_bacula
+check_for_zombie_jobs storage=File
+stop_bacula
+
+check_two_logs
+check_restore_diff
+end_test
diff --git a/regress/tests/migration-test b/regress/tests/migration-test
new file mode 100755 (executable)
index 0000000..21bf764
--- /dev/null
@@ -0,0 +1,62 @@
+#!/bin/sh
+#
+# Run a simple backup of the Bacula build directory then migrate it
+#   to another device.
+#
+# This script uses the virtual disk autochanger
+#
+TestName="migration-test"
+JobName=MigrationSave
+. scripts/functions
+set_debug 1
+
+. config.out
+
+scripts/copy-migration-confs
+scripts/prepare-two-disks
+scripts/cleanup
+echo "${cwd}/build" >/tmp/file-list
+
+change_jobname NightlySave $JobName
+start_test
+
+#
+# Note, we first backup into Pool Default, then Migrate into
+#  Pool Full.  Pool Default uses Storage=File
+#              Pool Full    uses Storage=DiskChanger
+
+# Write out bconsole commands
+cat <<END_OF_DATA >tmp/bconcmds
+@$out /dev/null
+messages
+@$out tmp/log1.out
+label storage=File volume=FileVolume001 Pool=Default
+label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0
+label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0
+list volumes
+run job=$JobName yes
+list volumes
+run job=migrate
+list volumes
+@# 
+@# now do a restore
+@#
+@$out tmp/log2.out
+restore where=${cwd}/tmp/bacula-restores select storage=DiskChanger
+unmark *
+mark *
+done
+yes
+wait
+messages
+@output
+quit
+END_OF_DATA
+
+run_bacula
+check_for_zombie_jobs storage=File
+stop_bacula
+
+check_two_logs
+check_restore_diff
+end_test