summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorRonnie Sahlberg <sahlberg@samba.org>2008-02-22 09:42:52 +1100
committerRonnie Sahlberg <sahlberg@samba.org>2008-02-22 09:42:52 +1100
commit39539f60444b71306d5cd2a659b3bfb0f4e3de4f (patch)
tree6ab1083741b08175ee57b9d3c185736bab702956 /ctdb
parentc8503e06cd1f76af66d6256c38c40d9fa55599bd (diff)
downloadsamba-39539f60444b71306d5cd2a659b3bfb0f4e3de4f.tar.gz
Add a new parameter to /etc/sysconfig/ctdb
CTDB_START_AS_DISABLED="yes" and command line argument --start-as-disabled When set, this makes the ctdb node to always start in DISABLED mode and will thus not host any public ip addresses. The administrator must manually "ctdb enable" the node after it has started when the administrator wants the node to start hosting public ip addresses. Using this option it is possible to start ctdb on a node without causing any reallocation of ip addresses when it is starting. The node will still merge with the cluster and there will still be a recovery phase but the ip address allocations will not change in the cluster. (This used to be ctdb commit b93d29f43f5306c244c887b54a77bca8a061daf2)
Diffstat (limited to 'ctdb')
-rwxr-xr-xctdb/config/ctdb.init3
-rw-r--r--ctdb/config/ctdb.sysconfig11
-rw-r--r--ctdb/include/ctdb_private.h1
-rw-r--r--ctdb/server/ctdb_server.c6
-rw-r--r--ctdb/server/ctdbd.c4
-rw-r--r--ctdb/tcp/tcp_connect.c6
6 files changed, 27 insertions, 4 deletions
diff --git a/ctdb/config/ctdb.init b/ctdb/config/ctdb.init
index b01d8ee9167..bae52c2c8bf 100755
--- a/ctdb/config/ctdb.init
+++ b/ctdb/config/ctdb.init
@@ -63,6 +63,9 @@ CTDB_OPTIONS="$CTDB_OPTIONS --reclock=$CTDB_RECOVERY_LOCK"
[ -z "$CTDB_EVENT_SCRIPT_DIR" ] || CTDB_OPTIONS="$CTDB_OPTIONS --event-script-dir $CTDB_EVENT_SCRIPT_DIR"
[ -z "$CTDB_TRANSPORT" ] || CTDB_OPTIONS="$CTDB_OPTIONS --transport $CTDB_TRANSPORT"
[ -z "$CTDB_DEBUGLEVEL" ] || CTDB_OPTIONS="$CTDB_OPTIONS -d $CTDB_DEBUGLEVEL"
+[ -z "$CTDB_START_AS_DISABLED" ] || [ "$CTDB_START_AS_DISABLED" != "yes" ] || {
+ CTDB_OPTIONS="$CTDB_OPTIONS --start-as-disabled"
+}
if [ -x /sbin/startproc ]; then
init_style="suse"
diff --git a/ctdb/config/ctdb.sysconfig b/ctdb/config/ctdb.sysconfig
index 74556c0a223..9d1e4341e0e 100644
--- a/ctdb/config/ctdb.sysconfig
+++ b/ctdb/config/ctdb.sysconfig
@@ -80,12 +80,17 @@
# When set, this variable makes ctdb monitor the amount of free memory
# in the system (the second number in the buffers/cache output from free -m).
# If the amount of free memory drops below this treshold the node will become
-# unhealthy and will be marked as DISABLED.
-# Once a node is disabled it requires administrator intervention to enable the
-# node again using the "ctdb enable" command.
+# unhealthy and ctdb and all managed services will be shutdown.
+# Once this occurs, the administrator needs to find the reason for the OOM
+# situation, rectify it and restart ctdb with "service ctdb start"
# The unit is MByte
# CTDB_MONITOR_FREE_MEMORY=100
+# When set to yes, the CTDB node will start in DISABLED mode and not host
+# any public ip addresses. The administrator needs to explicitely enable
+# the node with "ctdb enable"
+# CTDB_START_AS_DISABLED="yes"
+
# where to log messages
# the default is /var/log/log.ctdb
# CTDB_LOGFILE=/var/log/log.ctdb
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index c34a9d994e1..b7970282109 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -372,6 +372,7 @@ struct ctdb_context {
const char *node_ip;
struct ctdb_monitor_state *monitor;
struct ctdb_log_state *log;
+ int start_as_disabled;
};
struct ctdb_db_context {
diff --git a/ctdb/server/ctdb_server.c b/ctdb/server/ctdb_server.c
index 47a65c93ab4..ae545f90ea5 100644
--- a/ctdb/server/ctdb_server.c
+++ b/ctdb/server/ctdb_server.c
@@ -115,8 +115,14 @@ static int ctdb_add_node(struct ctdb_context *ctdb, char *nstr)
if (ctdb->address.address &&
ctdb_same_address(&ctdb->address, &node->address)) {
+ /* for automatic binding to interfaces, see tcp_connect.c */
ctdb->pnn = node->pnn;
node->flags &= ~NODE_FLAGS_DISCONNECTED;
+
+ /* do we start out in DISABLED mode? */
+ if (ctdb->start_as_disabled != 0) {
+ node->flags |= NODE_FLAGS_DISABLED;
+ }
}
ctdb->num_nodes++;
diff --git a/ctdb/server/ctdbd.c b/ctdb/server/ctdbd.c
index ca366fc2092..0686e0b8296 100644
--- a/ctdb/server/ctdbd.c
+++ b/ctdb/server/ctdbd.c
@@ -42,6 +42,7 @@ static struct {
const char *node_ip;
int no_setsched;
int use_syslog;
+ int start_as_disabled;
} options = {
.nlist = ETCDIR "/ctdb/nodes",
.transport = "tcp",
@@ -118,6 +119,7 @@ int main(int argc, const char *argv[])
{ "reclock", 0, POPT_ARG_STRING, &options.recovery_lock_file, 0, "location of recovery lock file", "filename" },
{ "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 },
POPT_TABLEEND
};
int opt, ret;
@@ -157,6 +159,8 @@ int main(int argc, const char *argv[])
ctdb = ctdb_cmdline_init(ev);
+ ctdb->start_as_disabled = options.start_as_disabled;
+
ret = ctdb_set_logfile(ctdb, options.logfile, options.use_syslog);
if (ret == -1) {
printf("ctdb_set_logfile to %s failed - %s\n",
diff --git a/ctdb/tcp/tcp_connect.c b/ctdb/tcp/tcp_connect.c
index f85e3dfdebe..0f14dec8c5e 100644
--- a/ctdb/tcp/tcp_connect.c
+++ b/ctdb/tcp/tcp_connect.c
@@ -313,7 +313,11 @@ static int ctdb_tcp_listen_automatic(struct ctdb_context *ctdb)
ctdb->address.address,
ctdb->address.port,
ctdb->pnn));
-
+ /* do we start out in DISABLED mode? */
+ if (ctdb->start_as_disabled != 0) {
+ ctdb->nodes[i]->flags |= NODE_FLAGS_DISABLED;
+ }
+
if (listen(ctcp->listen_fd, 10) == -1) {
goto failed;
}