sanity_check_ips ()
{
- local ips="$1" # Output of "ctdb ip -n all"
+ local ips="$1" # list of "ip node" lines
echo "Sanity checking IPs..."
return 1
}
+# This returns a list of "ip node" lines in $out
+all_ips_on_node()
+{
+ local node=$@
+ try_command_on_node $node "$CTDB ip -Y -n all | cut -d ':' -f1-3 | sed -e '1d' -e 's@^:@@' -e 's@:@ @g'"
+}
+
select_test_node_and_ips ()
{
- try_command_on_node 0 "$CTDB ip -n all | sed -e '1d'"
+ all_ips_on_node 0
# When selecting test_node we just want a node that has public
# IPs. This will work and is economically semi-random. :-)
local out
- try_command_on_node 1 ctdb ip -n all
+ all_ips_on_node 1
while read ip pnn ; do
for check in $ips ; do
ctdb_restart_when_done
echo "Getting list of public IPs..."
-try_command_on_node 0 "$CTDB ip -n all | sed -e '1d'"
+all_ips_on_node 0
# When selecting test_node we just want a node that has public IPs.
# This will work and is economically semi-randomly. :-)
3. Delete one public IP address being be served by the node, using
'ctdb delip'.
4. Verify that the delete IP address is no longer listed using the
- 'ctdb ip' command.
+ all_ips_on_node helper function.
Expected results:
ctdb_restart_when_done
echo "Getting list of public IPs..."
-try_command_on_node -v 0 "$CTDB ip -n all | sed -e '1d'"
+all_ips_on_node -v 0
# Select an IP/node to remove.
num_ips=$(echo "$out" | wc -l)
fi
echo "Getting list of public IPs..."
-try_command_on_node -v 0 "$CTDB ip -n all | sed -e '1d'"
+all_ips_on_node -v 0
sanity_check_ips "$out"