[SCM] CTDB repository - branch 1.0.112 updated - ctdb-1.0.111-136-g83fcabe
Ronnie Sahlberg
sahlberg at samba.org
Tue Aug 10 21:28:48 MDT 2010
The branch, 1.0.112 has been updated
via 83fcabed2d3014df4112f9644c3186e205b28ad6 (commit)
via 1a595bad79aa2b6994c9098b86f06bf38444e23c (commit)
from e19ef366984223fe94f878aecb50d05990f1ced7 (commit)
http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=1.0.112
- Log -----------------------------------------------------------------
commit 83fcabed2d3014df4112f9644c3186e205b28ad6
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Wed Aug 11 12:46:33 2010 +1000
New version 1.0.112-33
commit 1a595bad79aa2b6994c9098b86f06bf38444e23c
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Wed Aug 11 12:37:51 2010 +1000
Add a new event :ipreallocated"
This is called everytime a reallocation is performed.
While STARTRECOVERY/RECOVERED events are only called when
we do ipreallocation as part of a full database/cluster recovery,
this new event can be used to trigger on when we just do a light
failover due to a node becomming unhealthy.
I.e. situations where we do a failover but we do not perform a full
cluster recovery.
Use this to trigger for natgw so we select a new natgw master node
when failover happens and not just when cluster rebuilds happen.
-----------------------------------------------------------------------
Summary of changes:
common/ctdb_util.c | 3 ++-
config/events.d/11.natgw | 2 +-
include/ctdb.h | 1 +
packaging/RPM/ctdb.spec.in | 7 ++++++-
server/ctdb_takeover.c | 19 ++++++++++++++++---
server/eventscript.c | 1 +
6 files changed, 27 insertions(+), 6 deletions(-)
Changeset truncated at 500 lines:
diff --git a/common/ctdb_util.c b/common/ctdb_util.c
index 9dc6d7a..835bbfd 100644
--- a/common/ctdb_util.c
+++ b/common/ctdb_util.c
@@ -664,5 +664,6 @@ const char *ctdb_eventscript_call_names[] = {
"monitor",
"status",
"shutdown",
- "reload"
+ "reload",
+ "ipreallocated"
};
diff --git a/config/events.d/11.natgw b/config/events.d/11.natgw
index c872837..2fc232a 100755
--- a/config/events.d/11.natgw
+++ b/config/events.d/11.natgw
@@ -45,7 +45,7 @@ case "$1" in
ctdb setnatgwstate on
;;
- recovered|updatenatgw)
+ recovered|updatenatgw|ipreallocated)
MYPNN=`ctdb pnn | cut -d: -f2`
NATGWMASTER=`ctdb natgwlist | head -1 | sed -e "s/ .*//"`
NATGWIP=`ctdb natgwlist | head -1 | sed -e "s/^[^ ]* *//"`
diff --git a/include/ctdb.h b/include/ctdb.h
index cc83495..294fe01 100644
--- a/include/ctdb.h
+++ b/include/ctdb.h
@@ -695,6 +695,7 @@ enum ctdb_eventscript_call {
CTDB_EVENT_STATUS, /* Report service status: no args. */
CTDB_EVENT_SHUTDOWN, /* CTDB shutting down: no args. */
CTDB_EVENT_RELOAD, /* magic */
+ CTDB_EVENT_IPREALLOCATED, /* when a takeover_run() completes */
CTDB_EVENT_MAX
};
diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index 7a09368..a71cacf 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
@@ -5,7 +5,7 @@ Vendor: Samba Team
Packager: Samba Team <samba at samba.org>
Name: ctdb
Version: 1.0.112
-Release: 32
+Release: 33
Epoch: 0
License: GNU GPL version 3
Group: System Environment/Daemons
@@ -125,6 +125,11 @@ rm -rf $RPM_BUILD_ROOT
%{_docdir}/ctdb/tests/bin/ctdb_transaction
%changelog
+* Tue Aug 11 2010 : Version 1.0.112-33
+ - CQ : S1019290
+ Add a new event "ipreallocated" so that we can update the natgw
+ configuration also when normal/light failovers occur and not just when
+ heavy/full database recoveries/cluster rebuilds trigger.
* Tue Aug 10 2010 : Version 1.0.112-32
- Dont check if natgw is enabled or not in the natgw script
- disable the check if winbind is ok
diff --git a/server/ctdb_takeover.c b/server/ctdb_takeover.c
index cb65f29..208a6c6 100644
--- a/server/ctdb_takeover.c
+++ b/server/ctdb_takeover.c
@@ -737,10 +737,10 @@ create_merged_ip_list(struct ctdb_context *ctdb)
*/
int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map *nodemap)
{
- int i, num_healthy, retries, num_ips;
+ int i, num_healthy, retries, num_ips;
struct ctdb_public_ip ip;
struct ctdb_public_ipv4 ipv4;
- uint32_t mask;
+ uint32_t mask, *nodes;
struct ctdb_public_ip_list *all_ips, *tmp_ip;
int maxnode, maxnum=0, minnode, minnum=0, num;
TDB_DATA data;
@@ -749,7 +749,6 @@ int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map *nodemap)
struct ctdb_client_control_state *state;
TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
-
ZERO_STRUCT(ip);
/* Count how many completely healthy nodes we have */
@@ -1057,6 +1056,20 @@ finished:
return -1;
}
+
+ /* tell all nodes to update natwg */
+ /* send the flags update natgw on all connected nodes */
+ 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,
+ nodes, 0, TAKEOVER_TIMEOUT(),
+ false, data,
+ NULL, NULL,
+ NULL) != 0) {
+ DEBUG(DEBUG_ERR, (__location__ " ctdb_control to updatenatgw failed\n"));
+ }
+
talloc_free(tmp_ctx);
return 0;
}
diff --git a/server/eventscript.c b/server/eventscript.c
index 712733c..c403772 100644
--- a/server/eventscript.c
+++ b/server/eventscript.c
@@ -608,6 +608,7 @@ static bool check_options(enum ctdb_eventscript_call call, const char *options)
case CTDB_EVENT_STATUS:
case CTDB_EVENT_SHUTDOWN:
case CTDB_EVENT_RELOAD:
+ case CTDB_EVENT_IPREALLOCATED:
return count_words(options) == 0;
case CTDB_EVENT_TAKE_IP: /* interface, IP address, netmask bits. */
--
CTDB repository
More information about the samba-cvs
mailing list