scripts/prepare-disk-changer
# create a new bacula-sd.confs
-for sd in 2 3 4; do
- perl -ne "\$sd=$sd;\$tmp='$tmp';"'
- if (/SDPort = /) { $_ =~ s/(\d+)/1810$sd/}
- if (/Name = .+?-sd/) { $_ =~ s/-sd/-sd$sd/}
- if (/WorkingDirectory/) { $_ = "$tmp/$sd"}
- if (/Pid Directory/) { $_ = "$tmp/$sd"}
- if (/(Archive|Changer) Device/) { $_ =~ s:$tmp:$tmp/$sd:}
+for i in 2 3 4; do
+ perl -ne "\$i='$i';\$tmp='$tmp';"'
+ if (/Name =/ ) { $_ =~ s/-sd/-$i-sd/}
+ if (/SDPort = /) { $_ =~ s/(\d+)/1810$i/}
+ if (/mediatype = /) { $_ =~ s/FileMedia/FileMedia$i/}
+ if (/WorkingDirectory/) { $_ =~ s:working:tmp/$i:}
+ if (/Pid Directory/) { $_ =~ s:working:tmp/$i:}
+ if (/(Archive|Changer) Device/) { $_ =~ s:$tmp:$tmp/$i:}
print;
- ' $conf/bacula-sd.conf > $conf/bacula-sd$sd.conf
- mkdir -p ${working}$sd
- sed 's/bacula-sd.conf/bacula-sd$sd.conf/' $scripts/bacula-ctl-sd \
- > $tmp/bacula-ctl-sd$sd
- chmod +x $tmp/bacula-ctl-sd$sd
- mkdir -p $tmp/$sd
+ ' $conf/bacula-sd.conf > $conf/bacula-sd$i.conf
+ mkdir -p ${tmp}/$i
+ sed "s/bacula-sd.conf/bacula-sd${i}.conf/" $scripts/bacula-ctl-sd \
+ > $tmp/bacula-ctl-sd$i
+ chmod +x $tmp/bacula-ctl-sd$i
+ mkdir -p $tmp/$i
done
# Patch up bacula-dir.conf
change_jobname $JobName
start_test
+# Stop SDs
+for sd in 2 3 4; do
+ $tmp/bacula-ctl-sd$sd stop &> /dev/null
+done
+
+sleep 2
+
+# Start SDs
+for sd in 2 3 4; do
+ $tmp/bacula-ctl-sd$sd start &> /dev/null
+done
+
# Write out bconsole commands
cat <<END_OF_DATA >${cwd}/tmp/bconcmds
-@$out /dev/null
+@out /dev/null
messages
@$out ${cwd}/tmp/log1.out
label storage=tape volume=TestVolume001 Pool=Default slot=1 drive=0
label storage=File volume=TestVolume002 Pool=Default
+label storage=File2 volume=File2-Vol001 Pool=Default
+label storage=File3 volume=File3-Vol001 Pool=Default
+label storage=File4 volume=File4-Vol001 Pool=Default
run job=$JobName storage=tape yes
wait
messages
+@exec "touch $cwd/build/po/fr.po"
+run job=$JobName storage=File yes
+wait
+messages
+@exec "touch $cwd/build/po/de.po"
+run job=$JobName storage=File2 yes
+wait
+messages
+@exec "touch $cwd/build/po/it.po"
+run job=$JobName storage=File3 yes
+wait
+messages
+@exec "touch $cwd/build/po/es.po"
+run job=$JobName storage=File4 yes
+wait
+messages
quit
END_OF_DATA
-# Start SDs
-for sd in 2 3 4; do
- $tmp/bacula-ctl-sd$sd start &> /dev/null
-done
-
run_bacula
echo "ficheriro1.txt" >${cwd}/build/po/ficheriro1.txt
cat <<END_OF_DATA >${cwd}/tmp/bconcmds
-@$out /dev/null
+@out /dev/null
messages
@$out ${cwd}/tmp/log1.out
@# Force Incremental on the second Volume
+@exec "touch $cwd/build/po/fi.po"
run level=Incremental storage=File job=$JobName yes
wait
messages
+@exec "touch $cwd/build/po/uk.po"
+run level=Incremental storage=File2 job=$JobName yes
+wait
+messages
+@exec "touch $cwd/build/po/sv.po $cwd/build/po/test.po"
+run level=Incremental storage=File3 job=$JobName yes
+wait
+messages
+@exec "touch $cwd/build/po/README"
+run level=Incremental storage=File4 job=$JobName yes
+wait
+messages
@#
@# now do a restore
@#
-@$out ${cwd}/tmp/log2.out
+@$out ${cwd}/tmp/log22.out
+setdebug trace=1 level=110 client
+setdebug trace=1 level=110 director
+restore where=${cwd}/tmp/bacula-restores select all done yes
+wait
+messages
+@$out ${cwd}/tmp/status.out
+status all
+@exec "touch $cwd/build/po/POTFILES"
+@$out ${cwd}/tmp/log1.out
+run level=Incremental storage=File4 job=$JobName yes
+wait
+messages
+@# run a job that will wait for a volume
+@$out ${cwd}/tmp/log23.out
+@exec "touch $cwd/build/po/ChangeLog"
+run level=Incremental pool=Special storage=File3 job=$JobName yes
+@sleep 5
+messages
+status dir
+status storage=File3
+@sleep 3
+@#
+@# now do a restore with a backup that takes a drive
+@#
setdebug trace=1 level=110 client
setdebug trace=1 level=110 director
restore where=${cwd}/tmp/bacula-restores select all done yes
+@sleep 10
+messages
+status dir
+label storage=File3 volume=test3 pool=Special
+mount storage=File3
wait
messages
show storage
run_bconsole
check_for_zombie_jobs storage=File
+check_for_zombie_jobs storage=File2
+check_for_zombie_jobs storage=File3
+check_for_zombie_jobs storage=File4
check_for_zombie_jobs storage=tape
stop_bacula
$tmp/bacula-ctl-sd$sd stop &> /dev/null
done
+# we have two restore to test
+cp $tmp/log22.out $tmp/log2.out
check_two_logs
+cp $tmp/log23.out $tmp/log2.out
+check_two_logs
+
check_restore_diff
end_test