Please find a patch in attachment which fix the issue so you can run temporarly the latest code in production. That said, I need to discuss with Willy to ensure this is the best way to do it, since this patch changes the design we did. Anyway, I've updated my server-state code to match the new behavior, soe everyone should be satisfied.
Baptiste On Fri, Sep 18, 2015 at 5:28 AM, Pradeep Jindal <[email protected]> wrote: > It'd be interesting to know the complete semantics of the feature you are > implementing. I know you understand that our use case is a valid one. And we > are open to explore alternative approaches to achieve the same. Till then we > will be running haproxy with the flag change reverted and wait for your > response on this. > > On Sep 18, 2015 1:25 AM, "Baptiste" <[email protected]> wrote: >> >> On Thu, Sep 17, 2015 at 9:42 PM, Pavlos Parissis >> <[email protected]> wrote: >> > On 15/09/2015 08:45 πμ, Cyril Bonté wrote: >> >> Hi, >> >> >> >> >> >> Le 14/09/2015 14:23, Ayush Goyal a écrit : >> >>> Hi, >> >>> >> >>> We are testing haproxy-1.6dev4, we have added a server in backend as >> >>> disabled, but we are not able >> >>> to bring it up using socket command. >> >>> >> >>> Our backend conf looks like this: >> >>> >> >>> =====cut==== >> >>> backend apiservers >> >>> server api101 localhost:1234 maxconn 128 weight 1 >> >>> check >> >>> server api102 localhost:1235 disabled maxconn 128 weight 1 >> >>> check >> >>> server api103 localhost:1236 disabled maxconn 128 weight 1 >> >>> check >> >>> =====cut==== >> >>> >> >>> But, when I run the "enable apiservers/api103" command, it is still in >> >>> MAINT mode. Disabling and enabling of non "disabled" servers like >> >>> api101 >> >>> are happening properly. >> >>> >> >>> Enabling a config "disabled" server works correctly with haproxy1.5. >> >>> Can >> >>> you confirm whether its a bug in 1.6-dev4? >> >> >> >> This is due to the introduction of the SRV_ADMF_CMAINT flag, which is >> >> set permanently. The "enable/disable" socket command will only modify >> >> the SRV_ADMF_FMAINT and SRV_ADMF_FDRAIN flags. >> >> >> >> I add Baptiste to the thread. >> >> >> > >> > That will break our setup as well, where an external tool uses the >> > socket to disable a server in the running config and regenerate the >> > configuration with the server disabled. >> > >> > I am also interested in knowing the motivation behind this change. >> > >> > Cheers, >> > Pavlos >> > >> > >> >> Hi all, >> >> This "feature" was an early patch for later coming feature to avoid >> any impact of reloading HAProxy on servers state. >> I'm currently finishing the dev before forwarding the patches to Willy >> by tomorrow. >> We needed to know the real reason why a server was in maintenance >> state: was it because of configuration or through the socket, so at >> next reload we could apply the right state based on old running state, >> old config state and new config state. >> >> I'm going to check what we can do to fix your issue. >> >> Baptiste >> >
From 752f5d2f02951a3c271c27a6e3a202ef7ada0b73 Mon Sep 17 00:00:00 2001 From: Baptiste Assmann <[email protected]> Date: Fri, 18 Sep 2015 10:30:03 +0200 Subject: [PATCH 01/12] BUG/MAJOR: can't enable a server through the stat socket 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. --- include/types/server.h | 2 +- src/server.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/types/server.h b/include/types/server.h index ee31794..40b8308 100644 --- a/include/types/server.h +++ b/include/types/server.h @@ -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 */ diff --git a/src/server.c b/src/server.c index 49ab68b..32a884f 100644 --- a/src/server.c +++ b/src/server.c @@ -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; -- 2.5.0

