summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronniesahlberg@gmail.com>2009-07-09 11:57:20 +1000
committerRonnie Sahlberg <ronniesahlberg@gmail.com>2009-07-09 11:57:20 +1000
commit66c8d4fb3dbd68f3db4ef542bddf1062da2373e7 (patch)
tree0f7fbb3caceeace5759fe1b44c3506f1b42c4069
parentd6a5fd5c9d6c7ef43308e7b79e79f200abcf72f1 (diff)
make it possible to start the daemon in STOPPED mode
(This used to be ctdb commit 866aa995dc029db6e510060e9e95a8ca149094ac)
-rwxr-xr-xctdb/config/ctdb.init1
-rw-r--r--ctdb/include/ctdb_private.h1
-rw-r--r--ctdb/server/ctdb_server.c5
-rw-r--r--ctdb/server/ctdbd.c3
-rw-r--r--ctdb/tcp/tcp_connect.c5
5 files changed, 15 insertions, 0 deletions
diff --git a/ctdb/config/ctdb.init b/ctdb/config/ctdb.init
index 95e8ccc5c6..d69b01c47d 100755
--- a/ctdb/config/ctdb.init
+++ b/ctdb/config/ctdb.init
@@ -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"
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index 930fa17543..055becaede 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -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;
diff --git a/ctdb/server/ctdb_server.c b/ctdb/server/ctdb_server.c
index ba156e8f71..77928ea340 100644
--- a/ctdb/server/ctdb_server.c
+++ b/ctdb/server/ctdb_server.c
@@ -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++;
diff --git a/ctdb/server/ctdbd.c b/ctdb/server/ctdbd.c
index efb3f0801c..0410ad99e5 100644
--- a/ctdb/server/ctdbd.c
+++ b/ctdb/server/ctdbd.c
@@ -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;
diff --git a/ctdb/tcp/tcp_connect.c b/ctdb/tcp/tcp_connect.c
index fc169e70b7..e3d7772ae4 100644
--- a/ctdb/tcp/tcp_connect.c
+++ b/ctdb/tcp/tcp_connect.c
@@ -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;