2016-08-02 14:02:08 +03:00
#!/bin/bash
2019-09-11 09:07:49 +03:00
# Verify that the recovery daemon correctly handles a rogue IP
2016-08-02 14:02:08 +03:00
2019-09-11 09:07:49 +03:00
# It should be released...
2016-08-02 14:02:08 +03:00
2019-09-11 09:07:49 +03:00
. " ${ TEST_SCRIPTS_DIR } /cluster.bash "
2016-08-02 14:02:08 +03:00
set -e
2019-09-11 09:07:49 +03:00
ctdb_test_init
2016-08-02 14:02:08 +03:00
select_test_node_and_ips
echo " Using $test_ip , which is onnode $test_node "
2019-11-28 06:00:58 +03:00
# This test depends on being able to assign a duplicate address on a
# 2nd node. However, IPv6 guards against this and causes the test to
# fail.
case " $test_ip " in
*:*) ctdb_test_skip "This test is not supported for IPv6 addresses" ; ;
esac
2016-08-02 14:02:08 +03:00
get_test_ip_mask_and_iface
echo " Finding another node that knows about $test_ip "
ctdb_get_all_pnns
other_node = ""
for i in $all_pnns ; do
if [ " $i " = " $test_node " ] ; then
continue
fi
try_command_on_node $i " $CTDB ip "
2019-04-11 13:55:20 +03:00
n = $( awk -v ip = " $test_ip " '$1 == ip { print }' " $outfile " )
2016-08-02 14:02:08 +03:00
if [ -n " $n " ] ; then
other_node = " $i "
break
fi
done
if [ -z " $other_node " ] ; then
die " Unable to find another node that knows about $test_ip "
fi
echo " Adding $test_ip on node $other_node "
try_command_on_node $other_node " ip addr add ${ test_ip } / ${ mask } dev ${ iface } "
rogue_ip_is_gone ( )
{
local pnn = " $1 "
local test_ip = " $2 "
try_command_on_node $pnn $CTDB_TEST_WRAPPER ip_maskbits_iface $test_ip
[ -z " $out " ]
}
echo "Waiting until rogue IP is no longer assigned..."
wait_until 30 rogue_ip_is_gone $other_node $test_ip