Rev 347: send a message to clients when an IP has been released in http://samba.org/~tridge/ctdb

tridge at samba.org tridge at samba.org
Fri May 25 14:05:30 GMT 2007


------------------------------------------------------------
revno: 347
revision-id: tridge at samba.org-20070525140530-wueocj9ci5qpi3cf
parent: tridge at samba.org-20070525120745-40ik47s270sgbx07
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Sat 2007-05-26 00:05:30 +1000
message:
  send a message to clients when an IP has been released
modified:
  common/ctdb_recoverd.c         recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1
  include/ctdb.h                 ctdb.h-20061117234101-o3qt14umlg9en8z0-11
  takeover/ctdb_takeover.c       ctdb_takeover.c-20070525071636-a5n1ihghjtppy08r-2
=== modified file 'common/ctdb_recoverd.c'
--- a/common/ctdb_recoverd.c	2007-05-25 07:04:13 +0000
+++ b/common/ctdb_recoverd.c	2007-05-25 14:05:30 +0000
@@ -557,7 +557,8 @@
 		return -1;
 	}
 
-	/* send a message to all clients telling them that the cluster has been reconfigured */
+	/* send a message to all clients telling them that the cluster 
+	   has been reconfigured */
 	ctdb_send_message(ctdb, CTDB_BROADCAST_ALL, CTDB_SRVID_RECONFIGURE, tdb_null);
 
 	DEBUG(0, (__location__ " Recovery complete\n"));

=== modified file 'include/ctdb.h'
--- a/include/ctdb.h	2007-05-23 04:50:41 +0000
+++ b/include/ctdb.h	2007-05-25 14:05:30 +0000
@@ -67,6 +67,11 @@
  */
 #define CTDB_SRVID_RECONFIGURE 0xF200000000000000LL
 
+/* 
+   a message handler ID meaning that an IP address has been released
+ */
+#define CTDB_SRVID_RELEASE_IP 0xF300000000000000LL
+
 struct event_context;
 
 /*

=== modified file 'takeover/ctdb_takeover.c'
--- a/takeover/ctdb_takeover.c	2007-05-25 11:27:26 +0000
+++ b/takeover/ctdb_takeover.c	2007-05-25 14:05:30 +0000
@@ -108,19 +108,30 @@
 {
 	struct sockaddr_in *sin = (struct sockaddr_in *)indata.dptr;
 	char *cmdstr;
+	TDB_DATA data;
+	char *ip = inet_ntoa(sin->sin_addr);
 
 	/* stop any previous arps */
 	talloc_free(ctdb->takeover.last_ctx);
 	ctdb->takeover.last_ctx = NULL;
 
 	cmdstr = talloc_asprintf(ctdb, "ip addr del %s/32 dev %s 2> /dev/null",
-				 inet_ntoa(sin->sin_addr), ctdb->takeover.interface);
+				 ip, ctdb->takeover.interface);
 		
 	DEBUG(0,("Releasing IP : %s\n", cmdstr));
 	system(cmdstr);
 
 	talloc_free(cmdstr);
 
+	/* send a message to all clients of this node telling them
+	   that the cluster has been reconfigured and they should
+	   release any sockets on this IP */
+	data.dptr = (uint8_t *)ip;
+	data.dsize = strlen(ip)+1;
+
+	ctdb_send_message(ctdb, ctdb->vnn, CTDB_SRVID_RELEASE_IP, data);
+
+
 	return 0;
 }
 



More information about the samba-cvs mailing list