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

ctdb-ipalloc: ipalloc() returns public IP list

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2016-06-22 14:22:02 +10:00 committed by Amitay Isaacs
parent 21adcd32bd
commit 41a14e72b5
4 changed files with 6 additions and 9 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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__ */

View File

@ -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);
}