]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/2media-virtual-test
Make out of freespace non-fatal for removable devices -- i.e. behaves like tape
[bacula/bacula] / regress / tests / 2media-virtual-test
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2017 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6 # Test running a Virtual disk changer with two Media Types
7 #   and two different Archive directories
8 #   This tests bug #8033 where a Volume is not truncated,
9 #   but a second Volume of the same name is made in the wrong
10 #   directory.
11 #
12 TestName="2media-virtual-test"
13 JobName=Virtual
14 . scripts/functions
15
16 ${rscripts}/cleanup
17 cp -f ${rscripts}/bacula-dir-2media-virtual.conf ${conf}/bacula-dir.conf
18 cp -f ${rscripts}/bacula-sd-2media-virtual.conf ${conf}/bacula-sd.conf
19 cp -f ${rscripts}/test-bacula-fd.conf ${conf}/bacula-fd.conf
20 rm -rf ${tmp}/disk ${tmp}/disk1
21 mkdir -p ${tmp}/disk ${tmp}/disk1
22
23 disable_plugins
24 echo "$cwd/build/src/dird" >${cwd}/tmp/file-list
25
26 start_test
27
28 cat <<END_OF_DATA >${tmp}/bconcmds
29 @output /dev/null
30 messages
31 @$out ${tmp}/log1.out
32 @#setdebug level=15 storage=Virtual
33 @#setdebug level=200 client
34 @#setdebug level=100 director
35 label storage=Virtual pool=Default volume=TestVolume001 drive=0 slot=0
36 label Storage=vDrive-3 pool=Default volume=TestVolume002 drive=2 slot=0
37 run job=$JobName level=Full storage=Virtual yes
38 wait
39 update volume=TestVolume001 volstatus=Used actiononpurge=truncate
40 run job=$JobName level=Full storage=vDrive-3 yes
41 wait
42 messages
43 list volumes
44 llist volume=TestVolume001
45 purge volume=TestVolume001
46 update volume=TestVolume002 volstatus=Used actiononpurge=truncate
47 purge volume=TestVolume002
48 purge volume action=truncate pool=Default storage=Virtual drive=0
49 purge volume action=truncate pool=Default storage=Virtual drive=2
50 list volumes
51 quit
52 END_OF_DATA
53
54 run_bacula
55 check_for_zombie_jobs storage=Virtual
56 stop_bacula
57
58 # No TestVolume002 should be in ${tmp}/disk
59 ls -l ${tmp}/disk | grep -q TestVolume002
60 if [ $? = 0 ]; then
61    print_debug "ERROR: Volume TestVolume2 incorrectly created in ${tmp}/disk"
62    dstat=1
63 fi
64
65 if [ x$REGRESS_DEBUG != x ] ; then
66    ls -l ${tmp}/disk
67    ls -l ${tmp}/disk1
68 fi
69
70 exit
71
72 #check_two_logs
73 #check_restore_diff
74 end_test