The branch, master has been updated
       via  49e7584679c7467a367888c5b14529c8e338f032 (commit)
       via  6e1f60d8d780c1240aaabb78ecc8550d0480cd7e (commit)
      from  6baaf5bec3ba0094c71d83315170acb5dc729711 (commit)

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


- Log -----------------------------------------------------------------
commit 49e7584679c7467a367888c5b14529c8e338f032
Merge: 6baaf5bec3ba0094c71d83315170acb5dc729711 
6e1f60d8d780c1240aaabb78ecc8550d0480cd7e
Author: Ronnie Sahlberg <ronniesahlb...@gmail.com>
Date:   Mon Jul 6 11:28:10 2009 +1000

    Merge r...@10.1.1.27:/shared/ctdb/ctdb-git

commit 6e1f60d8d780c1240aaabb78ecc8550d0480cd7e
Author: Ronnie Sahlberg <ronniesahlb...@gmail.com>
Date:   Mon Jul 6 11:49:55 2009 +1000

    Perform an ipreallocate efter each enable/disable.
    
    This will force a wait until the ip addresses have been reallocated after a 
disable/enable command and will make scripting of enable/disable more 
predictable.
    
    This will cause the command enable/disable to wait until the ip realocation 
that normally follows shortly after a enable/disable to finish before the 
command returns to the prompt.

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

Summary of changes:
 tools/ctdb.c |  121 +++++++++++++++++++++++++++++++--------------------------
 1 files changed, 66 insertions(+), 55 deletions(-)


Changeset truncated at 500 lines:

diff --git a/tools/ctdb.c b/tools/ctdb.c
index 5d00da9..3ba4db9 100644
--- a/tools/ctdb.c
+++ b/tools/ctdb.c
@@ -1529,6 +1529,62 @@ static int control_getpid(struct ctdb_context *ctdb, int 
argc, const char **argv
 }
 
 /*
+  handler for receiving the response to ipreallocate
+*/
+static void ip_reallocate_handler(struct ctdb_context *ctdb, uint64_t srvid, 
+                            TDB_DATA data, void *private_data)
+{
+       printf("IP Reallocation completed\n");
+       exit(0);
+}
+
+/*
+  ask the recovery daemon on the recovery master to perform a ip reallocation
+ */
+static int control_ipreallocate(struct ctdb_context *ctdb, int argc, const 
char **argv)
+{
+       int ret;
+       TDB_DATA data;
+       struct rd_memdump_reply rd;
+       uint32_t recmaster;
+
+       rd.pnn = ctdb_ctrl_getpnn(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE);
+       if (rd.pnn == -1) {
+               DEBUG(DEBUG_ERR, ("Failed to get pnn of local node\n"));
+               return -1;
+       }
+       rd.srvid = getpid();
+
+       /* register a message port for receiveing the reply so that we
+          can receive the reply
+       */
+       ctdb_set_message_handler(ctdb, rd.srvid, ip_reallocate_handler, NULL);
+
+       data.dptr = (uint8_t *)&rd;
+       data.dsize = sizeof(rd);
+
+       ret = ctdb_ctrl_getrecmaster(ctdb, ctdb, TIMELIMIT(), options.pnn, 
&recmaster);
+       if (ret != 0) {
+               DEBUG(DEBUG_ERR, ("Unable to get recmaster from node %u\n", 
options.pnn));
+               return ret;
+       }
+
+       ret = ctdb_send_message(ctdb, recmaster, CTDB_SRVID_TAKEOVER_RUN, data);
+       if (ret != 0) {
+               DEBUG(DEBUG_ERR,("Failed to send ip takeover run request 
message to %u\n", options.pnn));
+               return -1;
+       }
+
+       /* this loop will terminate when we have received the reply */
+       while (1) {     
+               event_loop_once(ctdb->ev);
+       }
+
+       return 0;
+}
+
+
+/*
   disable a remote node
  */
 static int control_disable(struct ctdb_context *ctdb, int argc, const char 
**argv)
@@ -1552,6 +1608,11 @@ static int control_disable(struct ctdb_context *ctdb, 
int argc, const char **arg
                }
 
        } while (!(nodemap->nodes[options.pnn].flags & 
NODE_FLAGS_PERMANENTLY_DISABLED));
+       ret = control_ipreallocate(ctdb, argc, argv);
+       if (ret != 0) {
+               DEBUG(DEBUG_ERR, ("IP Reallocate failed on node %u\n", 
options.pnn));
+               return ret;
+       }
 
        return 0;
 }
@@ -1581,6 +1642,11 @@ static int control_enable(struct ctdb_context *ctdb, int 
argc, const char **argv
                }
 
        } while (nodemap->nodes[options.pnn].flags & 
NODE_FLAGS_PERMANENTLY_DISABLED);
+       ret = control_ipreallocate(ctdb, argc, argv);
+       if (ret != 0) {
+               DEBUG(DEBUG_ERR, ("IP Reallocate failed on node %u\n", 
options.pnn));
+               return ret;
+       }
 
        return 0;
 }
@@ -2859,61 +2925,6 @@ static int control_rddumpmemory(struct ctdb_context 
*ctdb, int argc, const char
 }
 
 /*
-  handler for receiving the response to ipreallocate
-*/
-static void ip_reallocate_handler(struct ctdb_context *ctdb, uint64_t srvid, 
-                            TDB_DATA data, void *private_data)
-{
-       printf("IP Reallocation completed\n");
-       exit(0);
-}
-
-/*
-  ask the recovery daemon on the recovery master to perform a ip reallocation
- */
-static int control_ipreallocate(struct ctdb_context *ctdb, int argc, const 
char **argv)
-{
-       int ret;
-       TDB_DATA data;
-       struct rd_memdump_reply rd;
-       uint32_t recmaster;
-
-       rd.pnn = ctdb_ctrl_getpnn(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE);
-       if (rd.pnn == -1) {
-               DEBUG(DEBUG_ERR, ("Failed to get pnn of local node\n"));
-               return -1;
-       }
-       rd.srvid = getpid();
-
-       /* register a message port for receiveing the reply so that we
-          can receive the reply
-       */
-       ctdb_set_message_handler(ctdb, rd.srvid, ip_reallocate_handler, NULL);
-
-       data.dptr = (uint8_t *)&rd;
-       data.dsize = sizeof(rd);
-
-       ret = ctdb_ctrl_getrecmaster(ctdb, ctdb, TIMELIMIT(), options.pnn, 
&recmaster);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR, ("Unable to get recmaster from node %u\n", 
options.pnn));
-               return ret;
-       }
-
-       ret = ctdb_send_message(ctdb, recmaster, CTDB_SRVID_TAKEOVER_RUN, data);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,("Failed to send ip takeover run request 
message to %u\n", options.pnn));
-               return -1;
-       }
-
-       /* this loop will terminate when we have received the reply */
-       while (1) {     
-               event_loop_once(ctdb->ev);
-       }
-
-       return 0;
-}
-
-/*
   list all nodes in the cluster
   if the daemon is running, we read the data from the daemon.
   if the daemon is not running we parse the nodes file directly


-- 
CTDB repository

Reply via email to