diff options
author | Martin Schwenke <martin@meltin.net> | 2020-06-24 11:20:24 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2020-07-24 08:37:31 +0000 |
commit | 16b848553da47f0716d74c13bbbfba50ef5d2cd1 (patch) | |
tree | dde056a2f7e730d05c18d5ed6674146bc94d62b2 /ctdb | |
parent | 5ce6133a75107abdcb9fcfd93bc7594812dc5055 (diff) | |
download | samba-16b848553da47f0716d74c13bbbfba50ef5d2cd1.tar.gz |
ctdb: Change NAT gateway to use leader/follower
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>
Diffstat (limited to 'ctdb')
36 files changed, 189 insertions, 189 deletions
diff --git a/ctdb/config/events/legacy/11.natgw.script b/ctdb/config/events/legacy/11.natgw.script index 18b064a1efb..b02ff7a6bf4 100755 --- a/ctdb/config/events/legacy/11.natgw.script +++ b/ctdb/config/events/legacy/11.natgw.script @@ -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 diff --git a/ctdb/doc/ctdb-script.options.5.xml b/ctdb/doc/ctdb-script.options.5.xml index fe0517fe071..d46de369c5c 100644 --- a/ctdb/doc/ctdb-script.options.5.xml +++ b/ctdb/doc/ctdb-script.options.5.xml @@ -125,9 +125,9 @@ 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>. @@ -140,12 +140,12 @@ <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> @@ -161,7 +161,7 @@ <para> File format: <screen> -<parameter>IPADDR</parameter> <optional>slave-only</optional> +<parameter>IPADDR</parameter> <optional>follower-only</optional> </screen> </para> <para> @@ -169,8 +169,8 @@ 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. @@ -187,7 +187,7 @@ <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> @@ -216,7 +216,7 @@ <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> @@ -239,19 +239,19 @@ </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. diff --git a/ctdb/doc/ctdb.1.xml b/ctdb/doc/ctdb.1.xml index fe2b675ff2c..9b530087e92 100644 --- a/ctdb/doc/ctdb.1.xml +++ b/ctdb/doc/ctdb.1.xml @@ -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> diff --git a/ctdb/doc/ctdb.7.xml b/ctdb/doc/ctdb.7.xml index 2079ed713e3..5ec69e4c871 100644 --- a/ctdb/doc/ctdb.7.xml +++ b/ctdb/doc/ctdb.7.xml @@ -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 diff --git a/ctdb/tests/UNIT/eventscripts/11.natgw.002.sh b/ctdb/tests/UNIT/eventscripts/11.natgw.002.sh index 5e3f2d3a224..90b13991fe5 100755 --- a/ctdb/tests/UNIT/eventscripts/11.natgw.002.sh +++ b/ctdb/tests/UNIT/eventscripts/11.natgw.002.sh @@ -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 diff --git a/ctdb/tests/UNIT/eventscripts/11.natgw.003.sh b/ctdb/tests/UNIT/eventscripts/11.natgw.003.sh index 46237e5f314..370c10d3827 100755 --- a/ctdb/tests/UNIT/eventscripts/11.natgw.003.sh +++ b/ctdb/tests/UNIT/eventscripts/11.natgw.003.sh @@ -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 diff --git a/ctdb/tests/UNIT/eventscripts/11.natgw.004.sh b/ctdb/tests/UNIT/eventscripts/11.natgw.004.sh index e441c4c5965..0f06be1590e 100755 --- a/ctdb/tests/UNIT/eventscripts/11.natgw.004.sh +++ b/ctdb/tests/UNIT/eventscripts/11.natgw.004.sh @@ -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 diff --git a/ctdb/tests/UNIT/eventscripts/11.natgw.011.sh b/ctdb/tests/UNIT/eventscripts/11.natgw.011.sh index e8513c9f2e3..407f049daa0 100755 --- a/ctdb/tests/UNIT/eventscripts/11.natgw.011.sh +++ b/ctdb/tests/UNIT/eventscripts/11.natgw.011.sh @@ -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" diff --git a/ctdb/tests/UNIT/eventscripts/11.natgw.012.sh b/ctdb/tests/UNIT/eventscripts/11.natgw.012.sh index 94cbe9d22b9..fdec8eee301 100755 --- a/ctdb/tests/UNIT/eventscripts/11.natgw.012.sh +++ b/ctdb/tests/UNIT/eventscripts/11.natgw.012.sh @@ -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" diff --git a/ctdb/tests/UNIT/eventscripts/11.natgw.013.sh b/ctdb/tests/UNIT/eventscripts/11.natgw.013.sh index 0a15862d75a..cb9af468e29 100755 --- a/ctdb/tests/UNIT/eventscripts/11.natgw.013.sh +++ b/ctdb/tests/UNIT/eventscripts/11.natgw.013.sh @@ -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" diff --git a/ctdb/tests/UNIT/eventscripts/11.natgw.014.sh b/ctdb/tests/UNIT/eventscripts/11.natgw.014.sh index f3a586a9a66..0fc3ccc758e 100755 --- a/ctdb/tests/UNIT/eventscripts/11.natgw.014.sh +++ b/ctdb/tests/UNIT/eventscripts/11.natgw.014.sh @@ -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" diff --git a/ctdb/tests/UNIT/eventscripts/11.natgw.015.sh b/ctdb/tests/UNIT/eventscripts/11.natgw.015.sh index dbe09d2efd1..84cc17bc37c 100755 --- a/ctdb/tests/UNIT/eventscripts/11.natgw.015.sh +++ b/ctdb/tests/UNIT/eventscripts/11.natgw.015.sh @@ -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" diff --git a/ctdb/tests/UNIT/eventscripts/11.natgw.021.sh b/ctdb/tests/UNIT/eventscripts/11.natgw.021.sh index 41bb185bccf..7d73c370d62 100755 --- a/ctdb/tests/UNIT/eventscripts/11.natgw.021.sh +++ b/ctdb/tests/UNIT/eventscripts/11.natgw.021.sh @@ -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" diff --git a/ctdb/tests/UNIT/eventscripts/11.natgw.022.sh b/ctdb/tests/UNIT/eventscripts/11.natgw.022.sh index 4c2c11b5bad..2a4dd47c2f5 100755 --- a/ctdb/tests/UNIT/eventscripts/11.natgw.022.sh +++ b/ctdb/tests/UNIT/eventscripts/11.natgw.022.sh @@ -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" diff --git a/ctdb/tests/UNIT/eventscripts/11.natgw.023.sh b/ctdb/tests/UNIT/eventscripts/11.natgw.023.sh index c487aaaeb53..9fdf734367e 100755 --- a/ctdb/tests/UNIT/eventscripts/11.natgw.023.sh +++ b/ctdb/tests/UNIT/eventscripts/11.natgw.023.sh @@ -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" diff --git a/ctdb/tests/UNIT/eventscripts/11.natgw.024.sh b/ctdb/tests/UNIT/eventscripts/11.natgw.024.sh index a13879cb30e..24f677dea45 100755 --- a/ctdb/tests/UNIT/eventscripts/11.natgw.024.sh +++ b/ctdb/tests/UNIT/eventscripts/11.natgw.024.sh @@ -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" diff --git a/ctdb/tests/UNIT/eventscripts/11.natgw.025.sh b/ctdb/tests/UNIT/eventscripts/11.natgw.025.sh index a1b049f2e39..d4221c273ce 100755 --- a/ctdb/tests/UNIT/eventscripts/11.natgw.025.sh +++ b/ctdb/tests/UNIT/eventscripts/11.natgw.025.sh @@ -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" diff --git a/ctdb/tests/UNIT/eventscripts/11.natgw.031.sh b/ctdb/tests/UNIT/eventscripts/11.natgw.031.sh index 0cff321764e..6a5bcad3845 100755 --- a/ctdb/tests/UNIT/eventscripts/11.natgw.031.sh +++ b/ctdb/tests/UNIT/eventscripts/11.natgw.031.sh @@ -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" diff --git a/ctdb/tests/UNIT/eventscripts/11.natgw.041.sh b/ctdb/tests/UNIT/eventscripts/11.natgw.041.sh index 05eeb6ae4b0..1cbe5b34d24 100755 --- a/ctdb/tests/UNIT/eventscripts/11.natgw.041.sh +++ b/ctdb/tests/UNIT/eventscripts/11.natgw.041.sh @@ -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 diff --git a/ctdb/tests/UNIT/eventscripts/11.natgw.042.sh b/ctdb/tests/UNIT/eventscripts/11.natgw.042.sh index 39709c29c16..b643fd3afc7 100755 --- a/ctdb/tests/UNIT/eventscripts/11.natgw.042.sh +++ b/ctdb/tests/UNIT/eventscripts/11.natgw.042.sh @@ -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 diff --git a/ctdb/tests/UNIT/eventscripts/11.natgw.051.sh b/ctdb/tests/UNIT/eventscripts/11.natgw.051.sh index 9bf8569607c..6c711c05aa2 100755 --- a/ctdb/tests/UNIT/eventscripts/11.natgw.051.sh +++ b/ctdb/tests/UNIT/eventscripts/11.natgw.051.sh @@ -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 diff --git a/ctdb/tests/UNIT/eventscripts/11.natgw.052.sh b/ctdb/tests/UNIT/eventscripts/11.natgw.052.sh index 2d4a339cb98..ad020032666 100755 --- a/ctdb/tests/UNIT/eventscripts/11.natgw.052.sh +++ b/ctdb/tests/UNIT/eventscripts/11.natgw.052.sh @@ -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 diff --git a/ctdb/tests/UNIT/eventscripts/11.natgw.053.sh b/ctdb/tests/UNIT/eventscripts/11.natgw.053.sh index d9b173e8d22..e9bded195ff 100755 --- a/ctdb/tests/UNIT/eventscripts/11.natgw.053.sh +++ b/ctdb/tests/UNIT/eventscripts/11.natgw.053.sh @@ -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 diff --git a/ctdb/tests/UNIT/eventscripts/11.natgw.054.sh b/ctdb/tests/UNIT/eventscripts/11.natgw.054.sh index a2173f38fd3..2a79cde4058 100755 --- a/ctdb/tests/UNIT/eventscripts/11.natgw.054.sh +++ b/ctdb/tests/UNIT/eventscripts/11.natgw.054.sh @@ -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 diff --git a/ctdb/tests/UNIT/eventscripts/scripts/11.natgw.sh b/ctdb/tests/UNIT/eventscripts/scripts/11.natgw.sh index 75b2771899c..511dc27a694 100644 --- a/ctdb/tests/UNIT/eventscripts/scripts/11.natgw.sh +++ b/ctdb/tests/UNIT/eventscripts/scripts/11.natgw.sh @@ -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" diff --git a/ctdb/tests/UNIT/eventscripts/stubs/ctdb_natgw b/ctdb/tests/UNIT/eventscripts/stubs/ctdb_natgw index 96ba7ef8bbf..e64a95695bb 100755 --- a/ctdb/tests/UNIT/eventscripts/stubs/ctdb_natgw +++ b/ctdb/tests/UNIT/eventscripts/stubs/ctdb_natgw @@ -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 diff --git a/ctdb/tests/UNIT/tool/ctdb.natgw.001.sh b/ctdb/tests/UNIT/tool/ctdb.natgw.001.sh index b73ce24c986..ad18f9d7216 100755 --- a/ctdb/tests/UNIT/tool/ctdb.natgw.001.sh +++ b/ctdb/tests/UNIT/tool/ctdb.natgw.001.sh @@ -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 diff --git a/ctdb/tests/UNIT/tool/ctdb.natgw.002.sh b/ctdb/tests/UNIT/tool/ctdb.natgw.002.sh index 259c8695e64..424189f0aff 100755 --- a/ctdb/tests/UNIT/tool/ctdb.natgw.002.sh +++ b/ctdb/tests/UNIT/tool/ctdb.natgw.002.sh @@ -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 diff --git a/ctdb/tests/UNIT/tool/ctdb.natgw.003.sh b/ctdb/tests/UNIT/tool/ctdb.natgw.003.sh index af48b48c622..93522d0aa37 100755 --- a/ctdb/tests/UNIT/tool/ctdb.natgw.003.sh +++ b/ctdb/tests/UNIT/tool/ctdb.natgw.003.sh @@ -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 diff --git a/ctdb/tests/UNIT/tool/ctdb.natgw.004.sh b/ctdb/tests/UNIT/tool/ctdb.natgw.004.sh index 8e48dcf432f..af8ea2266df 100755 --- a/ctdb/tests/UNIT/tool/ctdb.natgw.004.sh +++ b/ctdb/tests/UNIT/tool/ctdb.natgw.004.sh @@ -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 diff --git a/ctdb/tests/UNIT/tool/ctdb.natgw.005.sh b/ctdb/tests/UNIT/tool/ctdb.natgw.005.sh index ccb05e8d8af..6a6bbdeebeb 100755 --- a/ctdb/tests/UNIT/tool/ctdb.natgw.005.sh +++ b/ctdb/tests/UNIT/tool/ctdb.natgw.005.sh @@ -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 diff --git a/ctdb/tests/UNIT/tool/ctdb.natgw.006.sh b/ctdb/tests/UNIT/tool/ctdb.natgw.006.sh index 0f194d81809..8080f4edc4e 100755 --- a/ctdb/tests/UNIT/tool/ctdb.natgw.006.sh +++ b/ctdb/tests/UNIT/tool/ctdb.natgw.006.sh @@ -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 diff --git a/ctdb/tests/UNIT/tool/ctdb.natgw.007.sh b/ctdb/tests/UNIT/tool/ctdb.natgw.007.sh index 9fdfc302f3b..ca8ea354aa1 100755 --- a/ctdb/tests/UNIT/tool/ctdb.natgw.007.sh +++ b/ctdb/tests/UNIT/tool/ctdb.natgw.007.sh @@ -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 diff --git a/ctdb/tests/UNIT/tool/ctdb.natgw.008.sh b/ctdb/tests/UNIT/tool/ctdb.natgw.008.sh index db204a51383..3e485f83eab 100755 --- a/ctdb/tests/UNIT/tool/ctdb.natgw.008.sh +++ b/ctdb/tests/UNIT/tool/ctdb.natgw.008.sh @@ -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 diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index ba994caff2d..01803efa696 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -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, diff --git a/ctdb/tools/ctdb_natgw b/ctdb/tools/ctdb_natgw index d37b9f7c0b9..b37b7d34032 100755 --- a/ctdb/tools/ctdb_natgw +++ b/ctdb/tools/ctdb_natgw @@ -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 ;; |