summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2013-02-21 14:28:13 +1100
committerAmitay Isaacs <amitay@gmail.com>2013-05-06 13:38:21 +1000
commitfa16cccf0227bf72fabd858ecd68c76d22a76f67 (patch)
tree5bb5a9b8a6e4733d22e12d2c595ab36f1f386384
parentfb028a208c57e52d031942c82ea4495c292656ea (diff)
downloadsamba-fa16cccf0227bf72fabd858ecd68c76d22a76f67.tar.gz
ctdbd: Remove the "stopped" event
It isn't used, superceded by "ipreallocated". Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit c2bb8596a8af6406ef50e53953884df9d6246a96)
-rw-r--r--ctdb/config/events.d/README11
-rw-r--r--ctdb/include/ctdb_private.h2
-rw-r--r--ctdb/include/ctdb_protocol.h2
-rw-r--r--ctdb/server/ctdb_control.c2
-rw-r--r--ctdb/server/ctdb_recover.c50
-rw-r--r--ctdb/server/eventscript.c3
6 files changed, 9 insertions, 61 deletions
diff --git a/ctdb/config/events.d/README b/ctdb/config/events.d/README
index 6075f39f023..ea9048fcf00 100644
--- a/ctdb/config/events.d/README
+++ b/ctdb/config/events.d/README
@@ -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:
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index 410e670fdad..e6cfa7fdebb 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -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);
diff --git a/ctdb/include/ctdb_protocol.h b/ctdb/include/ctdb_protocol.h
index 728edc08b91..f3234ed6280 100644
--- a/ctdb/include/ctdb_protocol.h
+++ b/ctdb/include/ctdb_protocol.h
@@ -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. */
diff --git a/ctdb/server/ctdb_control.c b/ctdb/server/ctdb_control.c
index 4dff05e65f3..72a602d98d7 100644
--- a/ctdb/server/ctdb_control.c
+++ b/ctdb/server/ctdb_control.c
@@ -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);
diff --git a/ctdb/server/ctdb_recover.c b/ctdb/server/ctdb_recover.c
index 1e5170fecca..2e9408fc9e7 100644
--- a/ctdb/server/ctdb_recover.c
+++ b/ctdb/server/ctdb_recover.c
@@ -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;
}
diff --git a/ctdb/server/eventscript.c b/ctdb/server/eventscript.c
index 752543fbe5e..5c448c731ae 100644
--- a/ctdb/server/eventscript.c
+++ b/ctdb/server/eventscript.c
@@ -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++) {