]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] checks: add the ability to disable a server in the config
authorWilly Tarreau <w@1wt.eu>
Mon, 29 Mar 2010 08:02:24 +0000 (10:02 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 29 Mar 2010 09:50:34 +0000 (11:50 +0200)
Adding the "disabled" keyword on a server line disables it. It can
then be enabled again on the unix socket.

doc/configuration.txt
src/cfgparse.c

index a2046ebbf3c83874d91cc9ea3b6dc07e4c248f60..3972ce1c34fa19270a6e8cd7c804087b8247e536 100644 (file)
@@ -5392,6 +5392,15 @@ cookie <value>
 
   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"
index bddb6e73053294fa99ecad22cd834e77d74c5f6b..645c631c8cc8db308fd384b3f8cd2e52d877994e 100644 (file)
@@ -3181,7 +3181,8 @@ stats_error_parsing:
                                        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 @@ stats_error_parsing:
                                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 @@ stats_error_parsing:
                        }
                        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",