mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
recoverd: New function unassign_unsuitable_ips()
Move the code into a new function so it can be called from a number of places. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 8adb255e62dbe60d1e983047acd7b9c941231d11)
This commit is contained in:
parent
bcefb76884
commit
2e8df43561
@ -2062,6 +2062,39 @@ try_again:
|
||||
}
|
||||
}
|
||||
|
||||
static void unassign_unsuitable_ips(struct ctdb_context *ctdb,
|
||||
struct ctdb_node_map *nodemap,
|
||||
struct ctdb_public_ip_list *all_ips,
|
||||
uint32_t mask)
|
||||
{
|
||||
struct ctdb_public_ip_list *tmp_ip;
|
||||
|
||||
/* mark all public addresses with a masked node as being served by
|
||||
node -1
|
||||
*/
|
||||
for (tmp_ip=all_ips;tmp_ip;tmp_ip=tmp_ip->next) {
|
||||
if (tmp_ip->pnn == -1) {
|
||||
continue;
|
||||
}
|
||||
if (nodemap->nodes[tmp_ip->pnn].flags & mask) {
|
||||
tmp_ip->pnn = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* verify that the assigned nodes can serve that public ip
|
||||
and set it to -1 if not
|
||||
*/
|
||||
for (tmp_ip=all_ips;tmp_ip;tmp_ip=tmp_ip->next) {
|
||||
if (tmp_ip->pnn == -1) {
|
||||
continue;
|
||||
}
|
||||
if (can_node_serve_ip(ctdb, tmp_ip->pnn, tmp_ip) != 0) {
|
||||
/* this node can not serve this ip. */
|
||||
tmp_ip->pnn = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* The calculation part of the IP allocation algorithm. */
|
||||
static void ctdb_takeover_run_core(struct ctdb_context *ctdb,
|
||||
struct ctdb_node_map *nodemap,
|
||||
@ -2131,31 +2164,7 @@ static void ctdb_takeover_run_core(struct ctdb_context *ctdb,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* mark all public addresses with a masked node as being served by
|
||||
node -1
|
||||
*/
|
||||
for (tmp_ip=all_ips;tmp_ip;tmp_ip=tmp_ip->next) {
|
||||
if (tmp_ip->pnn == -1) {
|
||||
continue;
|
||||
}
|
||||
if (nodemap->nodes[tmp_ip->pnn].flags & mask) {
|
||||
tmp_ip->pnn = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* verify that the assigned nodes can serve that public ip
|
||||
and set it to -1 if not
|
||||
*/
|
||||
for (tmp_ip=all_ips;tmp_ip;tmp_ip=tmp_ip->next) {
|
||||
if (tmp_ip->pnn == -1) {
|
||||
continue;
|
||||
}
|
||||
if (can_node_serve_ip(ctdb, tmp_ip->pnn, tmp_ip) != 0) {
|
||||
/* this node can not serve this ip. */
|
||||
tmp_ip->pnn = -1;
|
||||
}
|
||||
}
|
||||
unassign_unsuitable_ips(ctdb, nodemap, all_ips, mask);
|
||||
|
||||
if (1 == ctdb->tunable.lcp2_public_ip_assignment) {
|
||||
lcp2_init(tmp_ctx, nodemap, mask, all_ips, &lcp2_imbalances, &newly_healthy);
|
||||
|
Loading…
Reference in New Issue
Block a user