[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/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",