1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

ctdb-tests: Move local daemon configuration creation into setup_ctdb()

These files don't need to be re-generated on every restart.  They can
be generated once when CTDB is first started.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12170

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2016-08-23 10:59:25 +10:00 committed by Amitay Isaacs
parent eb38d02eb7
commit 3c87868d20

View File

@ -49,14 +49,12 @@ setup_ctdb ()
mkdir -p "${TEST_VAR_DIR}/test.db/persistent" mkdir -p "${TEST_VAR_DIR}/test.db/persistent"
local public_addresses_all="${TEST_VAR_DIR}/public_addresses_all" local public_addresses_all="${TEST_VAR_DIR}/public_addresses_all"
local no_public_addresses="${TEST_VAR_DIR}/no_public_addresses.txt" rm -f $CTDB_NODES $public_addresses_all
rm -f $CTDB_NODES $public_addresses_all $no_public_addresses
# If there are (strictly) greater than 2 nodes then we'll randomly # If there are (strictly) greater than 2 nodes then we'll randomly
# choose a node to have no public addresses. # choose a node to have no public addresses.
local no_public_ips=-1 local no_public_ips=-1
[ $TEST_LOCAL_DAEMONS -gt 2 ] && no_public_ips=$(($RANDOM % $TEST_LOCAL_DAEMONS)) [ $TEST_LOCAL_DAEMONS -gt 2 ] && no_public_ips=$(($RANDOM % $TEST_LOCAL_DAEMONS))
echo "$no_public_ips" >$no_public_addresses
# When running certain tests we add and remove eventscripts, so we # When running certain tests we add and remove eventscripts, so we
# need to be able to modify the events.d/ directory. Therefore, # need to be able to modify the events.d/ directory. Therefore,
@ -90,20 +88,12 @@ setup_ctdb ()
fi fi
fi fi
done done
}
daemons_start_1 () local pnn
{ for pnn in $(seq 0 $(($TEST_LOCAL_DAEMONS - 1))) ; do
local pnn="$1"
local public_addresses_all="${TEST_VAR_DIR}/public_addresses_all"
local public_addresses_mine="${TEST_VAR_DIR}/public_addresses.${pnn}" local public_addresses_mine="${TEST_VAR_DIR}/public_addresses.${pnn}"
local no_public_addresses="${TEST_VAR_DIR}/no_public_addresses.txt"
local public_addresses local public_addresses
local no_public_ips=-1
[ -r $no_public_addresses ] && read no_public_ips <$no_public_addresses
if [ "$no_public_ips" = $pnn ] ; then if [ "$no_public_ips" = $pnn ] ; then
echo "Node $no_public_ips will have no public IPs." echo "Node $no_public_ips will have no public IPs."
public_addresses="/dev/null" public_addresses="/dev/null"
@ -136,6 +126,15 @@ EOF
env | env |
grep '^CTDB_' | grep '^CTDB_' |
sed -e 's@=\([^"]\)@="\1@' -e 's@[^"]$@&"@' -e 's@="$@&"@' >>"$conf" sed -e 's@=\([^"]\)@="\1@' -e 's@[^"]$@&"@' -e 's@="$@&"@' >>"$conf"
done
}
daemons_start_1 ()
{
local pnn="$1"
local pidfile="${TEST_VAR_DIR}/ctdbd.${pnn}.pid"
local conf="${TEST_VAR_DIR}/ctdbd.${pnn}.conf"
# We'll use "pkill -f" to kill the daemons with # We'll use "pkill -f" to kill the daemons with
# "ctdbd --sloppy-start --nopublicipcheck" as context. # "ctdbd --sloppy-start --nopublicipcheck" as context.