From: Martin Schwenke Date: Wed, 22 Jun 2016 04:22:02 +0000 (+1000) Subject: ctdb-ipalloc: ipalloc() returns public IP list X-Git-Tag: tdb-1.3.10~533 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=41a14e72b5944d8a92f91e4583c2826da497dc00;p=thirdparty%2Fsamba.git ctdb-ipalloc: ipalloc() returns public IP list Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c index b696599579f..04c474e6e81 100644 --- a/ctdb/server/ctdb_takeover.c +++ b/ctdb/server/ctdb_takeover.c @@ -1562,12 +1562,11 @@ int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map_old *nodem } /* Do the IP reassignment calculations */ - ipalloc(ipalloc_state); - if (ipalloc_state->all_ips == NULL) { + all_ips = ipalloc(ipalloc_state); + if (all_ips == NULL) { talloc_free(tmp_ctx); return -1; } - all_ips = ipalloc_state->all_ips; /* Now tell all nodes to release any public IPs should not * host. This will be a NOOP on nodes that don't currently diff --git a/ctdb/server/ipalloc.c b/ctdb/server/ipalloc.c index de6d94268dd..dd88f81c29b 100644 --- a/ctdb/server/ipalloc.c +++ b/ctdb/server/ipalloc.c @@ -265,7 +265,7 @@ bool ipalloc_can_host_ips(struct ipalloc_state *ipalloc_state) } /* The calculation part of the IP allocation algorithm. */ -bool ipalloc(struct ipalloc_state *ipalloc_state) +struct public_ip_list *ipalloc(struct ipalloc_state *ipalloc_state) { bool ret = false; @@ -285,5 +285,5 @@ bool ipalloc(struct ipalloc_state *ipalloc_state) or -1 if there is no node that can cover this ip */ - return ret; + return (ret ? ipalloc_state->all_ips : NULL); } diff --git a/ctdb/server/ipalloc.h b/ctdb/server/ipalloc.h index 243d6af0c3a..13fdfed36eb 100644 --- a/ctdb/server/ipalloc.h +++ b/ctdb/server/ipalloc.h @@ -74,6 +74,6 @@ bool ipalloc_set_public_ips(struct ipalloc_state *ipalloc_state, bool ipalloc_can_host_ips(struct ipalloc_state *ipalloc_state); -bool ipalloc(struct ipalloc_state *ipalloc_state); +struct public_ip_list *ipalloc(struct ipalloc_state *ipalloc_state); #endif /* __CTDB_IPALLOC_H__ */ diff --git a/ctdb/tests/src/ctdb_takeover_tests.c b/ctdb/tests/src/ctdb_takeover_tests.c index d564e7b338c..46fc4970e23 100644 --- a/ctdb/tests/src/ctdb_takeover_tests.c +++ b/ctdb/tests/src/ctdb_takeover_tests.c @@ -332,9 +332,7 @@ static void ctdb_test_ipalloc(const char nodestates[], ctdb_test_init(nodestates, &ctdb, &ipalloc_state, read_ips_for_multiple_nodes); - ipalloc(ipalloc_state); - - print_ctdb_public_ip_list(ipalloc_state->all_ips); + print_ctdb_public_ip_list(ipalloc(ipalloc_state)); talloc_free(ctdb); }