1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

recoverd: Clear IP flags after IP allocation algorithm has run

If these flags are left set they will confuse other recovery daemon
code.

Factor the clearing code into new function clear_ipflags().

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 45c776958017ea7001f061842c9e0f60e4a25f23)
This commit is contained in:
Martin Schwenke 2013-05-09 12:51:57 +10:00
parent 530020d83b
commit 50f19b5bd4

View File

@ -2281,6 +2281,17 @@ static uint32_t *get_tunable_from_nodes(struct ctdb_context *ctdb,
return tvals;
}
static void clear_ipflags(struct ctdb_node_map *nodemap)
{
int i;
for (i=0;i<nodemap->num;i++) {
nodemap->nodes[i].flags &=
~(NODE_FLAGS_NOIPTAKEOVER|NODE_FLAGS_NOIPHOST);
}
}
/* Set internal flags for IP allocation:
* Clear ip flags
* Set NOIPTAKOVER ip flags from per-node NoIPTakeover tunable
@ -2296,11 +2307,7 @@ static void set_ipflags_internal(struct ctdb_node_map *nodemap,
{
int i;
/* Clear IP flags */
for (i=0;i<nodemap->num;i++) {
nodemap->nodes[i].flags &=
~(NODE_FLAGS_NOIPTAKEOVER|NODE_FLAGS_NOIPHOST);
}
clear_ipflags(nodemap);
for (i=0;i<nodemap->num;i++) {
/* Can not take IPs on node with NoIPTakeover set */
@ -2400,6 +2407,11 @@ int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map *nodemap,
/* Do the IP reassignment calculations */
ctdb_takeover_run_core(ctdb, nodemap, &all_ips);
/* The IP flags need to be cleared because they should never
* be seen outside the IP allocation code.
*/
clear_ipflags(nodemap);
/* The recovery daemon does regular sanity checks of the IPs.
* However, sometimes it is overzealous and thinks changes are
* required when they're already underway. This stops the