}
/* 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
}
/* 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;
or -1 if there is no node that can cover this ip
*/
- return ret;
+ return (ret ? ipalloc_state->all_ips : NULL);
}
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__ */
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);
}