mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-05-06 17:58:01 +00:00
MINOR: server: do not emit warnings/logs/alerts on server state changes at boot
We'll have to use srv_set_admin_flag() to propagate some server flags during the startup, and we don't want the resulting actions to cause warnings, logs nor e-mail alerts to be generated since we're just applying the config or a state file. So let's condition these notifications to the fact that we're starting.
This commit is contained in:
parent
e1bde1492a
commit
6fb8dc1a5a
@ -1326,9 +1326,11 @@ void set_backend_down(struct proxy *be)
|
|||||||
be->last_change = now.tv_sec;
|
be->last_change = now.tv_sec;
|
||||||
be->down_trans++;
|
be->down_trans++;
|
||||||
|
|
||||||
|
if (!(global.mode & MODE_STARTING)) {
|
||||||
Alert("%s '%s' has no server available!\n", proxy_type_str(be), be->id);
|
Alert("%s '%s' has no server available!\n", proxy_type_str(be), be->id);
|
||||||
send_log(be, LOG_EMERG, "%s %s has no server available!\n", proxy_type_str(be), be->id);
|
send_log(be, LOG_EMERG, "%s %s has no server available!\n", proxy_type_str(be), be->id);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Apply RDP cookie persistence to the current stream. For this, the function
|
/* Apply RDP cookie persistence to the current stream. For this, the function
|
||||||
* tries to extract an RDP cookie from the request buffer, and look for the
|
* tries to extract an RDP cookie from the request buffer, and look for the
|
||||||
|
@ -430,9 +430,11 @@ void srv_set_admin_flag(struct server *s, enum srv_admin mode)
|
|||||||
|
|
||||||
srv_append_status(&trash, s, NULL, -1, (mode & SRV_ADMF_FMAINT));
|
srv_append_status(&trash, s, NULL, -1, (mode & SRV_ADMF_FMAINT));
|
||||||
|
|
||||||
|
if (!(global.mode & MODE_STARTING)) {
|
||||||
Warning("%s.\n", trash.str);
|
Warning("%s.\n", trash.str);
|
||||||
send_log(s->proxy, LOG_NOTICE, "%s.\n", trash.str);
|
send_log(s->proxy, LOG_NOTICE, "%s.\n", trash.str);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else { /* server was still running */
|
else { /* server was still running */
|
||||||
int srv_was_stopping = (s->state == SRV_ST_STOPPING) || (s->admin & SRV_ADMF_DRAIN);
|
int srv_was_stopping = (s->state == SRV_ST_STOPPING) || (s->admin & SRV_ADMF_DRAIN);
|
||||||
int prev_srv_count = s->proxy->srv_bck + s->proxy->srv_act;
|
int prev_srv_count = s->proxy->srv_bck + s->proxy->srv_act;
|
||||||
@ -459,8 +461,10 @@ void srv_set_admin_flag(struct server *s, enum srv_admin mode)
|
|||||||
|
|
||||||
srv_append_status(&trash, s, NULL, xferred, (mode & SRV_ADMF_FMAINT));
|
srv_append_status(&trash, s, NULL, xferred, (mode & SRV_ADMF_FMAINT));
|
||||||
|
|
||||||
|
if (!(global.mode & MODE_STARTING)) {
|
||||||
Warning("%s.\n", trash.str);
|
Warning("%s.\n", trash.str);
|
||||||
send_log(s->proxy, srv_was_stopping ? LOG_NOTICE : LOG_ALERT, "%s.\n", trash.str);
|
send_log(s->proxy, srv_was_stopping ? LOG_NOTICE : LOG_ALERT, "%s.\n", trash.str);
|
||||||
|
}
|
||||||
|
|
||||||
if (prev_srv_count && s->proxy->srv_bck == 0 && s->proxy->srv_act == 0)
|
if (prev_srv_count && s->proxy->srv_bck == 0 && s->proxy->srv_act == 0)
|
||||||
set_backend_down(s->proxy);
|
set_backend_down(s->proxy);
|
||||||
@ -488,10 +492,11 @@ void srv_set_admin_flag(struct server *s, enum srv_admin mode)
|
|||||||
|
|
||||||
srv_append_status(&trash, s, NULL, xferred, (mode & SRV_ADMF_FDRAIN));
|
srv_append_status(&trash, s, NULL, xferred, (mode & SRV_ADMF_FDRAIN));
|
||||||
|
|
||||||
|
if (!(global.mode & MODE_STARTING)) {
|
||||||
Warning("%s.\n", trash.str);
|
Warning("%s.\n", trash.str);
|
||||||
send_log(s->proxy, LOG_NOTICE, "%s.\n", trash.str);
|
send_log(s->proxy, LOG_NOTICE, "%s.\n", trash.str);
|
||||||
send_email_alert(s, LOG_NOTICE, "%s", trash.str);
|
send_email_alert(s, LOG_NOTICE, "%s", trash.str);
|
||||||
|
}
|
||||||
if (prev_srv_count && s->proxy->srv_bck == 0 && s->proxy->srv_act == 0)
|
if (prev_srv_count && s->proxy->srv_bck == 0 && s->proxy->srv_act == 0)
|
||||||
set_backend_down(s->proxy);
|
set_backend_down(s->proxy);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user