3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
8 # Show the broken media bug(s) again. Test by Graham Keeling.
10 # This test will wait forever whilst the last job waits for an appendable
12 # You can run ./bin/bconsole -c bin/bconsole.conf from within the regress
13 # directory, and use 'list media' to see where the volumes have ended up, as
14 # well as any other commands you like.
17 # - Write two jobs to two different volumes.
18 # - Purge them manually. The two volumes end up in the Scratch pool.
19 # - Start a large job. It takes a volume from the Scratch pool, places it
20 # in its own pool and starts writing to it.
21 # - While the first job is still running, start a second job.
22 # - A sort of chaos then follows.
23 # The second job sees that there are no JobMedia records associated with the
24 # first volume (which is in a separate pool), and purges it, moving it
25 # through Scratch and into its own pool. It then decides not to use that
26 # volume and hangs around 'waiting for an appendable Volume' - even though
27 # there is the other purged volume sitting untouched in the Scratch pool.
28 # Meanwhile, the first job finishes and sets the volume status of its volume
29 # (that is now in the wrong pool) to 'Used'.
31 TestName="broken-media-bug-2-test"
36 /bin/cp -f scripts/broken-media-bug-2-bacula-dir.conf bin/bacula-dir.conf
37 /bin/cp -f scripts/broken-media-bug-2-bacula-sd.conf bin/bacula-sd.conf
38 /bin/cp -f scripts/test-bacula-fd.conf bin/bacula-fd.conf
39 /bin/cp -f scripts/test-console.conf bin/bconsole.conf
40 hugefile=${cwd}/build/hugefile
42 echo "${cwd}/build" >${cwd}/tmp/file-list
46 echo "Creating huge ${hugefilesize}M file..."
47 dd if=/dev/urandom of="$hugefile" bs=1M count="$hugefilesize"
50 cat >tmp/bconcmds <<END_OF_DATA
54 setdebug level=150 storage=File
55 setdebug level=150 Director
56 label storage=File volume=TestVolume0001 pool=Scratch
57 label storage=File volume=TestVolume0002 pool=Scratch
82 # Give the first job a bit of time to get going.
85 cat >tmp/bconcmds <<END_OF_DATA
86 setdebug level=150 storage=File
87 setdebug level=150 Director
95 restore fileset=Set1 where=${cwd}/tmp/bacula-restores select all storage=File done
105 check_for_zombie_jobs storage=File