]> git.sur5r.net Git - bacula/bacula/commitdiff
ebl Apply Steve Polyack patch to add DirSourceAddress and FDSourceAddress
authorEric Bollengier <eric@eb.homelinux.org>
Tue, 26 May 2009 13:45:05 +0000 (13:45 +0000)
committerEric Bollengier <eric@eb.homelinux.org>
Tue, 26 May 2009 13:45:05 +0000 (13:45 +0000)
     directives. That permits to choose the outgoing interface.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8864 91ce42f0-d328-0410-95d8-f526ca767f89

regress/DartTestfile.txt.in
regress/all-disk-tests
regress/tests/source-addr-test [new file with mode: 0755]

index da0b92b837274b84893ed5f7c4dc6dbf43c65590..c3c3f666e9f4e528b128206ec27002d089166402 100644 (file)
@@ -57,6 +57,7 @@ ADD_TEST(disk:2drive-concurrent-test "@regressdir@/tests/2drive-concurrent-test"
 ADD_TEST(disk:2drive-incremental-2disk "@regressdir@/tests/2drive-incremental-2disk")
 ADD_TEST(disk:2drive-swap-test "@regressdir@/tests/2drive-swap-test")
 ADD_TEST(disk:2drive-2job-test "@regressdir@/tests/2drive-2job-test")
+ADD_TEST(disk:source-addr-test "@regressdir@/tests/source-addr-test")
 ADD_TEST(disk:stats-test "@regressdir@/tests/stats-test")
 ADD_TEST(disk:three-pool-test "@regressdir@/tests/three-pool-test")
 ADD_TEST(disk:tls-test "@regressdir@/tests/tls-test")
index 4de54856d27b90475df953f1364fd0f8c248ebc8..f9b036071b42a4659c527a80376628cb6a3a24b6 100755 (executable)
@@ -42,6 +42,7 @@ nice tests/restore2-by-file-test
 nice tests/restore-by-file-test
 nice tests/restore-disk-seek-test
 nice tests/runscript-test
+nice tests/source-addr-test
 nice tests/stats-test
 nice tests/six-vol-test
 nice tests/span-vol-test
diff --git a/regress/tests/source-addr-test b/regress/tests/source-addr-test
new file mode 100755 (executable)
index 0000000..060b911
--- /dev/null
@@ -0,0 +1,110 @@
+#!/bin/sh
+#
+# Run a simple backup of the Bacula build directory
+#   then restore it.
+#
+TestName="source-addr-test"
+JobName=backup
+. scripts/functions
+
+scripts/cleanup
+scripts/copy-confs
+
+#
+# Zap out any schedule in default conf file so that
+#  it doesn't start during our test
+#
+outf="tmp/sed_tmp"
+echo "s%  Schedule =%# Schedule =%g" >${outf}
+cp $scripts/bacula-dir.conf $tmp/1
+sed -f ${outf} $tmp/1 >$scripts/bacula-dir.conf
+
+PATH=$PATH:/sbin:/usr/sbin
+#
+# Deduce a primary IP address by examining
+#  the interface defined by INTERFACE=
+#
+os=`uname`
+if [ $os = 'FreeBSD' ]; then
+   INTERFACE=bge0
+   IP=`ifconfig ${INTERFACE} | perl -ne '/inet (.+?) / && print $1'`
+elif [ $os = 'Linux' ]; then
+   INTERFACE=eth0
+   IP=`ifconfig ${INTERFACE} | perl -ne '/inet addr:(.+?) / && print $1'`
+else
+   echo "Can't run this test on $os"
+   exit 0
+fi
+outf="tmp/sed_tmp"
+echo "s/PidDirectory/DirSourceAddress=$IP; PidDirectory/g" > $outf
+echo "s/Address =/Address = 127.0.0.1 #/g" >> $outf 
+cp $scripts/bacula-dir.conf $tmp/1
+sed -f ${outf} ${cwd}/tmp/1 > $scripts/bacula-dir.conf 
+
+# Set source address on the FD as well
+echo "s/Pid Directory/FDSourceAddress=$IP; Pid Directory/g" >$outf
+cp $scripts/bacula-fd.conf $tmp/2
+sed -f ${outf} ${cwd}/tmp/2 > $scripts/bacula-fd.conf
+
+DIRPORT=$BASEPORT
+FDPORT=$(($BASEPORT + 1))
+SDPORT=$(($BASEPORT + 2))
+
+change_jobname Client1 $JobName
+start_test
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@output /dev/null
+messages
+@$out ${cwd}/tmp/log1.out
+@#label volume=TestVolume001 storage=File pool=Default
+@#setdebug level=100 storage=File
+run job=$JobName yes
+@sleep 3
+messages
+quit
+END_OF_DATA
+
+run_bacula
+
+print_debug "Connections to SD sourced from ${IP}:"
+netstat -tan | grep -e "127.0.0.1(.|:)$SDPORT .* ${IP}" > $tmp/log3.out
+if [ $? -ne 0 ]; then
+   bstat=2
+   print_debug "Couldn't detect a connection to the SD sourced from SourceAddress ${IP}" 
+fi
+
+print_debug "Connections to FD sourced from ${IP}:"
+netstat -tan | grep -e "127.0.0.1(.|:)$FDPORT .* ${IP}" >> $tmp/log3.out
+if [ $? -ne 0 ]; then
+   bstat=2
+   print_debug "Couldn't detect a connection to the FD sourced from SourceAddress ${IP}"
+fi
+
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@output /dev/null
+messages
+@$out ${cwd}/tmp/log1.out
+label volume=TestVolume001 storage=File pool=Default
+@#setdebug level=100 storage=File
+wait
+messages
+@# 
+@# now do a restore
+@#
+@$out ${cwd}/tmp/log2.out  
+restore where=${cwd}/tmp/bacula-restores select all done
+yes
+wait
+messages
+@$out
+quit
+END_OF_DATA
+
+run_bconsole
+check_for_zombie_jobs storage=File
+stop_bacula
+check_two_logs
+check_restore_diff
+end_test