6 Verify that IPs can be rearrranged using 'ctdb reloadips'.
8 Various sub-tests that remove addresses from the public_addresses file
9 on a node or delete the entire contents of the public_addresses file.
13 * An active CTDB cluster with at least 2 active nodes.
17 * When addresses are deconfigured "ctdb ip" no longer reports them and
18 when added they are seen again.
22 .
"${TEST_SCRIPTS_DIR}/integration.bash"
31 ctdb_restart_when_done
33 select_test_node_and_ips
35 echo "Emptying public addresses file on $test_node"
37 addresses
=$
(get_ctdbd_command_line_option
$test_node "public-addresses")
38 echo "Public addresses file on node $test_node is \"$addresses\""
39 backup
="${addresses}.$$"
41 restore_public_addresses
()
43 try_command_on_node
$test_node "mv $backup $addresses >/dev/null 2>&1 || true"
45 ctdb_test_exit_hook_add restore_public_addresses
47 try_command_on_node
$test_node "mv $addresses $backup && touch $addresses"
49 try_command_on_node any
$CTDB reloadips all
51 echo "Getting list of public IPs on node $test_node"
52 try_command_on_node
$test_node "$CTDB ip | tail -n +2"
54 if [ -n "$out" ] ; then
56 BAD: node $test_node still has ips:
62 echo "GOOD: no IPs left on node $test_node"
64 echo "Restoring addresses"
65 restore_public_addresses
67 try_command_on_node any
$CTDB reloadips all
69 echo "Getting list of public IPs on node $test_node"
70 try_command_on_node
$test_node "$CTDB ip | tail -n +2"
72 if [ -z "$out" ] ; then
73 echo "BAD: node $test_node has no ips"
78 GOOD: node $test_node has these addresses:
82 try_command_on_node any
$CTDB sync
84 select_test_node_and_ips
86 echo "Removing IP $test_ip from node $test_node"
88 try_command_on_node
$test_node "mv $addresses $backup && grep -v '^${test_ip}/' $backup >$addresses"
90 try_command_on_node any
$CTDB reloadips all
92 try_command_on_node
$test_node $CTDB ip
94 if grep "^${test_ip} " <<<"$out" ; then
96 BAD: node $test_node can still host IP $test_ip:
103 GOOD: node $test_node is no longer hosting IP $test_ip: