ctdb: Change NAT gateway to use leader/follower
authorMartin Schwenke <martin@meltin.net>
Wed, 24 Jun 2020 01:20:24 +0000 (11:20 +1000)
committerAmitay Isaacs <amitay@samba.org>
Fri, 24 Jul 2020 08:37:31 +0000 (08:37 +0000)
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>
36 files changed:
ctdb/config/events/legacy/11.natgw.script
ctdb/doc/ctdb-script.options.5.xml
ctdb/doc/ctdb.1.xml
ctdb/doc/ctdb.7.xml
ctdb/tests/UNIT/eventscripts/11.natgw.002.sh
ctdb/tests/UNIT/eventscripts/11.natgw.003.sh
ctdb/tests/UNIT/eventscripts/11.natgw.004.sh
ctdb/tests/UNIT/eventscripts/11.natgw.011.sh
ctdb/tests/UNIT/eventscripts/11.natgw.012.sh
ctdb/tests/UNIT/eventscripts/11.natgw.013.sh
ctdb/tests/UNIT/eventscripts/11.natgw.014.sh
ctdb/tests/UNIT/eventscripts/11.natgw.015.sh
ctdb/tests/UNIT/eventscripts/11.natgw.021.sh
ctdb/tests/UNIT/eventscripts/11.natgw.022.sh
ctdb/tests/UNIT/eventscripts/11.natgw.023.sh
ctdb/tests/UNIT/eventscripts/11.natgw.024.sh
ctdb/tests/UNIT/eventscripts/11.natgw.025.sh
ctdb/tests/UNIT/eventscripts/11.natgw.031.sh
ctdb/tests/UNIT/eventscripts/11.natgw.041.sh
ctdb/tests/UNIT/eventscripts/11.natgw.042.sh
ctdb/tests/UNIT/eventscripts/11.natgw.051.sh
ctdb/tests/UNIT/eventscripts/11.natgw.052.sh
ctdb/tests/UNIT/eventscripts/11.natgw.053.sh
ctdb/tests/UNIT/eventscripts/11.natgw.054.sh
ctdb/tests/UNIT/eventscripts/scripts/11.natgw.sh
ctdb/tests/UNIT/eventscripts/stubs/ctdb_natgw
ctdb/tests/UNIT/tool/ctdb.natgw.001.sh
ctdb/tests/UNIT/tool/ctdb.natgw.002.sh
ctdb/tests/UNIT/tool/ctdb.natgw.003.sh
ctdb/tests/UNIT/tool/ctdb.natgw.004.sh
ctdb/tests/UNIT/tool/ctdb.natgw.005.sh
ctdb/tests/UNIT/tool/ctdb.natgw.006.sh
ctdb/tests/UNIT/tool/ctdb.natgw.007.sh
ctdb/tests/UNIT/tool/ctdb.natgw.008.sh
ctdb/tools/ctdb.c
ctdb/tools/ctdb_natgw

index 18b064a1efb17c14de9f671c51b02eb4e2405a5f..b02ff7a6bf4c57f66a10584f186f71710b8985ff 100755 (executable)
@@ -23,14 +23,14 @@ ctdb_setup_state_dir "failover" "$service_name"
 # 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"
 }
 
@@ -38,7 +38,7 @@ natgw_check_config ()
 {
     [ -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" ] || \
@@ -113,7 +113,7 @@ natgw_clear ()
     fi
 }
 
-natgw_set_master ()
+natgw_set_leader ()
 {
     set_proc sys/net/ipv4/ip_forward 1
     iptables -A POSTROUTING -t nat \
@@ -141,7 +141,7 @@ natgw_set_master ()
     done
 }
 
-natgw_set_slave ()
+natgw_set_follower ()
 {
     _natgwip="$1"
 
@@ -151,33 +151,33 @@ natgw_set_slave ()
     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"
 }
@@ -205,17 +205,17 @@ startup)
 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
index fe0517fe071eb49b3445573524c1b9eb5d506bca..d46de369c5cfcca1da5e4a466db6fabdf1ca4efc 100644 (file)
        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.
