]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/migration-volume-test
Make out of freespace non-fatal for removable devices -- i.e. behaves like tape
[bacula/bacula] / regress / tests / migration-volume-test
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6
7 #
8 # Run a backup of the Bacula build directory on two Volumes
9 #   then migrate it to another device.             
10 #
11 # This script uses the virtual disk autochanger
12 #
13 TestName="migration-volume-test"
14 JobName=MigVolBackup
15 . scripts/functions
16
17
18 scripts/cleanup
19 scripts/copy-migration-confs
20 scripts/prepare-disk-changer
21 echo "${cwd}/build" >${cwd}/tmp/file-list
22 #cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
23 #sed "s%# Maximum File Size%  Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
24
25 change_jobname NightlySave $JobName
26 start_test
27
28 #
29 # Note, we first backup into Pool Default, 
30 #          then Migrate into Pool Full. 
31 #              Pool Default uses Storage=File
32 #              Pool Full    uses Storage=DiskChanger
33
34 # Write out bconsole commands
35 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
36 @output /dev/null
37 messages
38 @$out ${cwd}/tmp/log1.out
39 label storage=File volume=FileVolume001 Pool=Default
40 label storage=File volume=FileVolume002 Pool=Default
41 update Volume=FileVolume001 MaxVolBytes=3000000 pool=Default
42 label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0
43 label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0
44 @# 
45 run job=$JobName yes
46 wait
47 run job=$JobName yes
48 wait
49 update volume=FileVolume001 VolStatus=Used
50 update volume=FileVolume002 VolStatus=Used
51 @#list volumes
52 @#list jobs
53 @# should migrate two jobs
54 @# setdebug level=11 dir
55 @echo "Run migrate-volume Job"
56 @#setdebug level=100 dir
57 run job=migrate-volume yes
58 @sleep 5 
59 list jobs
60 llist jobid=1
61 llist jobid=2
62 llist jobid=3
63 llist jobid=4
64 llist jobid=5
65 status storage=DiskChanger
66 wait
67 list volumes
68 list jobs
69 llist jobid=1
70 llist jobid=2
71 llist jobid=3
72 llist jobid=4
73 llist jobid=5
74 sql
75 select * from JobMedia where JobId=1;
76
77 @# Now run a second Migration job, which should do nothing
78 run job=migrate-volume yes
79 wait
80 list jobs
81 @# ensure we don't pickup old backup by purging volume
82 @# purge volume=FileVolume001
83 @# purge volume=FileVolume002
84 @echo "Now do a restore"
85 messages
86 @# 
87 @# now do a restore
88 @#
89 @$out ${cwd}/tmp/log2.out
90 restore where=${cwd}/tmp/bacula-restores select storage=DiskChanger
91 unmark *
92 mark *
93 done
94 yes
95 wait
96 messages
97 quit
98 END_OF_DATA
99
100 run_bacula
101 check_for_zombie_jobs storage=File
102 stop_bacula
103
104 check_two_logs
105 check_restore_diff
106 end_test