The branch, master has been updated via e143abd16ccde2e0edfe103673d31a5fb06b6aef (commit) via 45c776958017ea7001f061842c9e0f60e4a25f23 (commit) from d0a3822573db296e73cc897835f783c8abc084b3 (commit)
http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit e143abd16ccde2e0edfe103673d31a5fb06b6aef Author: Martin Schwenke <mar...@meltin.net> Date: Thu May 9 12:53:48 2013 +1000 recoverd: Move IP flags into ctdb_takeover.c These should never be seen outside the IP allocation code. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 45c776958017ea7001f061842c9e0f60e4a25f23 Author: Martin Schwenke <mar...@meltin.net> Date: Thu May 9 12:51:57 2013 +1000 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 <mar...@meltin.net> Pair-programmed-with: Amitay Isaacs <ami...@gmail.com> ----------------------------------------------------------------------- Summary of changes: include/ctdb_protocol.h | 5 ----- server/ctdb_takeover.c | 28 +++++++++++++++++++++++----- 2 files changed, 23 insertions(+), 10 deletions(-) Changeset truncated at 500 lines: diff --git a/include/ctdb_protocol.h b/include/ctdb_protocol.h index 3133b4e..09ce01a 100644 --- a/include/ctdb_protocol.h +++ b/include/ctdb_protocol.h @@ -584,11 +584,6 @@ struct ctdb_node_map { #define NODE_FLAGS_DISABLED (NODE_FLAGS_UNHEALTHY|NODE_FLAGS_PERMANENTLY_DISABLED) #define NODE_FLAGS_INACTIVE (NODE_FLAGS_DELETED|NODE_FLAGS_DISCONNECTED|NODE_FLAGS_BANNED|NODE_FLAGS_STOPPED) -/* These flags are ONLY valid within the recovery daemon */ -#define NODE_FLAGS_NOIPTAKEOVER 0x01000000 /* can not takeover additional IPs */ -#define NODE_FLAGS_NOIPHOST 0x02000000 /* can not host IPs */ - - /* * Node capabilities */ diff --git a/server/ctdb_takeover.c b/server/ctdb_takeover.c index 3ba7dc3..24c6298 100644 --- a/server/ctdb_takeover.c +++ b/server/ctdb_takeover.c @@ -33,6 +33,12 @@ #define CTDB_ARP_INTERVAL 1 #define CTDB_ARP_REPEAT 3 +/* These flags are ONLY valid within IP allocation code and must be + * cleared to avoid confusing other recovery daemon functions + */ +#define NODE_FLAGS_NOIPTAKEOVER 0x01000000 /* can not takeover additional IPs */ +#define NODE_FLAGS_NOIPHOST 0x02000000 /* can not host IPs */ + struct ctdb_iface { struct ctdb_iface *prev, *next; const char *name; @@ -2281,6 +2287,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 +2313,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 +2413,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 -- CTDB repository