index fe2b675ff2c50a3d3cf6f792797f5440660a88de..9b530087e920bcea964cbbb17d166f15c47e4bf7 100644 (file)
@@ -445,7 +445,7 @@ Duration of last recovery/failover: 2.248552 seconds
     </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
@@ -456,11 +456,11 @@ Duration of last recovery/failover: 2.248552 seconds
 
       <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:
@@ -475,14 +475,14 @@ Duration of last recovery/failover: 2.248552 seconds
          <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>
index 2079ed713e39ea12956b3f1c85882d52e08db1cb..5ec69e4c8711937e84a430871a55f54b878e0779 100644 (file)
@@ -715,13 +715,13 @@ CTDB_LVS_NODES=/usr/local/etc/ctdb/lvs_nodes
       </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>
@@ -742,9 +742,9 @@ CTDB_NATGW_DEFAULT_GATEWAY=10.0.0.1
 
       <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>
@@ -765,15 +765,15 @@ CTDB_NATGW_DEFAULT_GATEWAY=10.0.0.1
        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
@@ -783,8 +783,8 @@ CTDB_NATGW_DEFAULT_GATEWAY=10.0.0.1
       </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
index 5e3f2d3a224b97fa5d9298e167c5944d668c77e9..90b13991fe5579f5273b34a35c8bfaef66034464 100755 (executable)
@@ -7,7 +7,7 @@ define_test "missing config file"
 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
index 46237e5f31458d8b852564a88d76d253e9f35c54..370c10d3827b693d7b6da982772487e9b3387695 100755 (executable)
@@ -2,12 +2,12 @@
 
 . "${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
index e441c4c5965e6b019058cfe85aedffd58922d099..0f06be1590eb2b05264562c056f5aceb311e0e4b 100755 (executable)
@@ -2,12 +2,12 @@
 
 . "${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
index e8513c9f2e3e8106a4da04b3d36f30932ab6de5a..407f049daa0702dbb95bd62f32414e56addc8ca5 100755 (executable)
@@ -2,12 +2,12 @@
 
 . "${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
@@ -19,5 +19,5 @@ simple_test_event "ipreallocated"
 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"
index 94cbe9d22b99dda1777172f0324e1e2467c07da5..fdec8eee30153f9b09cb2f34de170fd39f5bb9af 100755 (executable)
@@ -2,13 +2,13 @@
 
 . "${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
@@ -16,8 +16,8 @@ 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"
index 0a15862d75abd42123273176b0cc6c4838f75829..cb9af468e29e2d525e7f4488003c0e0a32b0257a 100755 (executable)
@@ -2,12 +2,12 @@
 
 . "${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
@@ -23,5 +23,5 @@ simple_test_event "ipreallocated"
 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"
index f3a586a9a66524b66634ad3bfc7dfcf5cc4009b0..0fc3ccc758ea6192ed7633d71f0be6737c9eff93 100755 (executable)
@@ -2,13 +2,13 @@
 
 . "${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
@@ -20,8 +20,8 @@ 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"
index dbe09d2efd18eae7c4256b61bc9c83aa96c3f5a4..84cc17bc37ca4755f9f04a21313f09dce7cf01d3 100755 (executable)
@@ -6,10 +6,10 @@ define_test "basic configuration, multiple transitions"
 
 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
@@ -21,14 +21,14 @@ simple_test_event "ipreallocated"
 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
@@ -36,16 +36,16 @@ 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
@@ -57,5 +57,5 @@ simple_test_event "ipreallocated"
 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"
index 41bb185bccf7a74928ac2d7b3663dd94f8fe1183..7d73c370d62251241fea149021123d4cdd0e6942 100755 (executable)
@@ -2,12 +2,12 @@
 
 . "${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
@@ -20,8 +20,8 @@ EOF
 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"
index 4c2c11b5bad2cb4fed8221273f333a872a8c28f4..2a4dd47c2f5ef93bf5853a5fd45e0b49b0ca1b35 100755 (executable)
@@ -2,13 +2,13 @@
 
 . "${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
@@ -20,8 +20,8 @@ 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"
index c487aaaeb53a71cca803e06fb84a1d2e7225a057..9fdf734367e28aee28d3cbf3d7895d1506574329 100755 (executable)
@@ -2,12 +2,12 @@
 
 . "${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
@@ -20,8 +20,8 @@ EOF
 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"
index a13879cb30e96e80448e036f5bc0fa07a5833303..24f677dea45c81265f098158e21e60103380398a 100755 (executable)
@@ -2,13 +2,13 @@
 
 . "${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
@@ -20,8 +20,8 @@ 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"
index a1b049f2e393da34a7bee24b9d026e2044836378..d4221c273ce4e112d690500ccd66db28a8288e1e 100755 (executable)
@@ -10,10 +10,10 @@ setup_script_options <<EOF
 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
@@ -22,17 +22,17 @@ EOF
 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
@@ -40,16 +40,16 @@ 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
@@ -58,8 +58,8 @@ EOF
 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"
index 0cff321764eb9ed9d3c05f5ae14dcc4b8d521403..6a5bcad3845d697d607c4f85528cc634bc01337e 100755 (executable)
@@ -2,7 +2,7 @@
 
 . "${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
 
@@ -14,7 +14,7 @@ echo "##################################################"
 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
@@ -23,10 +23,10 @@ EOF
 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 "##################################################"
@@ -42,7 +42,7 @@ simple_test_event "ipreallocated"
 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 "##################################################"
@@ -55,8 +55,8 @@ EOF
 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"
index 05eeb6ae4b0b31ae53890214fd2b50a255e75e7e..1cbe5b34d24fc80db968dbb4596552cab6f02c0a 100755 (executable)
@@ -2,13 +2,13 @@
 
 . "${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
@@ -20,5 +20,5 @@ 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
index 39709c29c16572f11826eb07c5d889b34c9879d4..b643fd3afc7f0ef0158da3439e69002afd53aa9f 100755 (executable)
@@ -2,13 +2,13 @@
 
 . "${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
@@ -21,5 +21,5 @@ 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
index 9bf8569607cb89d72ff8bff3a824e20d10b55e71..6c711c05aa2f40b734b82150876641611919e799 100755 (executable)
@@ -2,13 +2,13 @@
 
 . "${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
index 2d4a339cb9848c459064649f20a8535469c04f56..ad0200326662d28baea0d8e1ada4bd3ab4649dc1 100755 (executable)
@@ -2,13 +2,13 @@
 
 . "${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
index d9b173e8d22a27adb400ed64d677bfbfe2a1a5d5..e9bded195ffd14cbb9f982add1a7bf22442921c8 100755 (executable)
@@ -2,12 +2,12 @@
 
 . "${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
index a2173f38fd355d06156ea18407aae08694429b18..2a79cde40583b61d7f2fb300682863b178da0a00 100755 (executable)
@@ -2,12 +2,12 @@
 
 . "${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
index 75b2771899c14d6cdc04386e9362686d859612e8..511dc27a6945694b51c47a94a4205daaf617c7e2 100644 (file)
@@ -14,12 +14,12 @@ setup_ctdb_natgw ()
        # 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"
@@ -43,7 +43,7 @@ CTDB_NATGW_DEFAULT_GATEWAY="10.1.1.254"
 EOF
 }
 
