ctdbd: Remove the "stopped" event
authorMartin Schwenke <martin@meltin.net>
Thu, 21 Feb 2013 03:28:13 +0000 (14:28 +1100)
committerAmitay Isaacs <amitay@gmail.com>
Mon, 6 May 2013 03:38:21 +0000 (13:38 +1000)
It isn't used, superceded by "ipreallocated".

Signed-off-by: Martin Schwenke <martin@meltin.net>
config/events.d/README
include/ctdb_private.h
include/ctdb_protocol.h
server/ctdb_control.c
server/ctdb_recover.c
server/eventscript.c

index 6075f39f023f2fe67038a5e5a5c7479ab25c48a3..ea9048fcf00edd01b439eade7edace5373841b86 100644 (file)
@@ -146,12 +146,11 @@ recovered
        service and also send out statd notifications to all registered 
        clients.
        
-stopped
-       This event is called when a node is STOPPED and can be used to
-       perform additional cleanup that is required.
-       Note that a stopped node is considered inactive, so it will not
-       be issuing the recovered event once the cluster has recovered.
-       See 91.lvs for a use of this event.
+ipreallocated
+
+       This event is triggered after releaseip and takeip events in a
+       takeover run.  It can be used to reconfigure services, update
+       routing and many other things.
 
 Additional note for takeip, releaseip, recovered:
 
