]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: config: only warn if stats are attached to multi-process bind directives
authorWilly Tarreau <w@1wt.eu>
Tue, 16 Sep 2014 13:11:04 +0000 (15:11 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 16 Sep 2014 13:43:24 +0000 (15:43 +0200)
Some users want to have a stats frontend with one line per process, but while
100% valid and safe, the config parser emits a warning. Relax this check to
ensure that the warning is only emitted if at least one of the listeners is
bound to multiple processes, or if the directive is placed in a backend called
from multiple processes (since in this case we don't know if it's safe).

src/cfgparse.c

index 05b8f8a11cb436f1ff988d40bd1da11d118aea74..970d353e04d330510738dadbce7c13c0e573a13f 100644 (file)
@@ -7323,8 +7323,19 @@ out_uri_auth_compat:
 
                if (nbproc > 1) {
                        if (curproxy->uri_auth) {
-                               Warning("Proxy '%s': in multi-process mode, stats will be limited to process assigned to the current request.\n",
-                                       curproxy->id);
+                               int count, maxproc = 0;
+
+                               list_for_each_entry(bind_conf, &curproxy->conf.bind, by_fe) {
+                                       count = popcount(bind_conf->bind_proc);
+                                       if (count > maxproc)
+                                               maxproc = count;
+                               }
+                               /* backends have 0, frontends have 1 or more */
+                               if (maxproc != 1)
+                                       Warning("Proxy '%s': in multi-process mode, stats will be"
+                                               " limited to process assigned to the current request.\n",
+                                               curproxy->id);
+
                                if (!LIST_ISEMPTY(&curproxy->uri_auth->admin_rules)) {
                                        Warning("Proxy '%s': stats admin will not work correctly in multi-process mode.\n",
                                                curproxy->id);