1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

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

(This used to be ctdb commit a15ec57c26d1bc82af85f74eebae0bd8abde3233)
This commit is contained in:
Ronnie Sahlberg 2011-11-17 13:34:29 +11:00
parent 44de394796
commit 0581fd85e6
2 changed files with 14 additions and 1 deletions

View File

@ -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++;

View File

@ -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;