From 122a4fda7272ec4d63452037f0b838d2bdc5a79a Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Mon, 6 Jul 2015 12:02:00 +1000 Subject: [PATCH] ctdb-daemon: Improve error messages when eventscript control is cancelled Warn specifically about cancellation instead of printing a generic error message. Also pass back an error message for the tool - it could just rely on the status but it already looks at the error message. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- ctdb/server/eventscript.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ctdb/server/eventscript.c b/ctdb/server/eventscript.c index 6a308623412..c0893ff79a6 100644 --- a/ctdb/server/eventscript.c +++ b/ctdb/server/eventscript.c @@ -910,14 +910,23 @@ struct eventscript_callback_state { static void run_eventscripts_callback(struct ctdb_context *ctdb, int status, void *private_data) { + const char *errmsg = NULL; + struct eventscript_callback_state *state = talloc_get_type(private_data, struct eventscript_callback_state); if (status != 0) { - DEBUG(DEBUG_ERR,(__location__ " Failed to run eventscripts\n")); + if (status == -ECANCELED) { + DEBUG(DEBUG_WARNING, + (__location__ " Eventscript cancelled\n")); + errmsg = "cancelled"; + } else { + DEBUG(DEBUG_ERR, + (__location__ " Failed to run eventscripts\n")); + } } - ctdb_request_control_reply(ctdb, state->c, NULL, status, NULL); + ctdb_request_control_reply(ctdb, state->c, NULL, status, errmsg); /* This will free the struct ctdb_event_script_state we are in! */ talloc_free(state); return; -- 2.11.4.GIT