2011-10-18 14:48:55 +11:00
#!/bin/bash
test_info( )
{
cat <<EOF
Verify that a node's public IP address can be deleted using ' ctdb deleteip' .
2014-09-12 13:20:43 +10:00
This is an extended version of simple/17_ctdb_config_delete_ip.sh
2011-10-18 14:48:55 +11:00
EOF
}
2012-04-18 14:55:21 +10:00
. " ${ TEST_SCRIPTS_DIR } /integration.bash "
2011-10-18 14:48:55 +11:00
set -e
ctdb_test_init " $@ "
ctdb_test_check_real_cluster
cluster_is_healthy
# Reset configuration
ctdb_restart_when_done
2014-09-12 13:20:43 +10:00
select_test_node_and_ips
get_test_ip_mask_and_iface
2011-10-18 14:48:55 +11:00
2014-09-12 13:20:43 +10:00
echo " Checking that node ${ test_node } hosts ${ test_ip } on interface ${ iface } ... "
2014-12-03 15:58:20 +11:00
try_command_on_node $test_node " ip addr show dev $iface | grep -E 'inet6?[[:space:]]* ${ test_ip } /' "
2011-10-18 14:48:55 +11:00
2014-09-12 13:20:43 +10:00
echo " Attempting to remove ${ test_ip } from node ${ test_node } . "
try_command_on_node $test_node $CTDB delip $test_ip
2014-01-22 17:12:09 +11:00
try_command_on_node $test_node $CTDB ipreallocate
2014-09-12 13:20:43 +10:00
wait_until_ips_are_on_node '!' $test_node $test_ip
2011-10-18 14:48:55 +11:00
timeout = 60
increment = 5
count = 0
2014-09-12 13:20:43 +10:00
echo " Waiting for ${ test_ip } to disappear from ${ iface } ... "
2011-10-18 14:48:55 +11:00
while : ; do
try_command_on_node -v $test_node " ip addr show dev $iface "
2014-12-03 15:58:20 +11:00
if echo " $out " | grep -E 'inet6?[[:space:]]*${test_ip}/' ; then
2011-10-18 14:48:55 +11:00
echo "Still there..."
if [ $(( $count * $increment )) -ge $timeout ] ; then
echo "BAD: Timed out waiting..."
exit 1
fi
sleep_for $increment
count = $(( $count + 1 ))
else
break
fi
done
echo "GOOD: IP was successfully removed!"