]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MAJOR: can't enable a server through the stat socket
authorBaptiste Assmann <bedis9@gmail.com>
Fri, 18 Sep 2015 08:30:03 +0000 (10:30 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 18 Sep 2015 10:38:23 +0000 (12:38 +0200)
When a server is disabled in the configuration using the "disabled"
keyword, a single flag is positionned: SRV_ADMF_CMAINT (use to be
SRV_ADMF_FMAINT)..
That said, when providing the first version of this code, we also
changed the SRV_ADMF_MAINT mask to match any of the possible MAINT
cases: SRV_ADMF_FMAINT, SRV_ADMF_IMAINT, SRV_ADMF_CMAINT

Since SRV_ADMF_CMAINT is never (and is not supposed to be) altered at
run time, once a server has this flag set up, it can never ever be
enabled again using the stats socket.

In order to fix this, we should:
- consider SRV_ADMF_CMAINT as a simple flag to report the state in the
  old configuration file (will be used after a reload to deduce the
  state of the server in a new running process)
- enabling both SRV_ADMF_CMAINT and SRV_ADMF_FMAINT when the keyword
  "disabled" is in use in the configuration
- update the mask SRV_ADMF_MAINT as it was before, to only match
  SRV_ADMF_FMAINT and SRV_ADMF_IMAINT.

The following patch perform the changes above.
It allows fixing the regression without breaking the way the up coming
feature (seamless server state accross reloads) is going to work.

Note: this is 1.6-only, no backport needed.

include/types/server.h
src/server.c

index ee3179443c9d5021ec2b8555a0eab1af4989d6ca..40b8308392653f3e7046c79097ce1a2d65886b37 100644 (file)
@@ -75,8 +75,8 @@ enum srv_state {
 enum srv_admin {
        SRV_ADMF_FMAINT    = 0x01,        /* the server was explicitly forced into maintenance */
        SRV_ADMF_IMAINT    = 0x02,        /* the server has inherited the maintenance status from a tracked server */
+       SRV_ADMF_MAINT     = 0x03,        /* mask to check if any maintenance flag is present */
        SRV_ADMF_CMAINT    = 0x04,        /* the server is in maintenance because of the configuration */
-       SRV_ADMF_MAINT     = 0x07,        /* mask to check if any maintenance flag is present */
        SRV_ADMF_FDRAIN    = 0x08,        /* the server was explicitly forced into drain state */
        SRV_ADMF_IDRAIN    = 0x10,        /* the server has inherited the drain status from a tracked server */
        SRV_ADMF_DRAIN     = 0x18,        /* mask to check if any drain flag is present */
index 49ab68b0cf7c13a0c67c2588e61c24346bcc6a68..32a884f065c9f1d2ccc378e180a3f4dd5ae2c0ba 100644 (file)
@@ -1278,6 +1278,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
                        }
                        else if (!defsrv && !strcmp(args[cur_arg], "disabled")) {
                                newsrv->admin |= SRV_ADMF_CMAINT;
+                               newsrv->admin |= SRV_ADMF_FMAINT;
                                newsrv->state = SRV_ST_STOPPED;
                                newsrv->check.state |= CHK_ST_PAUSED;
                                newsrv->check.health = 0;