blob: 95b819fd82b1c7a06f1cc3598bba6e0c33094980 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
#!/bin/bash
test_info()
{
cat <<EOF
Verify that IPs can be rearrranged using 'ctdb reloadips'.
Various sub-tests that remove addresses from the public_addresses file
on a node or delete the entire contents of the public_addresses file.
Prerequisites:
* An active CTDB cluster with at least 2 active nodes.
Expected results:
* When addresses are deconfigured "ctdb ip" no longer reports them and
when added they are seen again.
EOF
}
. "${TEST_SCRIPTS_DIR}/integration.bash"
ctdb_test_init "$@"
set -e
cluster_is_healthy
# Reset configuration
ctdb_restart_when_done
select_test_node_and_ips
echo "Emptying public addresses file on $test_node"
try_command_on_node $test_node $CTDB_TEST_WRAPPER ctdb_base_show
addresses="${out}/public_addresses"
echo "Public addresses file on node $test_node is \"$addresses\""
backup="${addresses}.$$"
restore_public_addresses ()
{
try_command_on_node $test_node "mv $backup $addresses >/dev/null 2>&1 || true"
}
ctdb_test_exit_hook_add restore_public_addresses
try_command_on_node $test_node "mv $addresses $backup && touch $addresses"
try_command_on_node any $CTDB reloadips all
echo "Getting list of public IPs on node $test_node"
try_command_on_node $test_node "$CTDB ip | tail -n +2"
if [ -n "$out" ] ; then
cat <<EOF
BAD: node $test_node still has ips:
$out
EOF
exit 1
fi
echo "GOOD: no IPs left on node $test_node"
try_command_on_node any $CTDB sync
echo "Restoring addresses"
restore_public_addresses
try_command_on_node any $CTDB reloadips all
echo "Getting list of public IPs on node $test_node"
try_command_on_node $test_node "$CTDB ip | tail -n +2"
if [ -z "$out" ] ; then
echo "BAD: node $test_node has no ips"
exit 1
fi
cat <<EOF
GOOD: node $test_node has these addresses:
$out
EOF
try_command_on_node any $CTDB sync
echo "Removing IP $test_ip from node $test_node"
try_command_on_node $test_node "mv $addresses $backup && grep -v '^${test_ip}/' $backup >$addresses"
try_command_on_node any $CTDB reloadips all
try_command_on_node $test_node $CTDB ip
if grep "^${test_ip} " <<<"$out" ; then
cat <<EOF
BAD: node $test_node can still host IP $test_ip:
$out
EOF
exit 1
fi
cat <<EOF
GOOD: node $test_node is no longer hosting IP $test_ip:
$out
EOF
|