1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

update the eventscript to ensure that stopped nodes can not become the natgw master

also verify that we actually do have a natgw master available if this is configured and make the node unhealthy if not.

(This used to be ctdb commit 7f273ee769d671d8c8be87c9187302fb77e814f3)
This commit is contained in:
Ronnie Sahlberg 2009-07-17 09:45:05 +10:00
parent 5ce69e2fa3
commit 9c6aa4e420
2 changed files with 9 additions and 5 deletions

View File

@ -37,10 +37,14 @@ case $cmd in
recovered)
MYPNN=`ctdb pnn | cut -d: -f2`
NATGWMASTER=`ctdb natgwlist | head -1`
NATGWIP=`ctdb natgwlist | tail --lines=+2 | head -1 | cut -d: -f3`
NATGWMASTER=`ctdb natgwlist | head -1 | sed -e "s/ .*//"`
NATGWIP=`ctdb natgwlist | head -1 | sed -e "s/^[^ ]* *//"`
CTDB_NATGW_PUBLIC_IP_HOST=`echo $CTDB_NATGW_PUBLIC_IP | sed -e "s/\/.*/\/32/"`
if [ "$NATGWMASTER" == "-1" ]; then
echo "There is not NATGW master node"
exit 1
fi
delete_all

View File

@ -682,7 +682,7 @@ static int control_natgwlist(struct ctdb_context *ctdb, int argc, const char **a
*/
for(i=0;i<nodemap->num;i++){
if (!(nodemap->nodes[i].flags & (NODE_FLAGS_DISCONNECTED|NODE_FLAGS_STOPPED|NODE_FLAGS_DELETED))) {
printf("%d\n", nodemap->nodes[i].pnn);
printf("%d %s\n", nodemap->nodes[i].pnn,ctdb_addr_to_str(&nodemap->nodes[i].addr));
break;
}
}
@ -690,13 +690,13 @@ static int control_natgwlist(struct ctdb_context *ctdb, int argc, const char **a
if (i == nodemap->num) {
for(i=0;i<nodemap->num;i++){
if (!(nodemap->nodes[i].flags & (NODE_FLAGS_DISCONNECTED|NODE_FLAGS_DELETED))) {
printf("%d\n", nodemap->nodes[i].pnn);
printf("%d %s\n", nodemap->nodes[i].pnn, ctdb_addr_to_str(&nodemap->nodes[i].addr));
break;
}
}
/* or if we still can not find any */
if (i == nodemap->num) {
printf("-1\n");
printf("-1 0.0.0.0\n");
}
}