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