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