From cf778b5aaf6356401e3985acccc7df9e08ab6930 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Wed, 10 Nov 2010 14:47:28 +1100 Subject: [PATCH] Dont exit the update ip function if the old and new interfaces are the same since if they are the same for whatever reason this triggers the system to go into an infinite loop and is unrobust The scriptds have been changed instead to be able to cope with this situation for enhanced robustness During takeover_run and when merging all ip allocations across the cluster try to kepe track of when and which node currently hosts an ip address so that we avoid extra ip failovers between nodes --- server/ctdb_takeover.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/server/ctdb_takeover.c b/server/ctdb_takeover.c index 27c9ac07..d4958079 100644 --- a/server/ctdb_takeover.c +++ b/server/ctdb_takeover.c @@ -490,15 +490,6 @@ static int32_t ctdb_do_updateip(struct ctdb_context *ctdb, return -1; } - if (vnn->iface == old) { - DEBUG(DEBUG_ERR,("update of IP %s/%u trying to " - "assin a same interface '%s'\n", - ctdb_addr_to_str(&vnn->public_address), - vnn->public_netmask_bits, - old->name)); - return -1; - } - state = talloc(vnn, struct ctdb_do_updateip_state); CTDB_NO_MEMORY(ctdb, state); @@ -610,7 +601,7 @@ int32_t ctdb_control_takeover_ip(struct ctdb_context *ctdb, return -1; } - if (vnn->pnn != ctdb->pnn && have_ip) { + if (vnn->pnn != ctdb->pnn && have_ip && vnn->pnn != -1) { DEBUG(DEBUG_CRIT,(__location__ " takeoverip of IP %s is known to the kernel, " "and we have it on iface[%s], but it was assigned to node %d" "and we are node %d, banning ourself\n", @@ -896,7 +887,7 @@ static int ctdb_add_public_address(struct ctdb_context *ctdb, vnn->public_netmask_bits = mask; vnn->pnn = -1; if (ctdb_sys_have_ip(addr)) { - DEBUG(DEBUG_ERR,("We are already hosting public address '%s'\n", ctdb_addr_to_str(addr))); + DEBUG(DEBUG_ERR,("We are already hosting public address '%s'. setting PNN to ourself:%d\n", ctdb_addr_to_str(addr), ctdb->pnn)); vnn->pnn = ctdb->pnn; } @@ -1166,6 +1157,16 @@ static uint32_t *ip_key(ctdb_sock_addr *ip) static void *add_ip_callback(void *parm, void *data) { + struct ctdb_public_ip_list *this_ip = parm; + struct ctdb_public_ip_list *prev_ip = data; + + if (prev_ip == NULL) { + return parm; + } + if (this_ip->pnn == -1) { + this_ip->pnn = prev_ip->pnn; + } + return parm; } -- 2.34.1