The branch, master has been updated
       via  7f273ee769d671d8c8be87c9187302fb77e814f3 (commit)
       via  8bbd96cfbbe98f3fc19e432797cbf4478f753a0b (commit)
       via  4505ea15408ad40dd8deb4041fd75a65a0ad9336 (commit)
      from  b75ac1185481060ab71bd743e1e48d333d716eba (commit)

http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 7f273ee769d671d8c8be87c9187302fb77e814f3
Author: Ronnie Sahlberg <ronniesahlb...@gmail.com>
Date:   Fri Jul 17 09:45:05 2009 +1000

    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.

commit 8bbd96cfbbe98f3fc19e432797cbf4478f753a0b
Author: Ronnie Sahlberg <ronniesahlb...@gmail.com>
Date:   Fri Jul 17 09:36:22 2009 +1000

    if all nodes are STOPPED, pick one of the STOPPED nodes as natgw master

commit 4505ea15408ad40dd8deb4041fd75a65a0ad9336
Author: Ronnie Sahlberg <ronniesahlb...@gmail.com>
Date:   Fri Jul 17 09:29:58 2009 +1000

    Do not allow STOPPED or DELETED nodes to become the NATGW master

-----------------------------------------------------------------------

Summary of changes:
 config/events.d/11.natgw |    8 ++++++--
 tools/ctdb.c             |   21 ++++++++++++++++++---
 2 files changed, 24 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/config/events.d/11.natgw b/config/events.d/11.natgw
index 8a71c86..b994308 100644
--- a/config/events.d/11.natgw
+++ b/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/tools/ctdb.c b/tools/ctdb.c
index 12fbe48..e0e728f 100644
--- a/tools/ctdb.c
+++ b/tools/ctdb.c
@@ -677,13 +677,28 @@ static int control_natgwlist(struct ctdb_context *ctdb, 
int argc, const char **a
                i++;
        }               
 
-       /* print the natgw master */
+       /* print the natgw master
+        * we dont allow STOPPED or DELETED nodes to become the natgwmaster
+        */
        for(i=0;i<nodemap->num;i++){
-               if (!(nodemap->nodes[i].flags & NODE_FLAGS_DISCONNECTED)) {
-                       printf("%d\n", nodemap->nodes[i].pnn);
+               if (!(nodemap->nodes[i].flags & 
(NODE_FLAGS_DISCONNECTED|NODE_FLAGS_STOPPED|NODE_FLAGS_DELETED))) {
+                       printf("%d %s\n", 
nodemap->nodes[i].pnn,ctdb_addr_to_str(&nodemap->nodes[i].addr));
                        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 %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 0.0.0.0\n");
+               }
+       }
 
        /* print the pruned list of nodes belonging to this natgw list */
        for(i=0;i<nodemap->num;i++){


-- 
CTDB repository

Reply via email to