diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2009-12-07 23:11:47 +1030 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2009-12-07 23:11:47 +1030 |
commit | b9b75bd065e67ef1ee941323b7dfb48e51fee66e (patch) | |
tree | a44d9fa6eb721c0c6dd7c0c83e2528a6fb10a244 /ctdb/server/eventscript.c | |
parent | ce378014c7836b9ff112aad6a473db19670e0e91 (diff) | |
download | samba-b9b75bd065e67ef1ee941323b7dfb48e51fee66e.tar.gz samba-b9b75bd065e67ef1ee941323b7dfb48e51fee66e.tar.xz samba-b9b75bd065e67ef1ee941323b7dfb48e51fee66e.zip |
eventscript: use -ENOEXEC for disabled status value
This unifies code paths and simplifies things: we just hand -ENOEXEC to
ctdb_ctrl_event_script_stop().
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(This used to be ctdb commit eadf5e44ef97d7703a7d3bce0e7ea0f21cb11f14)
Diffstat (limited to 'ctdb/server/eventscript.c')
-rw-r--r-- | ctdb/server/eventscript.c | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/ctdb/server/eventscript.c b/ctdb/server/eventscript.c index a4292778f1..57fbd85768 100644 --- a/ctdb/server/eventscript.c +++ b/ctdb/server/eventscript.c @@ -90,7 +90,6 @@ struct ctdb_monitor_script_status { const char *name; struct timeval start; struct timeval finished; - int32_t disabled; int32_t status; char *output; }; @@ -197,33 +196,6 @@ int32_t ctdb_control_event_script_stop(struct ctdb_context *ctdb, TDB_DATA indat return 0; } -/* called from the event script child process when we have a disabled script - */ -int32_t ctdb_control_event_script_disabled(struct ctdb_context *ctdb, TDB_DATA indata) -{ - const char *name = (const char *)indata.dptr; - struct ctdb_monitor_script_status *script; - - DEBUG(DEBUG_INFO, ("event script disabed called for script %s\n", name)); - - if (ctdb->current_monitor_status_ctx == NULL) { - DEBUG(DEBUG_ERR,(__location__ " current_monitor_status_ctx is NULL when script finished\n")); - return -1; - } - - script = ctdb->current_monitor_status_ctx->scripts; - if (script == NULL) { - DEBUG(DEBUG_ERR,(__location__ " script is NULL when the script had finished\n")); - return -1; - } - - script->finished = timeval_current(); - script->status = 0; - script->disabled = 1; - - return 0; -} - static struct ctdb_monitoring_wire *marshall_monitoring_scripts(TALLOC_CTX *mem_ctx, struct ctdb_monitoring_wire *monitoring_scripts, struct ctdb_monitor_script_status *script) { struct ctdb_monitoring_script_wire script_wire; @@ -241,7 +213,6 @@ static struct ctdb_monitoring_wire *marshall_monitoring_scripts(TALLOC_CTX *mem_ strncpy(script_wire.name, script->name, MAX_SCRIPT_NAME); script_wire.start = script->start; script_wire.finished = script->finished; - script_wire.disabled = script->disabled; script_wire.status = script->status; if (script->output != NULL) { strncpy(script_wire.output, script->output, MAX_SCRIPT_OUTPUT); @@ -568,7 +539,7 @@ static int ctdb_run_event_script(struct ctdb_context *ctdb, } if (!current->is_enabled) { - if (ctdb_ctrl_event_script_disabled(ctdb, current->name) != 0) { + if (ctdb_ctrl_event_script_stop(ctdb, -ENOEXEC) != 0) { DEBUG(DEBUG_ERR,(__location__ " Failed to report disabled eventscript\n")); talloc_free(tmp_ctx); return -1; |