6 Verify that 'ctdb moveip' allows movement of public IPs between cluster nodes.
8 To work, this test unsets DeterministicIPs and sets NoIPFailback.
10 This test does not do any network level checks that the IP address is
11 no longer reachable but simply trusts 'ctdb ip' that the address has
16 * An active CTDB cluster with at least 2 active nodes.
20 1. Verify that the status on all of the ctdb nodes is 'OK'.
21 2. Use 'ctdb ip' on one of the nodes to list the IP addresses being
23 3. Use 'ctdb moveip' to move an address from one node to another.
24 4. Verify that the IP is no longer being hosted by the first node and is now being hosted by the second node.
28 * 'ctdb moveip' allows an IP address to be moved between cluster nodes.
32 . ctdb_test_functions.bash
41 ctdb_restart_when_done
43 try_command_on_node 0 "$CTDB listnodes | wc -l"
45 echo "There are $num_nodes nodes..."
47 if [ $num_nodes -lt 2 ] ; then
48 echo "Less than 2 nodes!"
52 echo "Getting list of public IPs..."
55 sanity_check_ips "$out"
57 # Select an IP/node to move.
58 num_ips=$(echo "$out" | wc -l)
59 num_to_move=$(($RANDOM % $num_ips))
61 # Find the details in the list.
63 while [ $i -le $num_to_move ] ; do
64 read ip_to_move test_node
68 # Can only move address to a node that is willing to host $ip_to_move.
69 # This inefficient but shouldn't take long or get stuck.
71 while [ $test_node -eq $to_node ] ; do
72 n=$(($RANDOM % $num_ips))
74 while [ $i -le $n ] ; do
80 echo "Turning off DeterministicIPs..."
81 try_command_on_node 0 $CTDB setvar DeterministicIPs 0 -n all
83 echo "Turning on NoIPFailback..."
84 try_command_on_node 0 $CTDB setvar NoIPFailback 1 -n all
86 echo "Attempting to move ${ip_to_move} from node ${test_node} to node ${to_node}."
87 try_command_on_node $test_node $CTDB moveip $ip_to_move $to_node
89 if wait_until_ips_are_on_nodeglob "[!${test_node}]" $ip_to_move ; then
90 echo "IP moved from ${test_node}."
92 echo "BAD: IP didn't move from ${test_node}."
96 if wait_until_ips_are_on_nodeglob "$to_node" $ip_to_move ; then
97 echo "IP moved to ${to_node}."
99 echo "BAD: IP didn't move to ${to_node}."