[SCM] CTDB repository - branch master updated - ctdb-2.1-101-gc2bb859
Amitay Isaacs
amitay at samba.org
Sun May 5 23:36:07 MDT 2013
The branch, master has been updated
via c2bb8596a8af6406ef50e53953884df9d6246a96 (commit)
via 978d4a0d6d8c9877b23f72e3a7b78c1245d16908 (commit)
via 83b61f7414b1f7a3424497ac987ca0724fba9eaa (commit)
via 27a44685f0d7a88804b61a1542bb42adc8f88cb1 (commit)
from 05f785b51cfd8b22b3ae35bf034127fbc07005be (commit)
http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit c2bb8596a8af6406ef50e53953884df9d6246a96
Author: Martin Schwenke <martin at meltin.net>
Date: Thu Feb 21 14:28:13 2013 +1100
ctdbd: Remove the "stopped" event
It isn't used, superceded by "ipreallocated".
Signed-off-by: Martin Schwenke <martin at meltin.net>
commit 978d4a0d6d8c9877b23f72e3a7b78c1245d16908
Author: Martin Schwenke <martin at meltin.net>
Date: Thu Feb 21 14:17:09 2013 +1100
eventscripts: Remove use of "stopped" event
Use "ipreallocated" instead. The "stopped" event pre-dates the
"ipreallocated" event. The only way of stopping a node is via the
ctdb tool, which explicitly causes a takeover run to occur after the
node is stopped. The takeover run will generate an "ipreallocated"
event.
Signed-off-by: Martin Schwenke <martin at meltin.net>
commit 83b61f7414b1f7a3424497ac987ca0724fba9eaa
Author: Martin Schwenke <martin at meltin.net>
Date: Thu Feb 21 13:13:09 2013 +1100
recoverd: ctdb_takeover_run() uses CTDB_CONTROL_IPREALLOCATED
This means "ipreallocated" is now run on stopped nodes.
Signed-off-by: Martin Schwenke <martin at meltin.net>
commit 27a44685f0d7a88804b61a1542bb42adc8f88cb1
Author: Martin Schwenke <martin at meltin.net>
Date: Fri Apr 19 13:05:02 2013 +1000
ctdbd: New control CTDB_CONTROL_IPREALLOCATED
This is an alternative to using ctdb_run_eventscripts() that can be
used when in recovery.
Signed-off-by: Martin Schwenke <martin at meltin.net>
-----------------------------------------------------------------------
Summary of changes:
config/events.d/11.natgw | 2 +-
config/events.d/91.lvs | 2 +-
config/events.d/README | 11 +++----
include/ctdb_private.h | 5 +++-
include/ctdb_protocol.h | 3 +-
server/ctdb_control.c | 6 +++-
server/ctdb_recover.c | 50 +------------------------------------
server/ctdb_takeover.c | 62 +++++++++++++++++++++++++++++++++++++++++++---
server/eventscript.c | 4 +--
9 files changed, 78 insertions(+), 67 deletions(-)
Changeset truncated at 500 lines:
diff --git a/config/events.d/11.natgw b/config/events.d/11.natgw
index 12ba9ca..a6e0523 100755
--- a/config/events.d/11.natgw
+++ b/config/events.d/11.natgw
@@ -98,7 +98,7 @@ case "$1" in
echo 1 > /proc/sys/net/ipv4/route/flush
;;
- shutdown|stopped|removenatgw)
+ shutdown|removenatgw)
delete_all
;;
diff --git a/config/events.d/91.lvs b/config/events.d/91.lvs
index c1e6d15..bdbcfa3 100755
--- a/config/events.d/91.lvs
+++ b/config/events.d/91.lvs
@@ -40,7 +40,7 @@ case "$1" in
echo 1 > /proc/sys/net/ipv4/route/flush
;;
- recovered|stopped|ipreallocated)
+ recovered|ipreallocated)
# kill off any tcp connections
ipvsadm -D -t $CTDB_LVS_PUBLIC_IP:0
ipvsadm -D -u $CTDB_LVS_PUBLIC_IP:0
diff --git a/config/events.d/README b/config/events.d/README
index 6075f39..ea9048f 100644
--- a/config/events.d/README
+++ b/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/include/ctdb_private.h b/include/ctdb_private.h
index 03e996b..e6cfa7f 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -1102,6 +1102,9 @@ int32_t ctdb_control_release_ipv4(struct ctdb_context *ctdb,
struct ctdb_req_control *c,
TDB_DATA indata,
bool *async_reply);
+int32_t ctdb_control_ipreallocated(struct ctdb_context *ctdb,
+ struct ctdb_req_control *c,
+ bool *async_reply);
int32_t ctdb_control_start_recovery(struct ctdb_context *ctdb,
struct ctdb_req_control *c,
bool *async_reply);
@@ -1412,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/include/ctdb_protocol.h b/include/ctdb_protocol.h
index 4755b4c..f3234ed 100644
--- a/include/ctdb_protocol.h
+++ b/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. */
@@ -404,6 +404,7 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS = 0,
CTDB_CONTROL_RELOAD_PUBLIC_IPS = 134,
CTDB_CONTROL_TRAVERSE_ALL_EXT = 135,
CTDB_CONTROL_RECEIVE_RECORDS = 136,
+ CTDB_CONTROL_IPREALLOCATED = 137,
};
/*
diff --git a/server/ctdb_control.c b/server/ctdb_control.c
index 0d0f61c..72a602d 100644
--- a/server/ctdb_control.c
+++ b/server/ctdb_control.c
@@ -351,6 +351,10 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
CHECK_CONTROL_DATA_SIZE(sizeof(struct ctdb_public_ip));
return ctdb_control_release_ip(ctdb, c, indata, async_reply);
+ case CTDB_CONTROL_IPREALLOCATED:
+ CHECK_CONTROL_DATA_SIZE(0);
+ return ctdb_control_ipreallocated(ctdb, c, async_reply);
+
case CTDB_CONTROL_GET_PUBLIC_IPSv4:
CHECK_CONTROL_DATA_SIZE(0);
return ctdb_control_get_public_ipsv4(ctdb, c, outdata);
@@ -517,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/server/ctdb_recover.c b/server/ctdb_recover.c
index 1e5170f..2e9408f 100644
--- a/server/ctdb_recover.c
+++ b/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/server/ctdb_takeover.c b/server/ctdb_takeover.c
index 48704bd..44393a7 100644
--- a/server/ctdb_takeover.c
+++ b/server/ctdb_takeover.c
@@ -2456,12 +2456,10 @@ ipreallocated:
* IPs have moved. Once upon a time this event only used to
* update natwg.
*/
- data.dptr = discard_const("ipreallocated");
- data.dsize = strlen((char *)data.dptr) + 1;
nodes = list_of_connected_nodes(ctdb, nodemap, tmp_ctx, true);
- if (ctdb_client_async_control(ctdb, CTDB_CONTROL_RUN_EVENTSCRIPTS,
+ if (ctdb_client_async_control(ctdb, CTDB_CONTROL_IPREALLOCATED,
nodes, 0, TAKEOVER_TIMEOUT(),
- false, data,
+ false, tdb_null,
NULL, fail_callback,
callback_data) != 0) {
DEBUG(DEBUG_ERR, (__location__ " failed to send control to run eventscripts with \"ipreallocated\"\n"));
@@ -3810,6 +3808,62 @@ int32_t ctdb_control_del_public_address(struct ctdb_context *ctdb, TDB_DATA inda
return -1;
}
+
+struct ipreallocated_callback_state {
+ struct ctdb_req_control *c;
+};
+
+static void ctdb_ipreallocated_callback(struct ctdb_context *ctdb,
+ int status, void *p)
+{
+ struct ipreallocated_callback_state *state =
+ talloc_get_type(p, struct ipreallocated_callback_state);
+
+ if (status != 0) {
+ DEBUG(DEBUG_ERR,
+ (" \"ipreallocated\" event script failed (status %d)\n",
+ status));
+ if (status == -ETIME) {
+ ctdb_ban_self(ctdb);
+ }
+ }
+
+ ctdb_request_control_reply(ctdb, state->c, NULL, status, NULL);
+ talloc_free(state);
+}
+
+/* A control to run the ipreallocated event */
+int32_t ctdb_control_ipreallocated(struct ctdb_context *ctdb,
+ struct ctdb_req_control *c,
+ bool *async_reply)
+{
+ int ret;
+ struct ipreallocated_callback_state *state;
+
+ state = talloc(ctdb, struct ipreallocated_callback_state);
+ CTDB_NO_MEMORY(ctdb, state);
+
+ DEBUG(DEBUG_INFO,(__location__ " Running \"ipreallocated\" event\n"));
+
+ ret = ctdb_event_script_callback(ctdb, state,
+ ctdb_ipreallocated_callback, state,
+ false, CTDB_EVENT_IPREALLOCATED,
+ "%s", "");
+
+ if (ret != 0) {
+ DEBUG(DEBUG_ERR,("Failed to run \"ipreallocated\" event \n"));
+ talloc_free(state);
+ return -1;
+ }
+
+ /* tell the control that we will be reply asynchronously */
+ state->c = talloc_steal(state, c);
+ *async_reply = true;
+
+ return 0;
+}
+
+
/* This function is called from the recovery daemon to verify that a remote
node has the expected ip allocation.
This is verified against ctdb->ip_tree
diff --git a/server/eventscript.c b/server/eventscript.c
index 41bf21d..5c448c7 100644
--- a/server/eventscript.c
+++ b/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:
@@ -716,7 +714,7 @@ static int ctdb_event_script_callback_v(struct ctdb_context *ctdb,
CTDB_EVENT_START_RECOVERY,
CTDB_EVENT_SHUTDOWN,
CTDB_EVENT_RELEASE_IP,
- CTDB_EVENT_STOPPED
+ CTDB_EVENT_IPREALLOCATED,
};
int i;
for (i=0;i<ARRAY_SIZE(allowed_calls);i++) {
--
CTDB repository
More information about the samba-cvs
mailing list