diff options
author | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2009-11-06 08:19:32 +1100 |
---|---|---|
committer | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2009-11-06 08:19:32 +1100 |
commit | f88fbb5f1e98795f1a868404148413b4d74865fd (patch) | |
tree | 8fc4e483eda22628dd8f76157d5ff91ca2f74953 /ctdb | |
parent | 1fa1830f81bb335ca5bb9f2fb3fb2644f418e559 (diff) | |
download | samba-f88fbb5f1e98795f1a868404148413b4d74865fd.tar.gz samba-f88fbb5f1e98795f1a868404148413b4d74865fd.tar.xz samba-f88fbb5f1e98795f1a868404148413b4d74865fd.zip |
suggestion from Christian,
dont allow UNHEALTHY nodes to become natgw master, unless all nodes
are unhealthy
(This used to be ctdb commit e8e7129ff1371065fbd75e1aea844d6d04a96fa9)
Diffstat (limited to 'ctdb')
-rw-r--r-- | ctdb/tools/ctdb.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index c1fe88c535..838efdb7d8 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -676,15 +676,24 @@ static int control_natgwlist(struct ctdb_context *ctdb, int argc, const char **a i++; } - /* print the natgw master - * we dont allow STOPPED or DELETED nodes to become the natgwmaster + /* pick a node to be natgwmaster + * we dont allow STOPPED, DELETED, BANNED or UNHEALTHY nodes to become the natgwmaster */ for(i=0;i<nodemap->num;i++){ - if (!(nodemap->nodes[i].flags & (NODE_FLAGS_DISCONNECTED|NODE_FLAGS_STOPPED|NODE_FLAGS_DELETED))) { + if (!(nodemap->nodes[i].flags & (NODE_FLAGS_DISCONNECTED|NODE_FLAGS_STOPPED|NODE_FLAGS_DELETED|NODE_FLAGS_BANNED|NODE_FLAGS_UNHEALTHY))) { printf("%d %s\n", nodemap->nodes[i].pnn,ctdb_addr_to_str(&nodemap->nodes[i].addr)); break; } } + /* we couldnt find any healthy node, try unhealthy ones */ + if (i == nodemap->num) { + for(i=0;i<nodemap->num;i++){ + if (!(nodemap->nodes[i].flags & (NODE_FLAGS_DISCONNECTED|NODE_FLAGS_STOPPED|NODE_FLAGS_DELETED))) { + printf("%d %s\n", nodemap->nodes[i].pnn,ctdb_addr_to_str(&nodemap->nodes[i].addr)); + break; + } + } + } /* unless all nodes are STOPPED, when we pick one anyway */ if (i == nodemap->num) { for(i=0;i<nodemap->num;i++){ |