define_test "$cmd" "all nodes OK"
ctdb_set_output <<EOF
-:Node:IP:Disconnected:Banned:Disabled:Unhealthy:Stopped:Inactive:PartiallyOnline:ThisNode:
-:0:192.168.1.101:0:0:0:0:0:0:0:Y:
-:1:192.168.1.102:0:0:0:0:0:0:0:N:
-:2:192.168.1.103:0:0:0:0:0:0:0:N:
-:3:192.168.1.104:0:0:0:0:0:0:0:N:
+|Node|IP|Disconnected|Banned|Disabled|Unhealthy|Stopped|Inactive|PartiallyOnline|ThisNode|
+|0|192.168.1.101|0|0|0|0|0|0|0|Y|
+|1|192.168.1.102|0|0|0|0|0|0|0|N|
+|2|192.168.1.103|0|0|0|0|0|0|0|N|
+|3|192.168.1.104|0|0|0|0|0|0|0|N|
EOF
required_result <<EOF
define_test "$cmd" "2nd node disconnected"
ctdb_set_output <<EOF
-:Node:IP:Disconnected:Banned:Disabled:Unhealthy:Stopped:Inactive:PartiallyOnline:ThisNode:
-:0:192.168.1.101:0:0:0:0:0:0:0:Y:
-:1:192.168.1.102:1:0:0:0:0:0:0:N:
-:2:192.168.1.103:0:0:0:0:0:0:0:N:
-:3:192.168.1.104:0:0:0:0:0:0:0:N:
+|Node|IP|Disconnected|Banned|Disabled|Unhealthy|Stopped|Inactive|PartiallyOnline|ThisNode|
+|0|192.168.1.101|0|0|0|0|0|0|0|Y|
+|1|192.168.1.102|1|0|0|0|0|0|0|N|
+|2|192.168.1.103|0|0|0|0|0|0|0|N|
+|3|192.168.1.104|0|0|0|0|0|0|0|N|
EOF
required_result <<EOF
define_test "$cmd" "2nd node disconnected, extra status columns"
ctdb_set_output <<EOF
-:Node:IP:Disconnected:Banned:Disabled:Unhealthy:Stopped:Inactive:X1:X2:X3:X4:
-:0:192.168.1.101:0:0:0:0:0:0:0:0:0:0:
-:1:192.168.1.102:1:0:0:0:0:0:0:0:0:0:
-:2:192.168.1.103:0:0:0:0:0:0:0:0:0:0:
-:3:192.168.1.104:0:0:0:0:0:0:0:0:0:0:
+|Node|IP|Disconnected|Banned|Disabled|Unhealthy|Stopped|Inactive|X1|X2|X3|X4|
+|0|192.168.1.101|0|0|0|0|0|0|0|0|0|0|
+|1|192.168.1.102|1|0|0|0|0|0|0|0|0|0|
+|2|192.168.1.103|0|0|0|0|0|0|0|0|0|0|
+|3|192.168.1.104|0|0|0|0|0|0|0|0|0|0|
EOF
required_result <<EOF
define_test "$cmd" "1st node disconnected"
ctdb_set_output <<EOF
-:Node:IP:Disconnected:Banned:Disabled:Unhealthy:Stopped:Inactive:PartiallyOnline:ThisNode:
-:0:192.168.1.101:1:0:0:0:0:0:0:N:
-:1:192.168.1.102:0:0:0:0:0:0:0:Y:
-:2:192.168.1.103:0:0:0:0:0:0:0:N:
-:3:192.168.1.104:0:0:0:0:0:0:0:N:
+|Node|IP|Disconnected|Banned|Disabled|Unhealthy|Stopped|Inactive|PartiallyOnline|ThisNode|
+|0|192.168.1.101|1|0|0|0|0|0|0|N|
+|1|192.168.1.102|0|0|0|0|0|0|0|Y|
+|2|192.168.1.103|0|0|0|0|0|0|0|N|
+|3|192.168.1.104|0|0|0|0|0|0|0|N|
EOF
required_result <<EOF
local bits
case "$status" in
healthy)
- bits="0:0:0:0:0:0"
+ bits="0|0|0|0|0|0"
;;
connected)
- bits="0:[0-1]:[0-1]:[0-1]:[0-1]:[0-1]"
+ bits="0|[0-1]|[0-1]|[0-1]|[0-1]|[0-1]"
;;
*)
invalid_nodespec
if [ -z "$ctdb_status_output" ] ; then
# FIXME: need to do something if $CTDB_NODES_SOCKETS is set.
- ctdb_status_output=$(ctdb -Y status 2>/dev/null)
+ ctdb_status_output=$(ctdb -X status 2>/dev/null)
if [ $? -ne 0 ] ; then
echo "${prog}: unable to get status of CTDB nodes" >&2
exit 1
local i
for i in $ctdb_status_output ; do
# Try removing bits from end.
- local t="${i%:${bits}:}"
+ local t="${i%|${bits}|}"
if [ "$t" != "$i" ] ; then
# Succeeded. Get address. NOTE: this is an optimisation.
# It might be better to get the node number and then get
# the nth node to get the address. This would make things
# more consistent if $ctdb_base/nodes actually contained
# hostnames.
- nodes="${nodes} ${t#:*:}"
+ nodes="${nodes} ${t#|*|}"
fi
done
local prop_node=""
if [ "${ctdb_props##:${prop}:}" = "$ctdb_props" ] ; then
- prop_node=$(ctdb "$prop" -Y 2>/dev/null)
+ prop_node=$(ctdb "$prop" -X 2>/dev/null)
# We only want the first line.
local nl="
"
}
-nodes=$(ctdb listnodes -Y | cut -d: -f2)
+nodes=$(ctdb listnodes -X | cut -d'|' -f2)
bad_nodes=""
diff_opts=
no_ads=false
local status="$2"
if [ -z "$ctdb_status_output" ] ; then
- ctdb_status_output=$(ctdb -Y status 2>&1)
+ ctdb_status_output=$(ctdb -X status 2>&1)
if [ $? -ne 0 ] ; then
echo "${prog}: unable to get status of CTDB nodes" >&2
echo "$ctdb_status_output" >&2
(
local i
- IFS="${IFS}:"
+ IFS="${IFS}|"
while IFS="" read i ; do
set -- $i # split line on colons
local prop_node=""
if [ "${ctdb_props##:${prop}:}" = "$ctdb_props" ] ; then
# Not in cache.
- prop_node=$(ctdb "$prop" -Y 2>/dev/null)
+ prop_node=$(ctdb "$prop" -X 2>/dev/null)
if [ $? -eq 0 ] ; then
if [ "$prop" = "natgwlist" ] ; then
prop_node="${prop_node%% *}" # 1st word