]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/migration-volume-test
Updates
[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 set_debug 0 
12
13 . config.out
14
15 scripts/cleanup
16 scripts/copy-migration-confs
17 scripts/prepare-two-disks
18 echo "${cwd}/build" >/tmp/file-list
19 #cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
20 #sed "s%# Maximum File Size%  Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
21
22 change_jobname NightlySave $JobName
23 start_test
24
25 #
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
30
31 # Write out bconsole commands
32 cat <<END_OF_DATA >tmp/bconcmds
33 @output
34 messages
35 @$out tmp/log1.out
36 label storage=File volume=FileVolume001 Pool=Default
37 label storage=File volume=FileVolume002 Pool=Default
38 update Volume=FileVolume001 MaxVolBytes=3000000 pool=Default
39 label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0
40 label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0
41 @# 
42 run job=$JobName yes
43 wait
44 run job=$JobName yes
45 wait
46 update volume=FileVolume001 VolStatus=Used
47 update volume=FileVolume002 VolStatus=Used
48 @#list volumes
49 @#list jobs
50 @# should migrate two jobs
51 @# setdebug level=11 dir
52 @echo "Run migrate-volume Job"
53 @#setdebug level=100 dir
54 run job=migrate-volume yes
55 @sleep 5 
56 list jobs
57 llist jobid=1
58 llist jobid=2
59 llist jobid=3
60 llist jobid=4
61 llist jobid=5
62 status storage=DiskChanger
63 wait
64 list volumes
65 list jobs
66 llist jobid=1
67 llist jobid=2
68 llist jobid=3
69 llist jobid=4
70 llist jobid=5
71 sql
72 select * from JobMedia where JobId=1;
73
74 @# Now run a second Migration job, which should do nothing
75 run job=migrate-volume yes
76 wait
77 list jobs
78 @# ensure we don't pickup old backup by purging volume
79 @# purge volume=FileVolume001
80 @# purge volume=FileVolume002
81 @echo "Now do a restore"
82 messages
83 @# 
84 @# now do a restore
85 @#
86 @$out tmp/log2.out
87 restore where=${cwd}/tmp/bacula-restores select storage=DiskChanger
88 unmark *
89 mark *
90 done
91 yes
92 wait
93 messages
94 @output
95 quit
96 END_OF_DATA
97
98 run_bacula
99 check_for_zombie_jobs storage=File
100 stop_bacula
101
102 exit
103
104 check_two_logs
105 check_restore_diff
106 end_test