[SCM] CTDB repository - branch master updated - ctdb-1.12-6-ga15ec57

Ronnie Sahlberg sahlberg at samba.org
Thu Nov 17 18:54:39 MST 2011


The branch, master has been updated
       via  a15ec57c26d1bc82af85f74eebae0bd8abde3233 (commit)
      from  5de9ec2bdf8067406165bc470becdca87f458ae9 (commit)

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


- Log -----------------------------------------------------------------
commit a15ec57c26d1bc82af85f74eebae0bd8abde3233
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu Nov 17 13:34:29 2011 +1100

    Eventscripts: Add special -ECANCELED status for monitor events that are cancelled
    
    When a monitor event is canceled by a higher priority script, make sure we return
    status -ECANCELED to the callback in ctdB_monitor.c
    Also treat -ECANCELED as a simple "try monitor event again" and skip modifying any HEALTHY/UNHEALTHY flags when this happens

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

Summary of changes:
 server/ctdb_monitor.c |    5 +++++
 server/eventscript.c  |   10 +++++++++-
 2 files changed, 14 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/server/ctdb_monitor.c b/server/ctdb_monitor.c
index f0879d0..7258d39 100644
--- a/server/ctdb_monitor.c
+++ b/server/ctdb_monitor.c
@@ -125,6 +125,11 @@ static void ctdb_health_callback(struct ctdb_context *ctdb, int status, void *p)
 	rddata.dptr = (uint8_t *)&rd;
 	rddata.dsize = sizeof(rd);
 
+	if (status == -ECANCELED) {
+		DEBUG(DEBUG_ERR,("Monitoring event was cancelled\n"));
+		goto after_change_status;
+	}
+
 	if (status == -ETIME) {
 		ctdb->event_script_timeouts++;
 
diff --git a/server/eventscript.c b/server/eventscript.c
index c01fbad..722ebec 100644
--- a/server/eventscript.c
+++ b/server/eventscript.c
@@ -58,7 +58,7 @@ struct ctdb_event_script_state {
 	enum ctdb_eventscript_call call;
 	const char *options;
 	struct timeval timeout;
-
+	
 	unsigned int current;
 	struct ctdb_scripts_wire *scripts;
 };
@@ -742,6 +742,14 @@ static int ctdb_event_script_callback_v(struct ctdb_context *ctdb,
 
 	/* Kill off any running monitor events to run this event. */
 	if (ctdb->current_monitor) {
+		struct ctdb_event_script_state *ms = talloc_get_type(ctdb->current_monitor, struct ctdb_event_script_state);
+
+		/* cancel it */
+		if (ms->callback != NULL) {
+			ms->callback->fn(ctdb, -ECANCELED, ms->callback->private_data);
+			talloc_free(ms->callback);
+		}
+
 		/* Discard script status so we don't save to last_status */
 		talloc_free(ctdb->current_monitor->scripts);
 		ctdb->current_monitor->scripts = NULL;


-- 
CTDB repository


More information about the samba-cvs mailing list