3 # Run a simple backup of the Bacula build directory then migrate it
4 # to another device, and see if PurgeMigrateJob works as expected.
6 # This script uses the virtual disk autochanger
8 TestName="migration-job-purge-test"
9 JobName=MigrationJobSave
14 scripts/copy-migration-confs
15 scripts/prepare-disk-changer
16 echo "${cwd}/build" >${cwd}/tmp/file-list
18 change_jobname NightlySave $JobName
20 $bperl -e 'add_attribute("$conf/bacula-dir.conf", "PurgeMigrateJob", "yes", "Job", "migrate-job")'
25 # Note, we first backup into Pool Default,
26 # then Migrate into Pool Full.
27 # Pool Default uses Storage=File
28 # Pool Full uses Storage=DiskChanger
30 # Write out bconsole commands
31 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
34 @$out ${cwd}/tmp/log1.out
35 setdebug level=000 storage=File
36 label storage=File volume=FileVolume001 Pool=Default
37 label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0
38 label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0
39 @# run two jobs (both will be migrated)
45 @#setdebug level=100 dir
46 @# should migrate two jobs
47 @#setdebug level=51 storage=DiskChanger
48 run job=migrate-job yes
51 @# purge volume=FileVolume001
57 @# Now do another backup, but level Incremental
59 run job=$JobName level=Incremental yes
63 @# This final job that runs should be Incremental and
64 @# not upgraded to full.
69 @$out ${cwd}/tmp/log2.out
71 restore where=${cwd}/tmp/bacula-restores select storage=DiskChanger
79 @$out ${cwd}/tmp/log3.out
86 check_for_zombie_jobs storage=File
92 # Shouldn't find MigrationJobSave jobid 1 or 2 in log3.out
93 grep MigrationJobSave $tmp/log3.out
95 print_debug "ERROR: found purged jobids in $tmp/log3.out"