[SCM] CTDB repository - branch master updated - ctdb-1.10-188-g6a74515

Ronnie Sahlberg sahlberg at samba.org
Tue May 3 21:29:35 MDT 2011


The branch, master has been updated
       via  6a74515f0a1e24d97cee3ba05d89133aac7ad2b7 (commit)
      from  3a0af8780dc595acbed880f288fcbc4f62c862fb (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 6a74515f0a1e24d97cee3ba05d89133aac7ad2b7
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Wed May 4 11:34:17 2011 +1000

    Dont call the UPDATE event if both old and new interface is the same.
    
    CQ S1018175

-----------------------------------------------------------------------

Summary of changes:
 server/ctdb_takeover.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/server/ctdb_takeover.c b/server/ctdb_takeover.c
index bed2ab9..c824434 100644
--- a/server/ctdb_takeover.c
+++ b/server/ctdb_takeover.c
@@ -482,6 +482,7 @@ static int32_t ctdb_do_updateip(struct ctdb_context *ctdb,
 	int ret;
 	struct ctdb_do_updateip_state *state;
 	struct ctdb_iface *old = vnn->iface;
+	char *new_name;
 
 	ctdb_vnn_unassign_iface(ctdb, vnn);
 	ret = ctdb_vnn_assign_iface(ctdb, vnn);
@@ -494,6 +495,16 @@ static int32_t ctdb_do_updateip(struct ctdb_context *ctdb,
 		return -1;
 	}
 
+	new_name = ctdb_vnn_iface_string(vnn);
+	if (old->name != NULL && new_name != NULL && !strcmp(old->name, new_name)) {
+		/* A benign update from one interface onto itself.
+		 * no need to run the eventscripts in this case, just return
+		 * success.
+		 */
+		ctdb_request_control_reply(ctdb, c, NULL, 0, NULL);
+		return 0;
+	}
+
 	state = talloc(vnn, struct ctdb_do_updateip_state);
 	CTDB_NO_MEMORY(ctdb, state);
 
@@ -506,7 +517,7 @@ static int32_t ctdb_do_updateip(struct ctdb_context *ctdb,
 			    ctdb_addr_to_str(&vnn->public_address),
 			    vnn->public_netmask_bits,
 			    old->name,
-			    ctdb_vnn_iface_string(vnn)));
+			    new_name));
 
 	ret = ctdb_event_script_callback(ctdb,
 					 state,
@@ -516,13 +527,13 @@ static int32_t ctdb_do_updateip(struct ctdb_context *ctdb,
 					 CTDB_EVENT_UPDATE_IP,
 					 "%s %s %s %u",
 					 state->old->name,
-					 ctdb_vnn_iface_string(vnn),
+					 new_name,
 					 ctdb_addr_to_str(&vnn->public_address),
 					 vnn->public_netmask_bits);
 	if (ret != 0) {
 		DEBUG(DEBUG_ERR,(__location__ " Failed update IP %s from interface %s to %s\n",
 				 ctdb_addr_to_str(&vnn->public_address),
-				 old->name, ctdb_vnn_iface_string(vnn)));
+				 old->name, new_name));
 		talloc_free(state);
 		return -1;
 	}


-- 
CTDB repository


More information about the samba-cvs mailing list