mirror of
https://github.com/samba-team/samba.git
synced 2025-01-10 01:18: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:
parent
44de394796
commit
0581fd85e6
@ -125,6 +125,11 @@ static void ctdb_health_callback(struct ctdb_context *ctdb, int status, void *p)
|
|||||||
rddata.dptr = (uint8_t *)&rd;
|
rddata.dptr = (uint8_t *)&rd;
|
||||||
rddata.dsize = sizeof(rd);
|
rddata.dsize = sizeof(rd);
|
||||||
|
|
||||||
|
if (status == -ECANCELED) {
|
||||||
|
DEBUG(DEBUG_ERR,("Monitoring event was cancelled\n"));
|
||||||
|
goto after_change_status;
|
||||||
|
}
|
||||||
|
|
||||||
if (status == -ETIME) {
|
if (status == -ETIME) {
|
||||||
ctdb->event_script_timeouts++;
|
ctdb->event_script_timeouts++;
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ struct ctdb_event_script_state {
|
|||||||
enum ctdb_eventscript_call call;
|
enum ctdb_eventscript_call call;
|
||||||
const char *options;
|
const char *options;
|
||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
|
|
||||||
unsigned int current;
|
unsigned int current;
|
||||||
struct ctdb_scripts_wire *scripts;
|
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. */
|
/* Kill off any running monitor events to run this event. */
|
||||||
if (ctdb->current_monitor) {
|
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 */
|
/* Discard script status so we don't save to last_status */
|
||||||
talloc_free(ctdb->current_monitor->scripts);
|
talloc_free(ctdb->current_monitor->scripts);
|
||||||
ctdb->current_monitor->scripts = NULL;
|
ctdb->current_monitor->scripts = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user