-ok_natgw_master_ip_addr_show ()
+ok_natgw_leader_ip_addr_show ()
 {
        _mac=$(echo "$CTDB_NATGW_PUBLIC_IFACE" |
               cksum |
@@ -60,7 +60,7 @@ ok_natgw_master_ip_addr_show ()
 EOF
 }
 
-ok_natgw_slave_ip_addr_show ()
+ok_natgw_follower_ip_addr_show ()
 {
        _mac=$(echo "$CTDB_NATGW_PUBLIC_IFACE" |
               cksum |
@@ -72,7 +72,7 @@ ok_natgw_slave_ip_addr_show ()
 EOF
 }
 
-ok_natgw_master_static_routes ()
+ok_natgw_leader_static_routes ()
 {
        _nl="
 "
@@ -97,7 +97,7 @@ ok_natgw_master_static_routes ()
        ok "$_t"
 }
 
-ok_natgw_slave_static_routes ()
+ok_natgw_follower_static_routes ()
 {
        _nl="
 "
@@ -112,7 +112,7 @@ ok_natgw_slave_static_routes ()
                # 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"
index 96ba7ef8bbfd6accbec0aaea998c34760d630b9a..e64a95695bb7448ee3367a9a77db9d4289759f79 100755 (executable)
@@ -10,25 +10,25 @@ not_implemented ()
     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
index b73ce24c9869cebe43d3bc0be69317983aaa2c50..ad18f9d7216da833d744bd2a9c1d2643ee472af2 100755 (executable)
@@ -23,12 +23,12 @@ required_result 0 <<EOF
 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
index 259c8695e644c1db2c0d3632b89aab90890f6ea8..424189f0affe6b8076f054629caf639fc2624745 100755 (executable)
@@ -23,13 +23,13 @@ required_result 0 <<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
 
index af48b48c622ecdd6f9887ec05f95470fb58ab6d6..93522d0aa376af7edae656dfb8bb85a2c3300269 100755 (executable)
@@ -22,13 +22,13 @@ required_result 0 <<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
index 8e48dcf432f0316b0d1e7bcb4e441853c14dbdaa..af8ea2266df01403561a5e86105474f92f694030 100755 (executable)
@@ -23,14 +23,14 @@ required_result 0 <<EOF
 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
index ccb05e8d8afca6cc25d502a3f59871d756e9227a..6a6bbdeebeb383ac11b265c141e2c251a505f34d 100755 (executable)
@@ -23,12 +23,12 @@ required_result 0 <<EOF
 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
index 0f194d81809ce870d226c87bfac08db003c1d96f..8080f4edc4e7e43288358fb74c1f7c1bcc03d657 100755 (executable)
@@ -2,10 +2,10 @@
 
 . "${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
@@ -23,13 +23,13 @@ required_result 0 <<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
 
index 9fdfc302f3b3600c8abfb4b407959171e2ba3c7e..ca8ea354aa1d4c81c353f570910c55c33d8b6f37 100755 (executable)
@@ -2,12 +2,12 @@
 
 . "${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
@@ -22,14 +22,14 @@ 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
index db204a51383e73285b33327faaff9512d2418edf..3e485f83eab80ac32dbc51559da3f8ac8bda2cc4 100755 (executable)
@@ -23,13 +23,13 @@ required_result 0 <<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
 
index ba994caff2d1cdc6d4afb4d7b806bfe8a0b0ddf5..01803efa69648fda5c592e390d598045569e6632 100644 (file)
@@ -6027,7 +6027,7 @@ static const struct ctdb_cmd {
                "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,
index d37b9f7c0b94263cd5bacacbc228cf73cec69a94..b37b7d34032251684fa761391b1375c6290186e1 100755 (executable)
@@ -23,8 +23,8 @@ cat <<EOF
 $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
@@ -68,7 +68,7 @@ get_natgw_nodes ()
            \#*) continue ;;
        esac
        case "$_options" in
-           slave-only|"") : ;;
+           follower-only|"") : ;;
            *) die "${prog}: Invalid options \"${_options}\" in  \"$CTDB_NATGW_NODES\""
        esac
     done <<EOF
@@ -78,15 +78,15 @@ 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
@@ -99,7 +99,7 @@ EOF
     # 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,
@@ -131,21 +131,21 @@ $nodestatus_X
 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
@@ -187,7 +187,7 @@ prog=$(basename "$0")
 cmd="$1"
 
 case "$cmd" in
-    master)    find_master ;;
+    leader)    find_leader ;;
     list)      nodes_list ;;
     status)    nodes_status ;;
     *)         usage ;;