1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

When running with local daemons, provided there is more than 2 of

them, randomly pick a single node that will not have any public IPs
assigned.  This will make life a bit more interesting and will
simulate what happens on real clusters with a management node.  Some
tests were disabling a node to implicitly trigger a ctdb restart - now
use an explicit restart of ctdb when it is required.
17_ctdb_config_delete_ip.sh now randomly chooses a public IP on any
node to disable - this works around a problem where the hardcoded node
might not have any public addresses.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 3d59783c0e9478f4766c380945d6200fc654f5d9)
This commit is contained in:
Martin Schwenke 2008-12-08 08:15:18 +11:00
parent 805c5bf1f3
commit c9ca8ccc23
4 changed files with 29 additions and 29 deletions

View File

@ -397,6 +397,11 @@ start_daemons ()
local public_addresses=$var_dir/public_addresses.txt
rm -f $nodes $public_addresses
# If there are (strictly) greater than 2 nodes then we'll randomly
# choose a node to have no public addresses.
local no_public_ips=-1
[ $num_nodes -gt 2 ] && no_public_ips=$(($RANDOM % $num_nodes + 1))
local i
for i in $(seq 1 $num_nodes) ; do
if [ "${CTDB_USE_IPV6}x" != "x" ]; then
@ -404,9 +409,11 @@ start_daemons ()
ip addr add ::$i/128 dev lo
else
echo 127.0.0.$i >> $nodes
# 2 public addresses per node, just to make things interesting.
echo "192.0.2.$i/24 lo" >> $public_addresses
echo "192.0.2.$(($i + $num_nodes))/24 lo" >> $public_addresses
# 2 public addresses on most nodes, just to make things interesting.
if [ $i -ne $no_public_ips ] ; then
echo "192.0.2.$i/24 lo" >> $public_addresses
echo "192.0.2.$(($i + $num_nodes))/24 lo" >> $public_addresses
fi
fi
done

View File

@ -104,11 +104,13 @@ if [ -n "$add_ip" ] ; then
echo "Waiting for IP to be added..."
wait_until 60 ips_are_on_nodeglob $test_node $test_node_ips ${add_ip%/*}
echo "That worked! Disabling node $test_node to force a restart..."
try_command_on_node $test_node ctdb disable
echo "That worked!"
else
echo "BAD: Unable to find IP address to add."
testfailures=1
fi
echo "Restarting cluster to restore configuration..."
restart_ctdb
ctdb_test_exit

View File

@ -38,28 +38,19 @@ set -e
onnode 0 $CTDB_TEST_WRAPPER cluster_is_healthy
test_node=1
echo "Getting list of public IPs on node ${test_node}..."
try_command_on_node $test_node 'ctdb ip -n all | sed -e "1d"'
test_node_ips=""
num_ips=0
while read ip pnn ; do
if [ "$pnn" = "$test_node" ] ; then
test_node_ips="${test_node_ips}${test_node_ips:+ }${ip}"
num_ips=$(($num_ips + 1))
fi
done <<<"$out" # bashism to avoid problem setting variable in pipeline.
echo "Node ${test_node} has IPs: $test_node_ips"
echo "Getting list of public IPs..."
try_command_on_node -v 0 'ctdb ip -n all | sed -e "1d"'
# Select an IP/node to remove.
num_ips=$(echo "$out" | wc -l)
num_to_remove=$(($RANDOM % $num_ips))
ips=$test_node_ips
for i in $(seq 1 $num_to_remove) ; do
ips="${ips#* }"
done
ip_to_remove="${ips%% *}"
# Find the details in the list.
i=0
while [ $i -lt $num_to_remove ] ; do
read ip_to_remove test_node
i=$(($i + 1))
done <<<"$out"
echo "Attempting to remove ${ip_to_remove} from node ${test_node}."
try_command_on_node $test_node ctdb delip $ip_to_remove
@ -74,8 +65,8 @@ while read ip pnn ; do
done <<<"$out" # bashism to avoid problem setting variable in pipeline.
if [ "${test_node_ips/${ip_to_remove}}" = "$test_node_ips" ] ; then
echo "That worked! Disabling node $test_node to force a restart..."
try_command_on_node $test_node ctdb disable
echo "That worked! Restarting cluster to restore configuration..."
restart_ctdb
else
echo "BAD: The remove IP address is still there!"
testfailures=1

View File

@ -62,8 +62,8 @@ try_command_on_node -v 0 ctdb disablemonitor -n $test_node
onnode 0 $CTDB_TEST_WRAPPER wait_until_node_has_status $test_node monoff
echo "That worked! Disabling node $test_node to force a restart..."
echo "That worked! Restarting cluster to restore configuration..."
try_command_on_node $test_node ctdb disable
restart_ctdb
ctdb_test_exit