2008-12-15 09:52:12 +03:00
#!/bin/bash
test_info( )
{
cat <<EOF
Verify that 'ctdb moveip' allows movement of public IPs between cluster nodes.
2014-09-12 07:20:43 +04:00
This test does not do any network level checks to make sure IP
addresses are actually on interfaces. It just consults "ctdb ip" .
2008-12-15 09:52:12 +03:00
2014-09-12 07:20:43 +04:00
To work, this test unsets DeterministicIPs and sets NoIPFailback.
2008-12-15 09:52:12 +03:00
EOF
}
2012-04-18 08:55:21 +04:00
. " ${ TEST_SCRIPTS_DIR } /integration.bash "
2008-12-15 09:52:12 +03:00
ctdb_test_init " $@ "
set -e
2009-07-06 11:52:11 +04:00
cluster_is_healthy
2008-12-15 09:52:12 +03:00
2009-06-19 05:40:09 +04:00
# Reset configuration
ctdb_restart_when_done
2008-12-15 09:52:12 +03:00
2014-09-12 07:20:43 +04:00
select_test_node_and_ips
2008-12-15 09:52:12 +03:00
2009-01-16 07:12:40 +03:00
sanity_check_ips " $out "
2014-09-12 07:20:43 +04:00
# Find a target node - it must be willing to host $test_ip
try_command_on_node any " $CTDB listnodes | wc -l "
num_nodes = " $out "
to_node = ""
for i in $( seq 0 $(( $num_nodes - 1 )) ) ; do
[ $i -ne $test_node ] || continue
all_ips_on_node $i
while read ip x ; do
if [ " $ip " = " $test_ip " ] ; then
to_node = " $i "
break 2
fi
2008-12-15 09:52:12 +03:00
done <<< " $out "
done
2014-09-12 07:20:43 +04:00
if [ -z " $to_node " ] ; then
echo "Unable to find target node"
exit 1
fi
echo " Target node is ${ to_node } "
2008-12-15 09:52:12 +03:00
echo "Turning off DeterministicIPs..."
2015-10-19 08:05:44 +03:00
try_command_on_node -q all $CTDB setvar DeterministicIPs 0
2008-12-15 09:52:12 +03:00
echo "Turning on NoIPFailback..."
2015-10-19 08:05:44 +03:00
try_command_on_node -q all $CTDB setvar NoIPFailback 1
2008-12-15 09:52:12 +03:00
2014-09-12 07:20:43 +04:00
echo " Attempting to move ${ test_ip } from node ${ test_node } to node ${ to_node } "
try_command_on_node $test_node $CTDB moveip $test_ip $to_node
wait_until_ips_are_on_node '!' $test_node $test_ip
wait_until_ips_are_on_node $to_node $test_ip