]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: server: add new SRV_ADMF_CMAINT flag
authorBaptiste Assmann <bedis9@gmail.com>
Sat, 8 Aug 2015 13:49:13 +0000 (15:49 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 8 Aug 2015 16:18:17 +0000 (18:18 +0200)
The purpose of SRV_ADMF_CMAINT flag is to keep in mind the server was
forced to maintenance status because of the configuration file.

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

index cbeead9bded2bc7a99bd1fc8a6b83fe6a6f27415..ee3179443c9d5021ec2b8555a0eab1af4989d6ca 100644 (file)
@@ -73,12 +73,13 @@ enum srv_state {
  *   state_str = (state & MAINT) ? "MAINT" : (state & DRAIN) : "DRAIN" : "READY"
  */
 enum srv_admin {
-       SRV_ADMF_FMAINT    = 0x1,        /* the server was explicitly forced into maintenance */
-       SRV_ADMF_IMAINT    = 0x2,        /* the server has inherited the maintenance status from a tracked server */
-       SRV_ADMF_MAINT     = 0x3,        /* mask to check if any maintenance flag is present */
-       SRV_ADMF_FDRAIN    = 0x4,        /* the server was explicitly forced into drain state */
-       SRV_ADMF_IDRAIN    = 0x8,        /* the server has inherited the drain status from a tracked server */
-       SRV_ADMF_DRAIN     = 0xC,        /* mask to check if any drain flag is present */
+       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_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 */
 };
 
 /* server flags */
index b7a498c2629c416515f05f416da4abfde81ad280..5a3f60ae75b95fac026a9d708622c0bf362d13be 100644 (file)
@@ -1294,6 +1294,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
                                cur_arg += 1;
                        }
                        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;