diff options
author | Martin Schwenke <martin@meltin.net> | 2014-12-19 15:08:40 +1100 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2015-05-10 03:22:13 +0200 |
commit | 7ee57b8d7c0b882227dab1f83187e44dd4639ad3 (patch) | |
tree | 15b2896d4b8a382117debfcc2b18ad33eae58331 /ctdb | |
parent | 91f99ddfb3ba1cfb98223863ac3a474a5fbe4ea1 (diff) | |
download | samba-7ee57b8d7c0b882227dab1f83187e44dd4639ad3.tar.gz |
ctdb-recoverd: Short circuit takeover run if no nodes are RUNNING
If all nodes are still in, say, FIRST_RECOVERY runstate, then the logs
contain unfortunate noise like:
recoverd:Failed to find node to cover ip 10.0.2.131
This avoids that by adding an early exit that avoids running
takeover_run_core() when there are no nodes in the
CTDB_RUNSTATE_RUNNING.
To support this add the runstate to the ipflags structure. There are
clearly other ways of hacking this but this seems the simplest.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb')
-rw-r--r-- | ctdb/server/ctdb_takeover.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c index cf1a1c30fbc..6509ebfec3a 100644 --- a/ctdb/server/ctdb_takeover.c +++ b/ctdb/server/ctdb_takeover.c @@ -37,6 +37,7 @@ struct ctdb_ipflags { bool noiptakeover; bool noiphost; + enum ctdb_runstate runstate; }; struct ctdb_iface { @@ -2474,6 +2475,8 @@ set_ipflags_internal(struct ctdb_context *ctdb, if (nodemap->nodes[i].flags & NODE_FLAGS_INACTIVE) { ipflags[i].noiphost = true; } + /* Remember the runstate */ + ipflags[i].runstate = runstate[i]; } if (all_nodes_are_disabled(nodemap)) { @@ -2663,6 +2666,7 @@ int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map *nodemap, struct takeover_callback_data *takeover_data; struct iprealloc_callback_data iprealloc_data; bool *retry_data; + bool can_host_ips; /* * ip failover is completely disabled, just send out the @@ -2679,6 +2683,19 @@ int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map *nodemap, return -1; } + /* Short-circuit IP allocation if no nodes are in the RUNNING + * runstate yet, since no nodes will be able to host IPs */ + can_host_ips = false; + for (i=0; i<nodemap->num; i++) { + if (ipflags[i].runstate == CTDB_RUNSTATE_RUNNING) { + can_host_ips = true; + } + } + if (!can_host_ips) { + DEBUG(DEBUG_WARNING,("No nodes available to host public IPs yet\n")); + return 0; + } + /* Do the IP reassignment calculations */ ctdb_takeover_run_core(ctdb, ipflags, &all_ips, force_rebalance_nodes); |