"$CTDB_LVS_PUBLIC_IFACE" "$CTDB_LVS_PUBLIC_IP"
ctdb_get_pnn
- lvsmaster=$("${CTDB_HELPER_BINDIR}/ctdb_lvs" master | sed -n -e 's/Node \([0-9]*\) is LVS master/\1/p')
+ lvsmaster=$("${CTDB_HELPER_BINDIR}/ctdb_lvs" master)
if [ "$pnn" != "$lvsmaster" ] ; then
# This node is not the LVS master so change the IP address
# to have scope "host" so this node won't respond to ARPs
# Add all nodes (except this node) as LVS servers
"${CTDB_HELPER_BINDIR}/ctdb_lvs" list |
- awk -F: -v pnn="$pnn" '$1 != pnn { print $2 }' |
+ awk -v pnn="$pnn" '$1 != pnn { print $2 }' |
while read ip ; do
ipvsadm -a -t "$CTDB_LVS_PUBLIC_IP" -r $ip -g
ipvsadm -a -u "$CTDB_LVS_PUBLIC_IP" -r $ip -g
ctdb_lvs_master ()
{
if [ -n "$FAKE_CTDB_LVS_MASTER" ] ; then
- echo "Node ${FAKE_CTDB_LVS_MASTER} is LVS master"
+ echo "$FAKE_CTDB_LVS_MASTER"
return 0
else
- echo "This is no LVS master"
return 255
fi
}
{
_pnn=0
while read _ip _opts ; do
- echo "${_pnn}:${_ip}"
+ echo "${_pnn} ${_ip}"
_pnn=$(($_pnn + 1))
done <"$CTDB_LVS_NODES"
}
echo "${_master_candidates%% *}"
}
-# Print the PNN of the LVS master node, verbose version
-show_master ()
-{
- _master_pnn=$(find_master)
- case "$?" in
- 0)
- echo "Node ${_master_pnn} is LVS master"
- exit 0
- ;;
- 255)
- echo "There is no LVS master"
- exit 255
- ;;
- *)
- exit 10
- ;;
- esac
-}
-
# List all usable nodes in the LVS group
nodes_list ()
{
*) exit 10 ;;
esac
- awk '{ print $1 ":" $2 }'<<EOF
+ awk '{ print $1, $2 }'<<EOF
$_usable_nodes
EOF
}
cmd="$1"
case "$cmd" in
-master) show_master ;;
+master) find_master ;;
list) nodes_list ;;
status) nodes_status ;;
*) usage ;;