ctdb-tools-ctdb: Make natgwlist and lvsmaster more resilient
authorMartin Schwenke <martin@meltin.net>
Fri, 23 May 2014 11:58:55 +0000 (21:58 +1000)
committerAmitay Isaacs <amitay@samba.org>
Thu, 29 May 2014 03:59:37 +0000 (05:59 +0200)
commit4dd382296d3e78000713ab0ac1f8e531e25857cc
tree30f8b27375004c4c28bfbecdb341c4d713ecd3eb
parentf2ef23cd5f227d2da2f032a2a56fbdd4d105b137
ctdb-tools-ctdb: Make natgwlist and lvsmaster more resilient

Recent changes have caused these commands to attempt to get
capabilities from all nodes before doing further filtering.  This
means that capabilities are unnecessarily fetched from nodes that are
unlikely to be the master.  If such a node does not answer the control
then many nodes can fail to calculate the master node.  In the case of
natgwlist this will cause "monitor" events to fail resulting in
unhealthy nodes.

Restore the behaviour where capabilities are only fetched for a node
that will be the master if it has the desired flags.

Although this masks a problem where a connected node is not replying,
it can help to avoid an outage in some cases.

Add supporting tests and infrastructure.  Infrastructure just lets a
timeout be faked - just for ctdb_ctrl_getcapabilities_stub() so far.
First test checks that this infrastructure works if the first node
times out in natgwlist.  Second test checks the case worked around by
the above fix - that is, no failure when a node with PNN beyond the
NATGW master can time out.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Thu May 29 05:59:37 CEST 2014 on sn-devel-104
ctdb/tests/src/ctdb_test_stubs.c
ctdb/tests/tool/stubby.natgwlist.009.sh [new file with mode: 0755]
ctdb/tests/tool/stubby.natgwlist.010.sh [new file with mode: 0755]
ctdb/tools/ctdb.c