3 # Run a simple backup of the Bacula build directory then migrate it
4 # to another device, then see how prune code handle that
6 # This script uses the virtual disk autochanger
8 TestName="prune-migration-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
19 dircfg=$conf/bacula-dir.conf
20 $bperl -e "add_attribute('$dircfg', 'AutoPrune', 'No', 'Client')"
21 $bperl -e "add_attribute('$dircfg', 'Job Retention', '1s', 'Client')"
26 # Note, we first backup into Pool Default,
27 # then Migrate into Pool Full.
28 # Pool Default uses Storage=File
29 # Pool Full uses Storage=DiskChanger
31 # Write out bconsole commands
32 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
35 @$out ${cwd}/tmp/log1.out
36 setdebug level=000 storage=File
37 label storage=File volume=FileVolume001 Pool=Default
38 label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0
39 label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0
40 @# run two jobs (both will be migrated)
46 @# should migrate two jobs
47 run job=migrate-job yes
53 @# Now do another backup, but level Incremental
55 run job=$JobName level=Incremental yes
59 @################################################################
60 @$out $cwd/tmp/log10.out
61 setdebug level=1 director
65 @################################################################
68 @$out ${cwd}/tmp/log2.out
70 restore where=${cwd}/tmp/bacula-restores select storage=DiskChanger
82 check_for_zombie_jobs storage=File
88 # Now we will verify that the pruning code is working as expected. Each time,
89 # we run 'list jobs', 'prune', 'list jobs'. check_prune_list ensures that jobids
90 # in argument are present in the first 'list jobs', the 'prune' command deletes
91 # them (same number), and checks that the last 'list jobs' doesn't contain them
92 # anymore. See scripts/functions.pm for details.
95 $bperl -e "check_prune_list('$tmp/log10.out',1,2,3,4,5,7)"
96 estat=$(($estat + $?))