The branch, master has been updated via 0c373f2 ctdb-tools: Drop onnode node specifications for recmaster/lvs/natgw via d12858a ctdb-tools: Drop "ctdb natgwlist" via cc3e9a6 ctdb-tests: Make ctdb natgw tool tests cover all the desired outputs via 515e2a2 ctdb-tools: Add top-level "ctdb natgw" command via 3f3c483 ctdb-scripts: Drop node count from "ctdb natgw status" output via fadc67c ctdb-scripts: Tweak NAT gateway list output format via cdaa829 ctdb-scripts: Fix incorrect comment via 09173f8 ctdb-ipalloc: Do ipreallocated even if no IP addresses can be allocated via 107f40a ctdb-daemon: Move port filtering to server side when getting tickles via 84fdc2a ctdb-scripts: Improve error messages when using NFS service_check_cmd via 59c7164 ctdb-tools: Fix a dangling reference to the LVS capability from 5f72883 ctdb-client: Use correct TDB flags for opening database
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 0c373f2854a3414680ce71e8738b429a60b70fd3 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Apr 18 16:59:53 2016 +1000 ctdb-tools: Drop onnode node specifications for recmaster/lvs/natgw LVS and NAT gateway support had bit-rotted. We don't use any of these in scripts/tests and we very much doubt anyone else uses them. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> Autobuild-User(master): Amitay Isaacs <ami...@samba.org> Autobuild-Date(master): Mon Apr 25 10:34:47 CEST 2016 on sn-devel-144 commit d12858aa5bf69b28ee9e9eb015e363f190eb3804 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Apr 18 17:13:38 2016 +1000 ctdb-tools: Drop "ctdb natgwlist" The new individual status options are better. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit cc3e9a651df80fe40d29f8b5f70d72a45beccc6f Author: Martin Schwenke <mar...@meltin.net> Date: Mon Apr 18 14:47:23 2016 +1000 ctdb-tests: Make ctdb natgw tool tests cover all the desired outputs Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 515e2a2d877b66d7fb3bdf86b3e03cefd16da9f6 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Apr 18 14:26:58 2016 +1000 ctdb-tools: Add top-level "ctdb natgw" command This can list the different aspects of status: master, list, status. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 3f3c483196178e36667236c5e665d9b90f6c81cc Author: Martin Schwenke <mar...@meltin.net> Date: Mon Apr 18 15:44:15 2016 +1000 ctdb-scripts: Drop node count from "ctdb natgw status" output Tweak "ctdb natgw natgwlist" to keep output format the same. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit fadc67cc45b32ccf4ff9608498d9e067432b45cd Author: Martin Schwenke <mar...@meltin.net> Date: Mon Apr 18 14:48:10 2016 +1000 ctdb-scripts: Tweak NAT gateway list output format Avoid gratuitous trailing whitespace. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit cdaa82944a50756df9e8d39ab9387302a2b16cc3 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Apr 18 14:19:10 2016 +1000 ctdb-scripts: Fix incorrect comment Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 09173f80d9924fab2fff185557f57eebdcf07745 Author: Martin Schwenke <mar...@meltin.net> Date: Wed Apr 20 20:17:04 2016 +1000 ctdb-ipalloc: Do ipreallocated even if no IP addresses can be allocated In particular, LVS won't work at all if there are no public IP addresses. This is a temporary solution until a generic reconfiguration hook is implemented. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 107f40abf9efaafb2004c51b9e83b5247b48b202 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Mar 23 20:18:25 2015 +1100 ctdb-daemon: Move port filtering to server side when getting tickles Why allocate all that memory and transfer all that data across the socket? Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 84fdc2a562bf26ecc9b3709cf47175e323bac15c Author: Martin Schwenke <mar...@meltin.net> Date: Wed Apr 20 15:19:45 2016 +1000 ctdb-scripts: Improve error messages when using NFS service_check_cmd When external monitoring is enabled for an NFS service using service_check_cmd then $ctdb_check_rpc_out is empty because the internal RPC checking isn't used. This results in empty log messages like: 60.nfs: ERROR: or: 60.nfs: WARNING: Improve this so it at least says: 60.nfs: ERROR: monitoring service "statd" failed Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 59c71646ff6b9da2b7dbad9971f02e8007a09bbb Author: Martin Schwenke <mar...@meltin.net> Date: Mon Apr 18 14:21:35 2016 +1000 ctdb-tools: Fix a dangling reference to the LVS capability Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> ----------------------------------------------------------------------- Summary of changes: ctdb/config/events.d/11.natgw | 2 +- ctdb/config/events.d/60.nfs | 8 ++- ctdb/doc/ctdb.1.xml | 69 +++++++++++++++++----- ctdb/doc/onnode.1.xml | 21 ------- ctdb/server/ctdb_takeover.c | 41 +++++++++---- ctdb/tests/onnode/0080.sh | 17 ------ ctdb/tests/onnode/0081.sh | 17 ------ ctdb/tests/onnode/0090.sh | 21 ------- ctdb/tests/onnode/0091.sh | 21 ------- ...stubby.natgwlist.001.sh => stubby.natgw.001.sh} | 44 +++++++++++--- ...stubby.natgwlist.002.sh => stubby.natgw.002.sh} | 45 +++++++++++--- ...stubby.natgwlist.003.sh => stubby.natgw.003.sh} | 41 ++++++++++--- ...stubby.natgwlist.004.sh => stubby.natgw.004.sh} | 44 +++++++++++--- ...stubby.natgwlist.005.sh => stubby.natgw.005.sh} | 44 +++++++++++--- ...stubby.natgwlist.006.sh => stubby.natgw.006.sh} | 44 +++++++++++--- ...stubby.natgwlist.007.sh => stubby.natgw.007.sh} | 43 +++++++++++--- ...stubby.natgwlist.008.sh => stubby.natgw.008.sh} | 44 +++++++++++--- ctdb/tools/ctdb.c | 24 +++----- ctdb/tools/ctdb_natgw | 22 +------ ctdb/tools/onnode | 61 +------------------ 20 files changed, 382 insertions(+), 291 deletions(-) delete mode 100755 ctdb/tests/onnode/0080.sh delete mode 100755 ctdb/tests/onnode/0081.sh delete mode 100755 ctdb/tests/onnode/0090.sh delete mode 100755 ctdb/tests/onnode/0091.sh rename ctdb/tests/tool/{stubby.natgwlist.001.sh => stubby.natgw.001.sh} (65%) rename ctdb/tests/tool/{stubby.natgwlist.002.sh => stubby.natgw.002.sh} (65%) rename ctdb/tests/tool/{stubby.natgwlist.003.sh => stubby.natgw.003.sh} (64%) rename ctdb/tests/tool/{stubby.natgwlist.004.sh => stubby.natgw.004.sh} (67%) rename ctdb/tests/tool/{stubby.natgwlist.005.sh => stubby.natgw.005.sh} (66%) rename ctdb/tests/tool/{stubby.natgwlist.006.sh => stubby.natgw.006.sh} (66%) rename ctdb/tests/tool/{stubby.natgwlist.007.sh => stubby.natgw.007.sh} (66%) rename ctdb/tests/tool/{stubby.natgwlist.008.sh => stubby.natgw.008.sh} (66%) Changeset truncated at 500 lines: diff --git a/ctdb/config/events.d/11.natgw b/ctdb/config/events.d/11.natgw index bc00788..d6f8161 100755 --- a/ctdb/config/events.d/11.natgw +++ b/ctdb/config/events.d/11.natgw @@ -156,7 +156,7 @@ natgw_set_slave () natgw_ensure_master () { set -- $("${CTDB_HELPER_BINDIR}/ctdb_natgw" master) - natgwmaster="${1:--1}" # Default is -1 if natgwlist fails + natgwmaster="${1:--1}" # Default is -1, for failure above natgwip="$2" if [ "$natgwmaster" = "-1" ]; then diff --git a/ctdb/config/events.d/60.nfs b/ctdb/config/events.d/60.nfs index d6b978f..c25b73e 100755 --- a/ctdb/config/events.d/60.nfs +++ b/ctdb/config/events.d/60.nfs @@ -168,11 +168,15 @@ nfs_check_service () # Using eval means variables can contain semicolon separated commands if eval "$service_check_cmd" ; then _ok=true + else + _err="monitoring service \"${_progname}\" failed" fi else if nfs_check_rpcinfo \ "$_progname" "$version" "$family" >/dev/null ; then _ok=true + else + _err="$ctdb_check_rpc_out" fi fi @@ -190,14 +194,14 @@ nfs_check_service () if [ $unhealthy_after -gt 0 ] ; then if [ $_failcount -ge $unhealthy_after ] ; then _unhealthy=true - echo "ERROR: $ctdb_check_rpc_out" + echo "ERROR: $_err" fi fi if [ $restart_every -gt 0 ] ; then if [ $(($_failcount % $restart_every)) -eq 0 ] ; then if ! $_unhealthy ; then - echo "WARNING: $ctdb_check_rpc_out" + echo "WARNING: $_err" fi nfs_restart_service fi diff --git a/ctdb/doc/ctdb.1.xml b/ctdb/doc/ctdb.1.xml index 7c3b551..12ead00 100644 --- a/ctdb/doc/ctdb.1.xml +++ b/ctdb/doc/ctdb.1.xml @@ -467,27 +467,68 @@ Duration of last recovery/failover: 2.248552 seconds </refsect2> <refsect2> - <title>natgwlist</title> + <title>natgw {master|list|status}</title> <para> - Show the current NAT gateway master and the status of all - nodes in the current NAT gateway group. See the - <citetitle>NAT GATEWAY</citetitle> section in + This command shows different aspects of NAT gateway status. + For an overview of CTDB's NAT gateway functionality please see + the <citetitle>NAT GATEWAY</citetitle> section in <citerefentry><refentrytitle>ctdb</refentrytitle> - <manvolnum>7</manvolnum></citerefentry> for more details. + <manvolnum>7</manvolnum></citerefentry>. </para> - <refsect3> - <title>Example</title> - <screen> -# ctdb natgwlist -0 192.168.2.200 -Number of nodes:4 -pnn:0 192.168.2.200 OK (THIS NODE) + <variablelist> + <varlistentry> + <term>master</term> + <listitem> + <para> + Show the PNN and private IP address of the current NAT + gateway master node. + </para> + <para> + Example output: + </para> + <screen> +1 192.168.2.201 + </screen> + </listitem> + </varlistentry> + <varlistentry> + <term>list</term> + <listitem> + <para> + List the private IP addresses of nodes in the current + NAT gateway group, annotating the master node. + </para> + <para> + Example output: + </para> + <screen> +192.168.2.200 +192.168.2.201 MASTER +192.168.2.202 +192.168.2.203 + </screen> + </listitem> + </varlistentry> + <varlistentry> + <term>status</term> + <listitem> + <para> + List the nodes in the current NAT gateway group and + their status. + </para> + <para> + Example output: + </para> + <screen> +pnn:0 192.168.2.200 UNHEALTHY (THIS NODE) pnn:1 192.168.2.201 OK pnn:2 192.168.2.202 OK pnn:3 192.168.2.203 OK - </screen> - </refsect3> + </screen> + </listitem> + </varlistentry> + </variablelist> </refsect2> <refsect2> diff --git a/ctdb/doc/onnode.1.xml b/ctdb/doc/onnode.1.xml index 02898d2..d55f771 100644 --- a/ctdb/doc/onnode.1.xml +++ b/ctdb/doc/onnode.1.xml @@ -196,27 +196,6 @@ </para> </listitem> </varlistentry> - <varlistentry><term>lvs | lvsmaster</term> - <listitem> - <para> - The current LVS master. - </para> - </listitem> - </varlistentry> - <varlistentry><term>natgw | natgwlist</term> - <listitem> - <para> - The current NAT gateway. - </para> - </listitem> - </varlistentry> - <varlistentry><term>rm | recmaster</term> - <listitem> - <para> - The current recovery master. - </para> - </listitem> - </varlistentry> </variablelist> </refsect1> diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c index 88656f9..5001489 100644 --- a/ctdb/server/ctdb_takeover.c +++ b/ctdb/server/ctdb_takeover.c @@ -1731,7 +1731,7 @@ int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map_old *nodem } if (!can_host_ips) { DEBUG(DEBUG_WARNING,("No nodes available to host public IPs yet\n")); - return 0; + goto ipreallocated; } /* since nodes only know about those public addresses that @@ -2633,22 +2633,34 @@ int32_t ctdb_control_get_tcp_tickle_list(struct ctdb_context *ctdb, TDB_DATA ind ctdb_sock_addr *addr = (ctdb_sock_addr *)indata.dptr; struct ctdb_tickle_list_old *list; struct ctdb_tcp_array *tcparray; - int num; + int num, i; struct ctdb_vnn *vnn; + unsigned port; vnn = find_public_ip_vnn(ctdb, addr); if (vnn == NULL) { - DEBUG(DEBUG_ERR,(__location__ " Could not get tcp tickle list, '%s' is not a public address\n", + DEBUG(DEBUG_ERR,(__location__ " Could not get tcp tickle list, '%s' is not a public address\n", ctdb_addr_to_str(addr))); return 1; } + port = ctdb_addr_to_port(addr); + tcparray = vnn->tcp_array; - if (tcparray) { - num = tcparray->num; - } else { - num = 0; + num = 0; + if (tcparray != NULL) { + if (port == 0) { + /* All connections */ + num = tcparray->num; + } else { + /* Count connections for port */ + for (i = 0; i < tcparray->num; i++) { + if (port == ctdb_addr_to_port(&tcparray->connections[i].dst)) { + num++; + } + } + } } outdata->dsize = offsetof(struct ctdb_tickle_list_old, connections) @@ -2660,9 +2672,18 @@ int32_t ctdb_control_get_tcp_tickle_list(struct ctdb_context *ctdb, TDB_DATA ind list->addr = *addr; list->num = num; - if (num) { - memcpy(&list->connections[0], tcparray->connections, - sizeof(struct ctdb_connection) * num); + + if (num == 0) { + return 0; + } + + num = 0; + for (i = 0; i < tcparray->num; i++) { + if (port == 0 || \ + port == ctdb_addr_to_port(&tcparray->connections[i].dst)) { + list->connections[num] = tcparray->connections[i]; + num++; + } } return 0; diff --git a/ctdb/tests/onnode/0080.sh b/ctdb/tests/onnode/0080.sh deleted file mode 100755 index bca478a..0000000 --- a/ctdb/tests/onnode/0080.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -. "${TEST_SCRIPTS_DIR}/unit.sh" - -cmd="$ONNODE recmaster hostname" - -define_test "$cmd" "node 1 (192.168.1.102) is recmaster" - -ctdb_set_output <<EOF -1 -EOF - -required_result <<EOF --n 192.168.1.102 hostname -EOF - -simple_test $cmd diff --git a/ctdb/tests/onnode/0081.sh b/ctdb/tests/onnode/0081.sh deleted file mode 100755 index 412db87..0000000 --- a/ctdb/tests/onnode/0081.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -. "${TEST_SCRIPTS_DIR}/unit.sh" - -cmd="$ONNODE lvsmaster hostname" - -define_test "$cmd" "no lvsmaster" - -ctdb_set_output 255 <<EOF -There is no LVS master -EOF - -required_result 1 <<EOF -onnode: No lvsmaster available -EOF - -simple_test $cmd diff --git a/ctdb/tests/onnode/0090.sh b/ctdb/tests/onnode/0090.sh deleted file mode 100755 index dd50c51..0000000 --- a/ctdb/tests/onnode/0090.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -. "${TEST_SCRIPTS_DIR}/unit.sh" - -cmd="$ONNODE natgw hostname" - -define_test "$cmd" "no natgw" - -ctdb_set_output <<EOF --1 0.0.0.0 -:0:192.168.1.101:0:0:0:0:0: -:1:192.168.1.102:0:0:0:0:0: -:2:192.168.1.103:0:0:0:0:0: -:3:192.168.1.104:0:0:0:0:0: -EOF - -required_result 1 <<EOF -onnode: No natgwlist available -EOF - -simple_test $cmd diff --git a/ctdb/tests/onnode/0091.sh b/ctdb/tests/onnode/0091.sh deleted file mode 100755 index 528eec1..0000000 --- a/ctdb/tests/onnode/0091.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -. "${TEST_SCRIPTS_DIR}/unit.sh" - -cmd="$ONNODE natgw hostname" - -define_test "$cmd" "node 2 (192.168.1.103) is natgw" - -ctdb_set_output <<EOF -2 192.168.1.103 -:0:192.168.1.101:0:0:0:0:0: -:1:192.168.1.102:0:0:0:0:0: -:2:192.168.1.103:0:0:0:0:0: -:3:192.168.1.104:0:0:0:0:0: -EOF - -required_result <<EOF --n 192.168.1.103 hostname -EOF - -simple_test $cmd diff --git a/ctdb/tests/tool/stubby.natgwlist.001.sh b/ctdb/tests/tool/stubby.natgw.001.sh similarity index 65% rename from ctdb/tests/tool/stubby.natgwlist.001.sh rename to ctdb/tests/tool/stubby.natgw.001.sh index f1d2d37..16753d2 100755 --- a/ctdb/tests/tool/stubby.natgwlist.001.sh +++ b/ctdb/tests/tool/stubby.natgw.001.sh @@ -10,15 +10,7 @@ setup_natgw <<EOF 192.168.20.43 EOF -required_result 0 <<EOF -0 192.168.20.41 -Number of nodes:3 -pnn:0 192.168.20.41 OK (THIS NODE) -pnn:1 192.168.20.42 OK -pnn:2 192.168.20.43 OK -EOF - -simple_test <<EOF +ctdb_state="\ NODEMAP 0 192.168.20.41 0x0 CURRENT RECMASTER 1 192.168.20.42 0x0 @@ -34,4 +26,38 @@ VNNMAP 0 1 2 +" + +##### + +required_result 0 <<EOF +0 192.168.20.41 +EOF + +simple_test master <<EOF +$ctdb_state +EOF + +##### + +required_result 0 <<EOF +192.168.20.41 MASTER +192.168.20.42 +192.168.20.43 +EOF + +simple_test list <<EOF +$ctdb_state +EOF + +##### + +required_result 0 <<EOF +pnn:0 192.168.20.41 OK (THIS NODE) +pnn:1 192.168.20.42 OK +pnn:2 192.168.20.43 OK +EOF + +simple_test status <<EOF +$ctdb_state EOF diff --git a/ctdb/tests/tool/stubby.natgwlist.002.sh b/ctdb/tests/tool/stubby.natgw.002.sh similarity index 65% rename from ctdb/tests/tool/stubby.natgwlist.002.sh rename to ctdb/tests/tool/stubby.natgw.002.sh index 37f1722..ce36c95 100755 --- a/ctdb/tests/tool/stubby.natgwlist.002.sh +++ b/ctdb/tests/tool/stubby.natgw.002.sh @@ -10,15 +10,7 @@ setup_natgw <<EOF 192.168.20.43 EOF -required_result 0 <<EOF -1 192.168.20.42 -Number of nodes:3 -pnn:0 192.168.20.41 UNHEALTHY -pnn:1 192.168.20.42 OK (THIS NODE) -pnn:2 192.168.20.43 OK -EOF - -simple_test <<EOF +ctdb_state="\ NODEMAP 0 192.168.20.41 0x2 1 192.168.20.42 0x0 CURRENT RECMASTER @@ -34,4 +26,39 @@ IFACES :Name:LinkStatus:References: :eth2:1:2: :eth1:1:4: +" + +##### + +required_result 0 <<EOF +1 192.168.20.42 +EOF + +simple_test master <<EOF +$ctdb_state EOF + +##### + +required_result 0 <<EOF +192.168.20.41 +192.168.20.42 MASTER +192.168.20.43 +EOF + +simple_test list <<EOF +$ctdb_state +EOF + +##### + +required_result 0 <<EOF +pnn:0 192.168.20.41 UNHEALTHY +pnn:1 192.168.20.42 OK (THIS NODE) +pnn:2 192.168.20.43 OK +EOF + +simple_test status <<EOF +$ctdb_state +EOF + diff --git a/ctdb/tests/tool/stubby.natgwlist.003.sh b/ctdb/tests/tool/stubby.natgw.003.sh similarity index 64% rename from ctdb/tests/tool/stubby.natgwlist.003.sh rename to ctdb/tests/tool/stubby.natgw.003.sh index 19b1797..7d280ac 100755 --- a/ctdb/tests/tool/stubby.natgwlist.003.sh +++ b/ctdb/tests/tool/stubby.natgw.003.sh @@ -9,14 +9,7 @@ setup_natgw <<EOF 192.168.20.43 EOF -required_result 0 <<EOF -2 192.168.20.43 -Number of nodes:2 -pnn:0 192.168.20.41 UNHEALTHY -pnn:2 192.168.20.43 OK -EOF - -simple_test <<EOF +ctdb_state="\ NODEMAP 0 192.168.20.41 0x2 1 192.168.20.42 0x0 CURRENT RECMASTER @@ -32,4 +25,36 @@ IFACES :Name:LinkStatus:References: :eth2:1:2: :eth1:1:4: +" -- Samba Shared Repository