make it possible to start the daemon in STOPPED mode
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Thu, 9 Jul 2009 01:57:20 +0000 (11:57 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Thu, 9 Jul 2009 01:57:20 +0000 (11:57 +1000)
(This used to be ctdb commit 866aa995dc029db6e510060e9e95a8ca149094ac)

ctdb/config/ctdb.init
ctdb/include/ctdb_private.h
ctdb/server/ctdb_server.c
ctdb/server/ctdbd.c
ctdb/tcp/tcp_connect.c

index 95e8ccc5c663705641c0aade52674933c26292c1..d69b01c47de2ece1863c81f86edd919e0304c352 100755 (executable)
@@ -102,6 +102,7 @@ build_ctdb_options () {
     maybe_set "-d"                       "$CTDB_DEBUGLEVEL"
     maybe_set "--notification-script"    "$CTDB_NOTIFY_SCRIPT"
     maybe_set "--start-as-disabled"      "$CTDB_START_AS_DISABLED"    "yes"
+    maybe_set "--start-as-stopped "      "$CTDB_START_AS_STOPPED"     "yes"
     maybe_set "--no-recmaster"           "$CTDB_CAPABILITY_RECMASTER" "no"
     maybe_set "--no-lmaster"             "$CTDB_CAPABILITY_LMASTER"   "no"
     maybe_set "--lvs --single-public-ip" "$CTDB_LVS_PUBLIC_IP"
index 930fa175434ea62c8c5302c93508ed960c41e927..055becaede604b84679b2eb236c7c83f892bb0e3 100644 (file)
@@ -416,6 +416,7 @@ struct ctdb_context {
        struct ctdb_monitor_state *monitor;
        struct ctdb_log_state *log;
        int start_as_disabled;
+       int start_as_stopped;
        uint32_t event_script_timeouts; /* counting how many consecutive times an eventscript has timedout */
        TALLOC_CTX *eventscripts_ctx; /* a context to hold data for the RUN_EVENTSCRIPTS control */
        uint32_t *recd_ping_count;
index ba156e8f71d21ae0c1f9ea1bd2d0075015702416..77928ea3404b43e16bc78534bce7b994841e84c0 100644 (file)
@@ -142,6 +142,11 @@ static int ctdb_add_node(struct ctdb_context *ctdb, char *nstr)
                        DEBUG(DEBUG_INFO, ("This node is configured to start in DISABLED state\n"));
                        node->flags |= NODE_FLAGS_DISABLED;
                }
+               /* do we start out in STOPPED mode? */
+               if (ctdb->start_as_stopped != 0) {
+                       DEBUG(DEBUG_INFO, ("This node is configured to start in STOPPED state\n"));
+                       node->flags |= NODE_FLAGS_STOPPED;
+               }
        }
 
        ctdb->num_nodes++;
index efb3f0801c69dd2673f1ee1799d00486dd2cf7e7..0410ad99e51604aa9e357c5980d7225c999f292a 100644 (file)
@@ -44,6 +44,7 @@ static struct {
        int         no_setsched;
        int         use_syslog;
        int         start_as_disabled;
+       int         start_as_stopped;
        int         no_lmaster;
        int         no_recmaster;
        int         lvs;
@@ -129,6 +130,7 @@ int main(int argc, const char *argv[])
                { "nosetsched", 0, POPT_ARG_NONE, &options.no_setsched, 0, "disable setscheduler SCHED_FIFO call", NULL },
                { "syslog", 0, POPT_ARG_NONE, &options.use_syslog, 0, "log messages to syslog", NULL },
                { "start-as-disabled", 0, POPT_ARG_NONE, &options.start_as_disabled, 0, "Node starts in disabled state", NULL },
+               { "start-as-stopped", 0, POPT_ARG_NONE, &options.start_as_stopped, 0, "Node starts in stopped state", NULL },
                { "no-lmaster", 0, POPT_ARG_NONE, &options.no_lmaster, 0, "disable lmaster role on this node", NULL },
                { "no-recmaster", 0, POPT_ARG_NONE, &options.no_recmaster, 0, "disable recmaster role on this node", NULL },
                { "lvs", 0, POPT_ARG_NONE, &options.lvs, 0, "lvs is enabled on this node", NULL },
@@ -169,6 +171,7 @@ int main(int argc, const char *argv[])
        ctdb = ctdb_cmdline_init(ev);
 
        ctdb->start_as_disabled = options.start_as_disabled;
+       ctdb->start_as_stopped  = options.start_as_stopped;
 
        script_log_level = options.script_log_level;
 
index fc169e70b708eb96eb67835d5b5fc70a27d7bf0b..e3d7772ae4e044576ceb95faa25973730796203a 100644 (file)
@@ -371,6 +371,11 @@ static int ctdb_tcp_listen_automatic(struct ctdb_context *ctdb)
                DEBUG(DEBUG_INFO, ("This node is configured to start in DISABLED state\n"));
                ctdb->nodes[i]->flags |= NODE_FLAGS_DISABLED;
        }
+       /* do we start out in STOPPED mode? */
+       if (ctdb->start_as_stopped != 0) {
+               DEBUG(DEBUG_INFO, ("This node is configured to start in STOPPED state\n"));
+               ctdb->nodes[i]->flags |= NODE_FLAGS_STOPPED;
+       }
        
        if (listen(ctcp->listen_fd, 10) == -1) {
                goto failed;