[MINOR] checks: add the ability to disable a server in the config
Adding the "disabled" keyword on a server line disables it. It can
then be enabled again on the unix socket.
diff --git a/doc/configuration.txt b/doc/configuration.txt
index a2046eb..3972ce1 100644
--- a/doc/configuration.txt
+++ b/doc/configuration.txt
@@ -5392,6 +5392,15 @@
Supported in default-server: No
+disabled
+ The "disabled" keyword starts the server in the "disabled" state. That means
+ that it is marked down in maintenance mode, and no connection other than the
+ ones allowed by persist mode will reach it. It is very well suited to setup
+ new servers, because normal traffic will never reach them, while it is still
+ possible to test the service by making use of the force-persist mechanism.
+
+ Supported in default-server: No
+
error-limit <count>
If health observing is enabled, the "error-limit" parameter specifies the
number of consecutive errors that triggers event selected by the "on-error"
diff --git a/src/cfgparse.c b/src/cfgparse.c
index bddb6e7..645c631 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -3181,7 +3181,8 @@
goto out;
}
- newsrv->health = newsrv->rise;
+ if (newsrv->health)
+ newsrv->health = newsrv->rise;
cur_arg += 2;
}
else if (!strcmp(args[cur_arg], "fall")) {
@@ -3332,6 +3333,12 @@
do_check = 1;
cur_arg += 1;
}
+ else if (!defsrv && !strcmp(args[cur_arg], "disabled")) {
+ newsrv->state |= SRV_MAINTAIN;
+ newsrv->state &= ~SRV_RUNNING;
+ newsrv->health = 0;
+ cur_arg += 1;
+ }
else if (!defsrv && !strcmp(args[cur_arg], "observe")) {
if (!strcmp(args[cur_arg + 1], "none"))
newsrv->observe = HANA_OBS_NONE;
@@ -3512,7 +3519,7 @@
}
else {
if (!defsrv)
- Alert("parsing [%s:%d] : server %s only supports options 'backup', 'cookie', 'redir', 'observer', 'on-error', 'error-limit', 'check', 'track', 'id', 'inter', 'fastinter', 'downinter', 'rise', 'fall', 'addr', 'port', 'source', 'minconn', 'maxconn', 'maxqueue', 'slowstart' and 'weight'.\n",
+ Alert("parsing [%s:%d] : server %s only supports options 'backup', 'cookie', 'redir', 'observer', 'on-error', 'error-limit', 'check', 'disabled', 'track', 'id', 'inter', 'fastinter', 'downinter', 'rise', 'fall', 'addr', 'port', 'source', 'minconn', 'maxconn', 'maxqueue', 'slowstart' and 'weight'.\n",
file, linenum, newsrv->id);
else
Alert("parsing [%s:%d]: default-server only supports options 'on-error', 'error-limit', 'inter', 'fastinter', 'downinter', 'rise', 'fall', 'port', 'minconn', 'maxconn', 'maxqueue', 'slowstart' and 'weight'.\n",