index 410e670fdadc17dcf0e551d6b385f3ef9b4b8a9f..e6cfa7fdebb964f1bf67094aea8c7493024eff99 100644 (file)
@@ -1415,7 +1415,7 @@ int32_t ctdb_control_get_event_script_status(struct ctdb_context *ctdb,
 int ctdb_log_event_script_output(struct ctdb_context *ctdb, char *str, uint16_t len);
 int ctdb_ctrl_report_recd_lock_latency(struct ctdb_context *ctdb, struct timeval timeout, double latency);
 
-int32_t ctdb_control_stop_node(struct ctdb_context *ctdb, struct ctdb_req_control *c, bool *async_reply);
+int32_t ctdb_control_stop_node(struct ctdb_context *ctdb);
 int32_t ctdb_control_continue_node(struct ctdb_context *ctdb);
 
 void ctdb_stop_vacuuming(struct ctdb_context *ctdb);
index 728edc08b915a1c8f9f9dd2edaf32e7f161fba40..f3234ed6280242a3dbb28a44fb5149949816dda2 100644 (file)
@@ -240,7 +240,7 @@ enum ctdb_eventscript_call {
        CTDB_EVENT_RECOVERED,           /* CTDB recovery finished: no args. */
        CTDB_EVENT_TAKE_IP,             /* IP taken: interface, IP address, netmask bits. */
        CTDB_EVENT_RELEASE_IP,          /* IP released: interface, IP address, netmask bits. */
-       CTDB_EVENT_STOPPED,             /* This node is stopped: no args. */
+       CTDB_EVENT_STOPPED,             /* Deprecated, do not use. */
        CTDB_EVENT_MONITOR,             /* Please check if service is healthy: no args. */
        CTDB_EVENT_STATUS,              /* Report service status: no args. */
        CTDB_EVENT_SHUTDOWN,            /* CTDB shutting down: no args. */
index 4dff05e65f3749bc8d76df1ff97721844bb73a8b..72a602d98d71e2c35bf15008f9f098fcde9438ec 100644 (file)
@@ -521,7 +521,7 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
 
        case CTDB_CONTROL_STOP_NODE:
                CHECK_CONTROL_DATA_SIZE(0);
-               return ctdb_control_stop_node(ctdb, c, async_reply);
+               return ctdb_control_stop_node(ctdb);
 
        case CTDB_CONTROL_CONTINUE_NODE:
                CHECK_CONTROL_DATA_SIZE(0);
index 1e5170feccaf595b098d83318d7f24de4cb5ad23..2e9408fc9e722a0f5600175706eadc7fab893494 100644 (file)
@@ -1357,60 +1357,12 @@ int32_t ctdb_control_set_recmaster(struct ctdb_context *ctdb, uint32_t opcode, T
 }
 
 
-struct stop_node_callback_state {
-       struct ctdb_req_control *c;
-};
-
-/*
-  called when the 'stopped' event script has finished
- */
-static void ctdb_stop_node_callback(struct ctdb_context *ctdb, int status, void *p)
+int32_t ctdb_control_stop_node(struct ctdb_context *ctdb)
 {
-       struct stop_node_callback_state *state = talloc_get_type(p, struct stop_node_callback_state);
-
-       if (status != 0) {
-               DEBUG(DEBUG_ERR,(__location__ " stopped event script failed (status %d)\n", status));
-               ctdb->nodes[ctdb->pnn]->flags &= ~NODE_FLAGS_STOPPED;
-               if (status == -ETIME) {
-                       ctdb_ban_self(ctdb);
-               }
-       }
-
-       ctdb_request_control_reply(ctdb, state->c, NULL, status, NULL);
-       talloc_free(state);
-}
-
-int32_t ctdb_control_stop_node(struct ctdb_context *ctdb, struct ctdb_req_control *c, bool *async_reply)
-{
-       int ret;
-       struct stop_node_callback_state *state;
-
        DEBUG(DEBUG_INFO,(__location__ " Stopping node\n"));
-
-       state = talloc(ctdb, struct stop_node_callback_state);
-       CTDB_NO_MEMORY(ctdb, state);
-
-       state->c    = talloc_steal(state, c);
-
        ctdb_disable_monitoring(ctdb);
-
-       ret = ctdb_event_script_callback(ctdb, state,
-                                        ctdb_stop_node_callback, 
-                                        state, false,
-                                        CTDB_EVENT_STOPPED, "%s", "");
-
-       if (ret != 0) {
-               ctdb_enable_monitoring(ctdb);
-
-               DEBUG(DEBUG_ERR,(__location__ " Failed to stop node\n"));
-               talloc_free(state);
-               return -1;
-       }
-
        ctdb->nodes[ctdb->pnn]->flags |= NODE_FLAGS_STOPPED;
 
-       *async_reply = true;
-
        return 0;
 }
 
index 752543fbe5e646bd7d611a4a51f239943523a3a0..5c448c731ae1ab68ac03d06ca9062c18b0104800 100644 (file)
@@ -568,7 +568,6 @@ static void ctdb_event_script_timeout(struct event_context *ev, struct timed_eve
        case CTDB_EVENT_RECOVERED:
        case CTDB_EVENT_TAKE_IP:
        case CTDB_EVENT_RELEASE_IP:
-       case CTDB_EVENT_STOPPED:
        case CTDB_EVENT_STATUS:
                state->scripts->scripts[state->current].status = 0;
                DEBUG(DEBUG_ERR,("Ignoring hung script for %s call %d\n", state->options, state->call));
@@ -666,7 +665,6 @@ static bool check_options(enum ctdb_eventscript_call call, const char *options)
        case CTDB_EVENT_STARTUP:
        case CTDB_EVENT_START_RECOVERY:
        case CTDB_EVENT_RECOVERED:
-       case CTDB_EVENT_STOPPED:
        case CTDB_EVENT_MONITOR:
        case CTDB_EVENT_STATUS:
        case CTDB_EVENT_SHUTDOWN:
@@ -717,7 +715,6 @@ static int ctdb_event_script_callback_v(struct ctdb_context *ctdb,
                        CTDB_EVENT_SHUTDOWN,
                        CTDB_EVENT_RELEASE_IP,
                        CTDB_EVENT_IPREALLOCATED,
-                       CTDB_EVENT_STOPPED
                };
                int i;
                for (i=0;i<ARRAY_SIZE(allowed_calls);i++) {