From 629d5ee1fa9b84150c25c151b3bf0690cb787a90 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 23 Mar 2009 19:07:45 +1100 Subject: add a new command "ctdb scriptstatus" this command shows which eventscripts were executed during the last monitoring cycle and the status from each eventscript. If an eventscript timedout or returned an error we also show the output from the eventscript. Example : [root@rcn1 ctdb-git]# ./bin/ctdb scriptstatus 6 scripts were executed last monitoring cycle 00.ctdb Status:OK Duration:0.021 Mon Mar 23 19:04:32 2009 10.interface Status:OK Duration:0.048 Mon Mar 23 19:04:32 2009 20.multipathd Status:OK Duration:0.011 Mon Mar 23 19:04:33 2009 40.vsftpd Status:OK Duration:0.011 Mon Mar 23 19:04:33 2009 41.httpd Status:OK Duration:0.011 Mon Mar 23 19:04:33 2009 50.samba Status:ERROR Duration:0.057 Mon Mar 23 19:04:33 2009 OUTPUT:ERROR: Samba tcp port 445 is not responding Add a new helper function "switch_from_server_to_client()" which both the recovery daemon can use as well as in the child process we start for running the actual eventscripts. Create several new controls, both for the eventscript child process to inform the master daemon of the current status of the scripts as well as for the ctdb tool to extract this information from the runninc daemon. (This used to be ctdb commit c98f90ad61c9b1e679116fbed948ddca4111968d) --- ctdb/server/ctdb_control.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'ctdb/server/ctdb_control.c') diff --git a/ctdb/server/ctdb_control.c b/ctdb/server/ctdb_control.c index b8b31c9b51..ac77696a4b 100644 --- a/ctdb/server/ctdb_control.c +++ b/ctdb/server/ctdb_control.c @@ -418,6 +418,25 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb, CHECK_CONTROL_DATA_SIZE(0); return ctdb_control_recd_ping(ctdb); + case CTDB_CONTROL_EVENT_SCRIPT_INIT: + CHECK_CONTROL_DATA_SIZE(0); + return ctdb_control_event_script_init(ctdb); + + case CTDB_CONTROL_EVENT_SCRIPT_START: + return ctdb_control_event_script_start(ctdb, indata); + + case CTDB_CONTROL_EVENT_SCRIPT_STOP: + CHECK_CONTROL_DATA_SIZE(sizeof(int32_t)); + return ctdb_control_event_script_stop(ctdb, indata); + + case CTDB_CONTROL_EVENT_SCRIPT_FINISHED: + CHECK_CONTROL_DATA_SIZE(0); + return ctdb_control_event_script_finished(ctdb); + + case CTDB_CONTROL_GET_EVENT_SCRIPT_STATUS: + CHECK_CONTROL_DATA_SIZE(0); + return ctdb_control_get_event_script_status(ctdb, outdata); + default: DEBUG(DEBUG_CRIT,(__location__ " Unknown CTDB control opcode %u\n", opcode)); return -1; -- cgit