summaryrefslogtreecommitdiff
path: root/ctdb/tools
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2014-04-09 14:26:23 +1000
committerMartin Schwenke <martins@samba.org>2014-04-14 03:52:40 +0200
commitce8ac88b969bb8bb7a94e62bb6e86aec389be6ac (patch)
treeba9ff91aaa6790fc7f8d6d7413e2725683eedced /ctdb/tools
parentc048011cd6a9ff976a88ac05ad15e0ffc73a73ae (diff)
downloadsamba-ce8ac88b969bb8bb7a94e62bb6e86aec389be6ac.tar.gz
ctdb-tools-ctdb: Drop disconnected nodes when filtering by capability
Commit ba69742ccd822562ca2135d2466e09bf1216644b missed the point of filtering disconnected nodes while limiting the nodemap to those in the NAT gateway group. It was really to avoid trying to fetch capabilities from disconnected nodes. This should be explicitly done in filter_nodemap_by_capabilities(), otherwise "ctdb natgwlist" simply fails when there is a disconnected node. Note that the alternate solution where filter_nodemap_by_flags() is called before filter_nodemap_by_capabilities() would not be not correct. Filtering on flags first can produce a "healthier" set of nodes where none of them have the NAT gateway capability. Also extend stub for ctdb_ctrl_getcapabilities() to fail when trying to get capabilities from a disconnected node and add a corresponding test to confirm that "ctdb natgwlist" is no longer broken. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/tools')
-rw-r--r--ctdb/tools/ctdb.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c
index ad85f084f29..74cf321fa26 100644
--- a/ctdb/tools/ctdb.c
+++ b/ctdb/tools/ctdb.c
@@ -1191,9 +1191,16 @@ filter_nodemap_by_capabilities(struct ctdb_context *ctdb,
ret->num = 0;
for (i = 0; i < nodemap->num; i++) {
- int res = ctdb_ctrl_getcapabilities(ctdb, TIMELIMIT(),
- nodemap->nodes[i].pnn,
- &capabilities);
+ int res;
+
+ /* Disconnected nodes have no capabilities! */
+ if (nodemap->nodes[i].flags & NODE_FLAGS_DISCONNECTED) {
+ continue;
+ }
+
+ res = ctdb_ctrl_getcapabilities(ctdb, TIMELIMIT(),
+ nodemap->nodes[i].pnn,
+ &capabilities);
if (res != 0) {
DEBUG(DEBUG_ERR, ("Unable to get capabilities from node %u\n",
nodemap->nodes[i].pnn));