From: Baptiste Assmann Date: Fri, 18 Sep 2015 08:30:03 +0000 (+0200) Subject: BUG/MAJOR: can't enable a server through the stat socket X-Git-Tag: v1.6-dev6~129 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=54a4730c65b5f912bfc32fcd86f5e69999f65ac7;p=thirdparty%2Fhaproxy.git 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. Note: this is 1.6-only, no backport needed. --- diff --git a/include/types/server.h b/include/types/server.h index ee3179443c..40b8308392 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 49ab68b0cf..32a884f065 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;