diff options
author | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2009-07-17 09:36:22 +1000 |
---|---|---|
committer | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2009-07-17 09:36:22 +1000 |
commit | 5ce69e2fa379964ae1a50ba4a013b1a5480f8fba (patch) | |
tree | 071275f4c0629da58ca5f8c9f2c110288d390b47 /ctdb | |
parent | bf9ad9c9346b3cb65fbb7a232466b31989a36396 (diff) | |
download | samba-5ce69e2fa379964ae1a50ba4a013b1a5480f8fba.tar.gz samba-5ce69e2fa379964ae1a50ba4a013b1a5480f8fba.tar.xz samba-5ce69e2fa379964ae1a50ba4a013b1a5480f8fba.zip |
if all nodes are STOPPED, pick one of the STOPPED nodes as natgw master
(This used to be ctdb commit 8bbd96cfbbe98f3fc19e432797cbf4478f753a0b)
Diffstat (limited to 'ctdb')
-rw-r--r-- | ctdb/tools/ctdb.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index 352c74f4ad3..d1ff7593514 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -686,6 +686,19 @@ static int control_natgwlist(struct ctdb_context *ctdb, int argc, const char **a break; } } + /* unless all nodes are STOPPED, when we pick one anyway */ + 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); + break; + } + } + /* or if we still can not find any */ + if (i == nodemap->num) { + printf("-1\n"); + } + } /* print the pruned list of nodes belonging to this natgw list */ for(i=0;i<nodemap->num;i++){ |