Merge "Fix haproxy global maxconn with disabled listeners" into stable/2023.1

This commit is contained in:
Zuul 2024-06-12 16:55:51 +00:00 committed by Gerrit Code Review
commit a25864a325
3 changed files with 30 additions and 0 deletions

View File

@ -265,6 +265,8 @@ class JinjaTemplater(object):
# listeners' connection limits.
connection_limit_sum = 0
for listener in listeners:
if not listener.enabled:
continue
if listener.protocol in constants.LVS_PROTOCOLS:
continue
if listener.connection_limit and listener.connection_limit > -1:

View File

@ -1558,6 +1558,28 @@ class TestHaproxyCfg(base.TestCase):
self.assertLess(ret['global_connection_limit'],
connection_limit_sum)
def test_transform_with_disabled_listeners(self):
in_amphora = sample_configs_combined.sample_amphora_tuple()
in_listeners = []
connection_limit_sum = 0
in_listener = (
sample_configs_combined.sample_listener_tuple())
connection_limit_sum += constants.HAPROXY_DEFAULT_MAXCONN
in_listeners.append(in_listener)
disabled_listener = (
sample_configs_combined.sample_listener_tuple(enabled=False))
in_listeners.append(disabled_listener)
ret = self.jinja_cfg._transform_loadbalancer(
in_amphora, in_listeners[0].load_balancer,
in_listeners, None, {})
self.assertEqual(ret['global_connection_limit'],
connection_limit_sum)
def test_transform_amphora(self):
in_amphora = sample_configs_combined.sample_amphora_tuple()
ret = self.jinja_cfg._transform_amphora(in_amphora, {})

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Fixed the global number of concurrent connections in haproxy when disabling
listeners. The connection-limit of disabled listeners was used to compute
this value, disabled listeners are now skipped.