Instead of master/slave.
Nearly all of these are simple textual substitutions, which preserve
the case of the original.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
# shellcheck disable=SC2154
natgw_cfg_new="${script_state_dir}/cfg_new"
natgw_cfg_old="${script_state_dir}/cfg_old"
-natgw_master_old="${script_state_dir}/master_old"
+natgw_leader_old="${script_state_dir}/leader_old"
-ctdb_natgw_slave_only ()
+ctdb_natgw_follower_only ()
{
_ip_address=$(ctdb_get_ip_address)
awk -v my_ip="$_ip_address" \
- '$1 == my_ip { if ($2 ~ "slave-only") { exit 0 } else { exit 1 } }' \
+ '$1 == my_ip { if ($2 ~ "follower-only") { exit 0 } else { exit 1 } }' \
"$CTDB_NATGW_NODES"
}
{
[ -r "$CTDB_NATGW_NODES" ] || \
die "error: CTDB_NATGW_NODES=${CTDB_NATGW_NODES} unreadable"
- if ! ctdb_natgw_slave_only ; then
+ if ! ctdb_natgw_follower_only ; then
[ -n "$CTDB_NATGW_PUBLIC_IP" ] || \
die "Invalid configuration: CTDB_NATGW_PUBLIC_IP not set"
[ -n "$CTDB_NATGW_PUBLIC_IFACE" ] || \
fi
}
-natgw_set_master ()
+natgw_set_leader ()
{
set_proc sys/net/ipv4/ip_forward 1
iptables -A POSTROUTING -t nat \
done
}
-natgw_set_slave ()
+natgw_set_follower ()
{
_natgwip="$1"
done
}
-natgw_ensure_master ()
+natgw_ensure_leader ()
{
# Intentional word splitting here
# shellcheck disable=SC2046
- set -- $("${CTDB_HELPER_BINDIR}/ctdb_natgw" master)
- natgwmaster="${1:--1}" # Default is -1, for failure above
+ set -- $("${CTDB_HELPER_BINDIR}/ctdb_natgw" leader)
+ natgwleader="${1:--1}" # Default is -1, for failure above
natgwip="$2"
- if [ "$natgwmaster" = "-1" ]; then
+ if [ "$natgwleader" = "-1" ]; then
# Fail...
- die "There is no NATGW master node"
+ die "There is no NATGW leader node"
fi
}
-natgw_master_has_changed ()
+natgw_leader_has_changed ()
{
- if [ -r "$natgw_master_old" ] ; then
- read _old_natgwmaster <"$natgw_master_old"
+ if [ -r "$natgw_leader_old" ] ; then
+ read _old_natgwleader <"$natgw_leader_old"
else
- _old_natgwmaster=""
+ _old_natgwleader=""
fi
- [ "$_old_natgwmaster" != "$natgwmaster" ]
+ [ "$_old_natgwleader" != "$natgwleader" ]
}
natgw_save_state ()
{
- echo "$natgwmaster" >"$natgw_master_old"
+ echo "$natgwleader" >"$natgw_leader_old"
# Created by natgw_config_has_changed()
mv "$natgw_cfg_new" "$natgw_cfg_old"
}
updatenatgw|ipreallocated)
natgw_check_config
- natgw_ensure_master
+ natgw_ensure_leader
- natgw_config_has_changed || natgw_master_has_changed || exit 0
+ natgw_config_has_changed || natgw_leader_has_changed || exit 0
natgw_clear
pnn=$(ctdb_get_pnn)
- if [ "$pnn" = "$natgwmaster" ]; then
- natgw_set_master
+ if [ "$pnn" = "$natgwleader" ]; then
+ natgw_set_leader
else
- natgw_set_slave "$natgwip"
+ natgw_set_follower "$natgwip"
fi
# flush our route cache
when they do not host any public IP addresses. For example,
it allows unhealthy nodes to reliably communicate with
external infrastructure. One node in a NAT gateway group will
- be designated as the NAT gateway master node and other (slave)
+ be designated as the NAT gateway leader node and other (follower)
nodes will be configured with fallback routes via the NAT
- gateway master node. For more information, see the
+ gateway leader node. For more information, see the
<citetitle>NAT GATEWAY</citetitle> section in
<citerefentry><refentrytitle>ctdb</refentrytitle>
<manvolnum>7</manvolnum></citerefentry>.
<listitem>
<para>
IPADDR is an alternate network gateway to use on the NAT
- gateway master node. If set, a fallback default route
+ gateway leader node. If set, a fallback default route
is added via this network gateway.
</para>
<para>
No default. Setting this variable is optional - if not
- set that no route is created on the NAT gateway master
+ set that no route is created on the NAT gateway leader
node.
</para>
</listitem>
<para>
File format:
<screen>
-<parameter>IPADDR</parameter> <optional>slave-only</optional>
+<parameter>IPADDR</parameter> <optional>follower-only</optional>
</screen>
</para>
<para>
gateway group.
</para>
<para>
- If "slave-only" is specified then the corresponding node
- can not be the NAT gateway master node. In this case
+ If "follower-only" is specified then the corresponding node
+ can not be the NAT gateway leader node. In this case
<varname>CTDB_NATGW_PUBLIC_IFACE</varname> and
<varname>CTDB_NATGW_PUBLIC_IP</varname> are optional and
unused.
<listitem>
<para>
IPADDR/MASK is the private sub-network that is
- internally routed via the NAT gateway master node. This
+ internally routed via the NAT gateway leader node. This
is usually the private network that is used for node
addresses.
</para>
<para>
IPADDR/MASK indicates the IP address that is used for
outgoing traffic (originating from
- CTDB_NATGW_PRIVATE_NETWORK) on the NAT gateway master
+ CTDB_NATGW_PRIVATE_NETWORK) on the NAT gateway leader
node. This <emphasis>must not</emphasis> be a
configured public IP address.
</para>
</para>
<para>
If GATEWAY is specified then the corresponding route on
- the NATGW master node will be via GATEWAY. Such routes
+ the NATGW leader node will be via GATEWAY. Such routes
are created even if
<varname>CTDB_NATGW_DEFAULT_GATEWAY</varname> is not
specified. If GATEWAY is not specified for some
networks then routes are only created on the NATGW
- master node for those networks if
+ leader node for those networks if
<varname>CTDB_NATGW_DEFAULT_GATEWAY</varname> is
specified.
</para>
<para>
This should be used with care to avoid causing traffic
to unnecessarily double-hop through the NAT gateway
- master, even when a node is hosting public IP addresses.
+ leader, even when a node is hosting public IP addresses.
Each specified network or host should probably have a
corresponding automatically created link route or static
route to avoid this.
</refsect2>
<refsect2>
- <title>natgw {master|list|status}</title>
+ <title>natgw {leader|list|status}</title>
<para>
This command shows different aspects of NAT gateway status.
For an overview of CTDB's NAT gateway functionality please see
<variablelist>
<varlistentry>
- <term>master</term>
+ <term>leader</term>
<listitem>
<para>
Show the PNN and private IP address of the current NAT
- gateway master node.
+ gateway leader node.
</para>
<para>
Example output:
<listitem>
<para>
List the private IP addresses of nodes in the current
- NAT gateway group, annotating the master node.
+ NAT gateway group, annotating the leader node.
</para>
<para>
Example output:
</para>
<screen>
192.168.2.200
-192.168.2.201 MASTER
+192.168.2.201 LEADER
192.168.2.202
192.168.2.203
</screen>
</para>
<para>
In each NATGW group, one of the nodes is selected by CTDB to
- be the NATGW master and the other nodes are consider to be
- NATGW slaves. NATGW slaves establish a fallback default route
- to the NATGW master via the private network. When a NATGW
- slave hosts no public IP addresses then it will use this route
- for outbound connections. The NATGW master hosts the NATGW
+ be the NATGW leader and the other nodes are consider to be
+ NATGW followers. NATGW followers establish a fallback default route
+ to the NATGW leader via the private network. When a NATGW
+ follower hosts no public IP addresses then it will use this route
+ for outbound connections. The NATGW leader hosts the NATGW
public IP address and routes outgoing connections from
- slave nodes via this IP address. It also establishes a
+ follower nodes via this IP address. It also establishes a
fallback default route.
</para>
</refsect2>
<para>
Normally any node in a NATGW group can act as the NATGW
- master. Some configurations may have special nodes that lack
+ leader. Some configurations may have special nodes that lack
connectivity to a public network. In such cases, those nodes
- can be flagged with the "slave-only" option in the
+ can be flagged with the "follower-only" option in the
<varname>CTDB_NATGW_NODES</varname> file to limit the NATGW
functionality of those nodes.
</para>
When the NATGW functionality is used, one of the nodes is
selected to act as a NAT gateway for all the other nodes in
the group when they need to communicate with the external
- services. The NATGW master is selected to be a node that is
+ services. The NATGW leader is selected to be a node that is
most likely to have usable networks.
</para>
<para>
- The NATGW master hosts the NATGW public IP address
+ The NATGW leader hosts the NATGW public IP address
<varname>CTDB_NATGW_PUBLIC_IP</varname> on the configured public
interfaces <varname>CTDB_NATGW_PUBLIC_IFACE</varname> and acts as
- a router, masquerading outgoing connections from slave nodes
+ a router, masquerading outgoing connections from follower nodes
via this IP address. If
<varname>CTDB_NATGW_DEFAULT_GATEWAY</varname> is set then it
also establishes a fallback default route to the configured
</para>
<para>
- A NATGW slave establishes its fallback default route to the
- NATGW master via the private network
+ A NATGW follower establishes its fallback default route to the
+ NATGW leader via the private network
<varname>CTDB_NATGW_PRIVATE_NETWORK</varname>with a metric of 10.
This route is used for outbound connections when no other
default route is available because the node hosts no public
setup
setup_ctdb_natgw <<EOF
-192.168.1.21 master
+192.168.1.21 leader
192.168.1.22
192.168.1.23
192.168.1.24
. "${TEST_SCRIPTS_DIR}/unit.sh"
-define_test "CTDB_NATGW_PUBLIC_IFACE unset, not slave-only"
+define_test "CTDB_NATGW_PUBLIC_IFACE unset, not follower-only"
setup
setup_ctdb_natgw <<EOF
-192.168.1.21 master
+192.168.1.21 leader
192.168.1.22
192.168.1.23
192.168.1.24
. "${TEST_SCRIPTS_DIR}/unit.sh"
-define_test "CTDB_NATGW_PUBLIC_IP unset, not slave-only"
+define_test "CTDB_NATGW_PUBLIC_IP unset, not follower-only"
setup
setup_ctdb_natgw <<EOF
-192.168.1.21 master
+192.168.1.21 leader
192.168.1.22
192.168.1.23
192.168.1.24
. "${TEST_SCRIPTS_DIR}/unit.sh"
-define_test "master node, basic configuration"
+define_test "leader node, basic configuration"
setup
setup_ctdb_natgw <<EOF
-192.168.1.21 master
+192.168.1.21 leader
192.168.1.22
192.168.1.23
192.168.1.24
ok "default via ${CTDB_NATGW_DEFAULT_GATEWAY} dev ethXXX metric 10 "
simple_test_command ip route show
-ok_natgw_master_ip_addr_show
+ok_natgw_leader_ip_addr_show
simple_test_command ip addr show "$CTDB_NATGW_PUBLIC_IFACE"
. "${TEST_SCRIPTS_DIR}/unit.sh"
-define_test "slave node, basic configuration"
+define_test "follower node, basic configuration"
setup
setup_ctdb_natgw <<EOF
192.168.1.21
-192.168.1.22 master
+192.168.1.22 leader
192.168.1.23
192.168.1.24
EOF
ok_null
simple_test_event "ipreallocated"
-ok "default via ${FAKE_CTDB_NATGW_MASTER} dev ethXXX metric 10 "
+ok "default via ${FAKE_CTDB_NATGW_LEADER} dev ethXXX metric 10 "
simple_test_command ip route show
-ok_natgw_slave_ip_addr_show
+ok_natgw_follower_ip_addr_show
simple_test_command ip addr show "$CTDB_NATGW_PUBLIC_IFACE"
. "${TEST_SCRIPTS_DIR}/unit.sh"
-define_test "master node, no gateway"
+define_test "leader node, no gateway"
setup
setup_ctdb_natgw <<EOF
-192.168.1.21 master
+192.168.1.21 leader
192.168.1.22
192.168.1.23
192.168.1.24
ok_null
simple_test_command ip route show
-ok_natgw_master_ip_addr_show
+ok_natgw_leader_ip_addr_show
simple_test_command ip addr show "$CTDB_NATGW_PUBLIC_IFACE"
. "${TEST_SCRIPTS_DIR}/unit.sh"
-define_test "slave node, no gateway"
+define_test "follower node, no gateway"
setup
setup_ctdb_natgw <<EOF
192.168.1.21
-192.168.1.22 master
+192.168.1.22 leader
192.168.1.23
192.168.1.24
EOF
ok_null
simple_test_event "ipreallocated"
-ok "default via ${FAKE_CTDB_NATGW_MASTER} dev ethXXX metric 10 "
+ok "default via ${FAKE_CTDB_NATGW_LEADER} dev ethXXX metric 10 "
simple_test_command ip route show
-ok_natgw_slave_ip_addr_show
+ok_natgw_follower_ip_addr_show
simple_test_command ip addr show "$CTDB_NATGW_PUBLIC_IFACE"
setup
-echo "*** Master node..."
+echo "*** Leader node..."
setup_ctdb_natgw <<EOF
-192.168.1.21 master
+192.168.1.21 leader
192.168.1.22
192.168.1.23
192.168.1.24
ok "default via ${CTDB_NATGW_DEFAULT_GATEWAY} dev ethXXX metric 10 "
simple_test_command ip route show
-ok_natgw_master_ip_addr_show
+ok_natgw_leader_ip_addr_show
simple_test_command ip addr show "$CTDB_NATGW_PUBLIC_IFACE"
-echo "*** Slave node..."
+echo "*** Follower node..."
setup_ctdb_natgw <<EOF
192.168.1.21
-192.168.1.22 master
+192.168.1.22 leader
192.168.1.23
192.168.1.24
EOF
ok_null
simple_test_event "ipreallocated"
-ok "default via ${FAKE_CTDB_NATGW_MASTER} dev ethXXX metric 10 "
+ok "default via ${FAKE_CTDB_NATGW_LEADER} dev ethXXX metric 10 "
simple_test_command ip route show
-ok_natgw_slave_ip_addr_show
+ok_natgw_follower_ip_addr_show
simple_test_command ip addr show "$CTDB_NATGW_PUBLIC_IFACE"
-echo "*** Master node again..."
+echo "*** Leader node again..."
setup_ctdb_natgw <<EOF
-192.168.1.21 master
+192.168.1.21 leader
192.168.1.22
192.168.1.23
192.168.1.24
ok "default via ${CTDB_NATGW_DEFAULT_GATEWAY} dev ethXXX metric 10 "
simple_test_command ip route show
-ok_natgw_master_ip_addr_show
+ok_natgw_leader_ip_addr_show
simple_test_command ip addr show "$CTDB_NATGW_PUBLIC_IFACE"
. "${TEST_SCRIPTS_DIR}/unit.sh"
-define_test "master node, static routes"
+define_test "leader node, static routes"
setup
setup_ctdb_natgw <<EOF
-192.168.1.21 master
+192.168.1.21 leader
192.168.1.22
192.168.1.23
192.168.1.24
ok_null
simple_test_event "ipreallocated"
-ok_natgw_master_static_routes
+ok_natgw_leader_static_routes
simple_test_command ip route show
-ok_natgw_master_ip_addr_show
+ok_natgw_leader_ip_addr_show
simple_test_command ip addr show "$CTDB_NATGW_PUBLIC_IFACE"
. "${TEST_SCRIPTS_DIR}/unit.sh"
-define_test "slave node, static routes"
+define_test "follower node, static routes"
setup
setup_ctdb_natgw <<EOF
192.168.1.21
-192.168.1.22 master
+192.168.1.22 leader
192.168.1.23
192.168.1.24
EOF
ok_null
simple_test_event "ipreallocated"
-ok_natgw_slave_static_routes
+ok_natgw_follower_static_routes
simple_test_command ip route show
-ok_natgw_slave_ip_addr_show
+ok_natgw_follower_ip_addr_show
simple_test_command ip addr show "$CTDB_NATGW_PUBLIC_IFACE"
. "${TEST_SCRIPTS_DIR}/unit.sh"
-define_test "master node, static routes, custom gateway"
+define_test "leader node, static routes, custom gateway"
setup
setup_ctdb_natgw <<EOF
-192.168.1.21 master
+192.168.1.21 leader
192.168.1.22
192.168.1.23
192.168.1.24
ok_null
simple_test_event "ipreallocated"
-ok_natgw_master_static_routes
+ok_natgw_leader_static_routes
simple_test_command ip route show
-ok_natgw_master_ip_addr_show
+ok_natgw_leader_ip_addr_show
simple_test_command ip addr show "$CTDB_NATGW_PUBLIC_IFACE"
. "${TEST_SCRIPTS_DIR}/unit.sh"
-define_test "slave node, static routes, custom gateway"
+define_test "follower node, static routes, custom gateway"
setup
setup_ctdb_natgw <<EOF
192.168.1.21
-192.168.1.22 master
+192.168.1.22 leader
192.168.1.23
192.168.1.24
EOF
ok_null
simple_test_event "ipreallocated"
-ok_natgw_slave_static_routes
+ok_natgw_follower_static_routes
simple_test_command ip route show
-ok_natgw_slave_ip_addr_show
+ok_natgw_follower_ip_addr_show
simple_test_command ip addr show "$CTDB_NATGW_PUBLIC_IFACE"
CTDB_NATGW_STATIC_ROUTES="10.1.1.0/24 10.1.2.0/24@10.1.1.253"
EOF
-echo "*** Master node..."
+echo "*** Leader node..."
setup_ctdb_natgw <<EOF
-192.168.1.21 master
+192.168.1.21 leader
192.168.1.22
192.168.1.23
192.168.1.24
ok_null
simple_test_event "ipreallocated"
-ok_natgw_master_static_routes
+ok_natgw_leader_static_routes
simple_test_command ip route show
-ok_natgw_master_ip_addr_show
+ok_natgw_leader_ip_addr_show
simple_test_command ip addr show "$CTDB_NATGW_PUBLIC_IFACE"
-echo "*** Slave node..."
+echo "*** Follower node..."
setup_ctdb_natgw <<EOF
192.168.1.21
-192.168.1.22 master
+192.168.1.22 leader
192.168.1.23
192.168.1.24
EOF
ok_null
simple_test_event "ipreallocated"
-ok_natgw_slave_static_routes
+ok_natgw_follower_static_routes
simple_test_command ip route show
-ok_natgw_slave_ip_addr_show
+ok_natgw_follower_ip_addr_show
simple_test_command ip addr show "$CTDB_NATGW_PUBLIC_IFACE"
-echo "*** Master node again..."
+echo "*** Leader node again..."
setup_ctdb_natgw <<EOF
-192.168.1.21 master
+192.168.1.21 leader
192.168.1.22
192.168.1.23
192.168.1.24
ok_null
simple_test_event "ipreallocated"
-ok_natgw_master_static_routes
+ok_natgw_leader_static_routes
simple_test_command ip route show
-ok_natgw_master_ip_addr_show
+ok_natgw_leader_ip_addr_show
simple_test_command ip addr show "$CTDB_NATGW_PUBLIC_IFACE"
. "${TEST_SCRIPTS_DIR}/unit.sh"
-define_test "master node, static routes, custom gateway, config change"
+define_test "leader node, static routes, custom gateway, config change"
setup
echo "Static routes..."
setup_ctdb_natgw <<EOF
-192.168.1.21 master
+192.168.1.21 leader
192.168.1.22
192.168.1.23
192.168.1.24
ok_null
simple_test_event "ipreallocated"
-ok_natgw_master_static_routes
+ok_natgw_leader_static_routes
simple_test_command ip route show
-ok_natgw_master_ip_addr_show
+ok_natgw_leader_ip_addr_show
simple_test_command ip addr show "$CTDB_NATGW_PUBLIC_IFACE"
echo "##################################################"
ok "default via ${CTDB_NATGW_DEFAULT_GATEWAY} dev ethXXX metric 10 "
simple_test_command ip route show
-ok_natgw_master_ip_addr_show
+ok_natgw_leader_ip_addr_show
simple_test_command ip addr show "$CTDB_NATGW_PUBLIC_IFACE"
echo "##################################################"
ok "NAT gateway configuration has changed"
simple_test_event "ipreallocated"
-ok_natgw_master_static_routes
+ok_natgw_leader_static_routes
simple_test_command ip route show
-ok_natgw_master_ip_addr_show
+ok_natgw_leader_ip_addr_show
simple_test_command ip addr show "$CTDB_NATGW_PUBLIC_IFACE"
. "${TEST_SCRIPTS_DIR}/unit.sh"
-define_test "slave-only, CTDB_NATGW_PUBLIC_IFACE unset"
+define_test "follower-only, CTDB_NATGW_PUBLIC_IFACE unset"
setup
setup_ctdb_natgw <<EOF
-192.168.1.21 slave-only
-192.168.1.22 master
+192.168.1.21 follower-only
+192.168.1.22 leader
192.168.1.23
192.168.1.24
EOF
ok_null
simple_test_event "ipreallocated"
-ok "default via ${FAKE_CTDB_NATGW_MASTER} dev ethXXX metric 10 "
+ok "default via ${FAKE_CTDB_NATGW_LEADER} dev ethXXX metric 10 "
simple_test_command ip route show
. "${TEST_SCRIPTS_DIR}/unit.sh"
-define_test "slave-only, CTDB_NATGW_PUBLIC_IP unset"
+define_test "follower-only, CTDB_NATGW_PUBLIC_IP unset"
setup
setup_ctdb_natgw <<EOF
-192.168.1.21 slave-only
-192.168.1.22 master
+192.168.1.21 follower-only
+192.168.1.22 leader
192.168.1.23
192.168.1.24
EOF
ok_null
simple_test_event "ipreallocated"
-ok "default via ${FAKE_CTDB_NATGW_MASTER} dev ethXXX metric 10 "
+ok "default via ${FAKE_CTDB_NATGW_LEADER} dev ethXXX metric 10 "
simple_test_command ip route show
. "${TEST_SCRIPTS_DIR}/unit.sh"
-define_test "Monitor CTDB_NATGW_PUBLIC_IFACE, slave, up"
+define_test "Monitor CTDB_NATGW_PUBLIC_IFACE, follower, up"
setup
setup_ctdb_natgw <<EOF
192.168.1.21
-192.168.1.22 master
+192.168.1.22 leader
192.168.1.23
192.168.1.24
EOF
. "${TEST_SCRIPTS_DIR}/unit.sh"
-define_test "Monitor CTDB_NATGW_PUBLIC_IFACE, slave, down"
+define_test "Monitor CTDB_NATGW_PUBLIC_IFACE, follower, down"
setup
setup_ctdb_natgw <<EOF
192.168.1.21
-192.168.1.22 master
+192.168.1.22 leader
192.168.1.23
192.168.1.24
EOF
. "${TEST_SCRIPTS_DIR}/unit.sh"
-define_test "Monitor CTDB_NATGW_PUBLIC_IFACE, master, up"
+define_test "Monitor CTDB_NATGW_PUBLIC_IFACE, leader, up"
setup
setup_ctdb_natgw <<EOF
-192.168.1.21 master
+192.168.1.21 leader
192.168.1.22
192.168.1.23
192.168.1.24
. "${TEST_SCRIPTS_DIR}/unit.sh"
-define_test "Monitor CTDB_NATGW_PUBLIC_IFACE, master, down"
+define_test "Monitor CTDB_NATGW_PUBLIC_IFACE, leader, down"
setup
setup_ctdb_natgw <<EOF
-192.168.1.21 master
+192.168.1.21 leader
192.168.1.22
192.168.1.23
192.168.1.24
# Read from stdin
while read _ip _opts ; do
case "$_opts" in
- master)
- export FAKE_CTDB_NATGW_MASTER="$_ip"
+ leader)
+ export FAKE_CTDB_NATGW_LEADER="$_ip"
echo "$_ip"
;;
- slave-only)
- printf "%s\tslave-only\n" "$_ip"
+ follower-only)
+ printf "%s\tfollower-only\n" "$_ip"
;;
*)
echo "$_ip"
EOF
}
-ok_natgw_master_ip_addr_show ()
+ok_natgw_leader_ip_addr_show ()
{
_mac=$(echo "$CTDB_NATGW_PUBLIC_IFACE" |
cksum |
EOF
}
-ok_natgw_slave_ip_addr_show ()
+ok_natgw_follower_ip_addr_show ()
{
_mac=$(echo "$CTDB_NATGW_PUBLIC_IFACE" |
cksum |
EOF
}
-ok_natgw_master_static_routes ()
+ok_natgw_leader_static_routes ()
{
_nl="
"
ok "$_t"
}
-ok_natgw_slave_static_routes ()
+ok_natgw_follower_static_routes ()
{
_nl="
"
# implicitly added by "ip route" but our stub doesn't
# do this and adds "ethXXX".
_t="${_t}${_t:+${_nl}}"
- _t="${_t}${_net} via ${FAKE_CTDB_NATGW_MASTER} dev ethXXX metric 10 "
+ _t="${_t}${_net} via ${FAKE_CTDB_NATGW_LEADER} dev ethXXX metric 10 "
done
_t=$(echo "$_t" | sort)
ok "$_t"
exit $not_implemented_exit_code
}
-ctdb_natgw_master ()
+ctdb_natgw_leader ()
{
[ -r "$CTDB_NATGW_NODES" ] || \
die "error: missing CTDB_NATGW_NODES=${CTDB_NATGW_NODES}"
- # Determine the master node
- _master="-1 0.0.0.0"
+ # Determine the leader node
+ _leader="-1 0.0.0.0"
_pnn=0
while read _ip ; do
- if [ "$FAKE_CTDB_NATGW_MASTER" = "$_ip" ] ; then
- _master="${_pnn} ${_ip}"
+ if [ "$FAKE_CTDB_NATGW_LEADER" = "$_ip" ] ; then
+ _leader="${_pnn} ${_ip}"
break
fi
_pnn=$(($_pnn + 1))
done <"$CTDB_NATGW_NODES"
- echo "$_master"
+ echo "$_leader"
}
case "$1" in
- master) ctdb_natgw_master "$@" ;;
+ leader) ctdb_natgw_leader "$@" ;;
*) not_implemented "$1" ;;
esac
0 192.168.20.41
EOF
-simple_test master
+simple_test leader
#####
required_result 0 <<EOF
-192.168.20.41 MASTER
+192.168.20.41 LEADER
192.168.20.42
192.168.20.43
EOF
1 192.168.20.42
EOF
-simple_test master
+simple_test leader
#####
required_result 0 <<EOF
192.168.20.41
-192.168.20.42 MASTER
+192.168.20.42 LEADER
192.168.20.43
EOF
2 192.168.20.43
EOF
-simple_test master
+simple_test leader
#####
required_result 0 <<EOF
192.168.20.41
-192.168.20.43 MASTER
+192.168.20.43 LEADER
EOF
simple_test list
2 192.168.20.43
EOF
-simple_test master
+simple_test leader
#####
required_result 0 <<EOF
192.168.20.41
192.168.20.42
-192.168.20.43 MASTER
+192.168.20.43 LEADER
EOF
simple_test list
0 192.168.20.41
EOF
-simple_test master
+simple_test leader
#####
required_result 0 <<EOF
-192.168.20.41 MASTER
+192.168.20.41 LEADER
192.168.20.42
192.168.20.43
EOF
. "${TEST_SCRIPTS_DIR}/unit.sh"
-define_test "3 nodes, node 0 is slave-only, all stopped"
+define_test "3 nodes, node 0 is follower-only, all stopped"
setup_natgw <<EOF
-192.168.20.41 slave-only
+192.168.20.41 follower-only
192.168.20.42
192.168.20.43
EOF
1 192.168.20.42
EOF
-simple_test master
+simple_test leader
#####
required_result 0 <<EOF
-192.168.20.41 slave-only
-192.168.20.42 MASTER
+192.168.20.41 follower-only
+192.168.20.42 LEADER
192.168.20.43
EOF
. "${TEST_SCRIPTS_DIR}/unit.sh"
-define_test "3 nodes, all nodes are slave-only, all stopped"
+define_test "3 nodes, all nodes are follower-only, all stopped"
setup_natgw <<EOF
-192.168.20.41 slave-only
-192.168.20.42 slave-only
-192.168.20.43 slave-only
+192.168.20.41 follower-only
+192.168.20.42 follower-only
+192.168.20.43 follower-only
EOF
setup_ctdbd <<EOF
required_result 2 <<EOF
EOF
-simple_test master
+simple_test leader
#####
required_result 0 <<EOF
-192.168.20.41 slave-only
-192.168.20.42 slave-only
-192.168.20.43 slave-only
+192.168.20.41 follower-only
+192.168.20.42 follower-only
+192.168.20.43 follower-only
EOF
simple_test list
1 192.168.20.42
EOF
-simple_test master
+simple_test leader
#####
required_result 0 <<EOF
192.168.20.41
-192.168.20.42 MASTER
+192.168.20.42 LEADER
192.168.20.43
EOF
"show event script status",
"[init|setup|startup|monitor|takeip|releaseip|ipreallocated]" },
{ "natgw", control_natgw, false, false,
- "show natgw configuration", "master|list|status" },
+ "show natgw configuration", "leader|list|status" },
{ "getreclock", control_getreclock, false, true,
"get recovery lock file", NULL },
{ "setlmasterrole", control_setlmasterrole, false, true,
$0 <option>
<option> is one of:
- master Display node number and private IP address of master node
- list List private IP addresses of nodes in group, annotate master
+ leader Display node number and private IP address of leader node
+ list List private IP addresses of nodes in group, annotate leader
status Show status of nodes in NAT gateway group
EOF
exit 1
\#*) continue ;;
esac
case "$_options" in
- slave-only|"") : ;;
+ follower-only|"") : ;;
*) die "${prog}: Invalid options \"${_options}\" in \"$CTDB_NATGW_NODES\""
esac
done <<EOF
return 0
}
-# Print the PNN and IP address of the NAT gateway master node
-find_master ()
+# Print the PNN and IP address of the NAT gateway leader node
+find_leader ()
{
get_natgw_nodes || \
die "${prog}: NAT gateway nodes file \"$CTDB_NATGW_NODES\" not found"
get_nodestatus_X || \
die "${prog}: Unable to get status of nodes"
- # $_ms is an @-delimited list of nodes that are allowed to be the master
+ # $_ms is an @-delimited list of nodes that are allowed to be the leader
_ms="@"
while read _ip _options ; do
case "$_options" in
# Now filter by $ms and by status of nodes...
# Note that the 3 awk invocations below have "||" between them, so
- # the first to succeed will select the master node.
+ # the first to succeed will select the leader node.
# First try for a fully active and healthy node, so must not be
# DISABLED, UNHEALTHY or INACTIVE (last covers DISCONNECTED,
EOF
}
-# List all nodes in the NAT gateway group, annotating the master node
+# List all nodes in the NAT gateway group, annotating the leader node
nodes_list ()
{
get_natgw_nodes || \
die "${prog}: NAT gateway nodes file \"$CTDB_NATGW_NODES\" not found"
# Intentional word splitting here
# shellcheck disable=SC2046
- set -- $(find_master) || \
- die "${prog}: Unable to determine NAT gateway master node"
- _master_ip="$2"
+ set -- $(find_leader) || \
+ die "${prog}: Unable to determine NAT gateway leader node"
+ _leader_ip="$2"
- # Annotate the master node
+ # Annotate the leader node
while read _ip _options ; do
- if [ "$_ip" = "$_master_ip" ] ; then
- _options="MASTER${_options:+,}${_options}"
+ if [ "$_ip" = "$_leader_ip" ] ; then
+ _options="LEADER${_options:+,}${_options}"
fi
# There is no other way to do this and keep shellcheck happy.
# The tab character must be in the format string and the
cmd="$1"
case "$cmd" in
- master) find_master ;;
+ leader) find_leader ;;
list) nodes_list ;;
status) nodes_status ;;
*) usage ;;