Commit 50322df introduced the init-state keyword, but it didn't enable
it for dynamic servers. However, this feature is perfectly desirable
for virtual servers too, where someone would like a server inlived
through "set server be1/srv1 state ready" to be put out of maintenance
in down state until the next health check succeeds.
At reading the code, it seems that it's only a matter of allowing this
keyword for dynamic servers, as current code path calls
srv_adm_set_ready() which incidentally triggers a call to
_srv_update_status_adm().
---
 doc/configuration.txt | 3 ++-
 src/server.c          | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/doc/configuration.txt b/doc/configuration.txt
index fd7ea4329..4a5a5fffc 100644
--- a/doc/configuration.txt
+++ b/doc/configuration.txt
@@ -17571,7 +17571,8 @@ init-state { fully-up | up | down | fully-down }
 
   The server's init-state is considered when the HAProxy instance is
   (re)started, a new server is detected (for example via service discovery /
-  DNS resolution), a server exits maintenance, etc.
+  DNS resolution), a dynamic server is inlived, a server exits maintenance,
+  etc.
 
   Examples:
       # pass client traffic ONLY to Redis "master" node
diff --git a/src/server.c b/src/server.c
index 29beffe82..b8d4d2d2a 100644
--- a/src/server.c
+++ b/src/server.c
@@ -2323,7 +2323,7 @@ static struct srv_kw_list srv_kws = { "ALL", { }, {
        { "hash-key",             srv_parse_hash_key,             1,  1,  1 }, 
/* Configure how chash keys are computed */
        { "id",                   srv_parse_id,                   1,  0,  1 }, 
/* set id# of server */
        { "init-addr",            srv_parse_init_addr,            1,  1,  0 }, 
/* */
-       { "init-state",           srv_parse_init_state,           1,  1,  0 }, 
/* Set the initial state of the server */
+       { "init-state",           srv_parse_init_state,           1,  1,  1 }, 
/* Set the initial state of the server */
        { "log-bufsize",          srv_parse_log_bufsize,          1,  1,  0 }, 
/* Set the ring bufsize for log server (only for log backends) */
        { "log-proto",            srv_parse_log_proto,            1,  1,  0 }, 
/* Set the protocol for event messages, only relevant in a log or ring section 
*/
        { "maxconn",              srv_parse_maxconn,              1,  1,  1 }, 
/* Set the max number of concurrent connection */
-- 
2.34.1


Reply via email to