Rev 484: update flags in parent daemon too in http://samba.org/~tridge/ctdb

tridge at samba.org tridge at samba.org
Wed Jun 6 11:34:36 GMT 2007


------------------------------------------------------------
revno: 484
revision-id: tridge at samba.org-20070606113436-6bo9s8zewul2xwjk
parent: tridge at samba.org-20070606112709-klp56ghkr55r3m4d
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Wed 2007-06-06 21:34:36 +1000
message:
  update flags in parent daemon too
modified:
  common/ctdb_daemon.c           ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1
=== modified file 'common/ctdb_daemon.c'
--- a/common/ctdb_daemon.c	2007-06-06 03:45:12 +0000
+++ b/common/ctdb_daemon.c	2007-06-06 11:34:36 +0000
@@ -31,6 +31,25 @@
 
 static void daemon_incoming_packet(void *, struct ctdb_req_header *);
 
+/*
+  handler for when a node changes its flags
+*/
+static void flag_change_handler(struct ctdb_context *ctdb, uint64_t srvid, 
+				TDB_DATA data, void *private_data)
+{
+	struct ctdb_node_flag_change *c = (struct ctdb_node_flag_change *)data.dptr;
+
+	if (data.dsize != sizeof(*c) || !ctdb_validate_vnn(ctdb, c->vnn)) {
+		DEBUG(0,(__location__ "Invalid data in ctdb_node_flag_change\n"));
+		return;
+	}
+
+	/* don't get the connected flag from the other node */
+	ctdb->nodes[c->vnn]->flags = 
+		(ctdb->nodes[c->vnn]->flags&NODE_FLAGS_CONNECTED) 
+		| (c->flags & ~NODE_FLAGS_CONNECTED);	
+}
+
 /* called when the "startup" event script has finished */
 static void ctdb_start_transport(struct ctdb_context *ctdb, int status, void *p)
 {
@@ -51,6 +70,10 @@
 		exit(11);
 	}
 
+	/* a handler for when nodes are disabled/enabled */
+	ctdb_register_message_handler(ctdb, ctdb, CTDB_SRVID_NODE_FLAGS_CHANGED, 
+				      flag_change_handler, NULL);
+
 	/* start monitoring for dead nodes */
 	ctdb_start_monitoring(ctdb);
 }



More information about the samba-cvs mailing list