3 # Show the broken media bug(s) again. Test by Graham Keeling.
5 # This test will wait forever whilst the last job waits for an appendable
7 # You can run ./bin/bconsole -c bin/bconsole.conf from within the regress
8 # directory, and use 'list media' to see where the volumes have ended up, as
9 # well as any other commands you like.
12 # - Write two jobs to two different volumes.
13 # - Purge them manually. The two volumes end up in the Scratch pool.
14 # - Start a large job. It takes a volume from the Scratch pool, places it
15 # in its own pool and starts writing to it.
16 # - While the first job is still running, start a second job.
17 # - A sort of chaos then follows.
18 # The second job sees that there are no JobMedia records associated with the
19 # first volume (which is in a separate pool), and purges it, moving it
20 # through Scratch and into its own pool. It then decides not to use that
21 # volume and hangs around 'waiting for an appendable Volume' - even though
22 # there is the other purged volume sitting untouched in the Scratch pool.
23 # Meanwhile, the first job finishes and sets the volume status of its volume
24 # (that is now in the wrong pool) to 'Used'.
26 TestName="broken-media-bug-2-test"
31 /bin/cp -f scripts/broken-media-bug-2-bacula-dir.conf bin/bacula-dir.conf
32 /bin/cp -f scripts/broken-media-bug-2-bacula-sd.conf bin/bacula-sd.conf
33 /bin/cp -f scripts/test-bacula-fd.conf bin/bacula-fd.conf
34 /bin/cp -f scripts/test-console.conf bin/bconsole.conf
35 hugefile=${cwd}/build/hugefile
37 echo "${cwd}/build" >${cwd}/tmp/file-list
41 echo "Creating huge ${hugefilesize}M file..."
42 dd if=/dev/urandom of="$hugefile" bs=1M count="$hugefilesize"
45 cat >tmp/bconcmds <<END_OF_DATA
49 setdebug level=150 storage=File
50 setdebug level=150 Director
51 label storage=File volume=TestVolume0001 pool=Scratch
52 label storage=File volume=TestVolume0002 pool=Scratch
77 # Give the first job a bit of time to get going.
80 cat >tmp/bconcmds <<END_OF_DATA
81 setdebug level=150 storage=File
82 setdebug level=150 Director
90 restore fileset=Set1 where=${cwd}/tmp/bacula-restores select all storage=File done
100 check_for_zombie_jobs storage=File