diff --git a/ctdb/config/events.d/11.natgw b/ctdb/config/events.d/11.natgw index 8a71c86be9c..b994308d488 100644 --- a/ctdb/config/events.d/11.natgw +++ b/ctdb/config/events.d/11.natgw @@ -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 diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index d1ff7593514..e0e728f4f99 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -682,7 +682,7 @@ static int control_natgwlist(struct ctdb_context *ctdb, int argc, const char **a */ for(i=0;inum;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;inum;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"); } }