[SCM] CTDB repository - branch 1.2 updated - ctdb-1.9.1-418-g426ed1d

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


The branch, 1.2 has been updated
       via  426ed1d560745282ee647d40ce43d662c8bc5594 (commit)
      from  572031ff6827371ce34f243ad5e2a723e2320c67 (commit)

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


- Log -----------------------------------------------------------------
commit 426ed1d560745282ee647d40ce43d662c8bc5594
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