Fix weighted round-robin about UDP and SCTP listener
'lb_algo rr' in keepalived won't work correctly with weight for UDP and SCTP listeners, it should be 'lb_algo wrr'. 'wrr' is superset of 'rr' algorithm, as round-robin is a specical instance of the weighted round-robin scheduling, in which all the weights are equal. [1] Algorithm in HAProxy is set to 'roundrobin', which also support weights, but in keepalived must be set to 'wrr' to work with the weighted round-robin scheduling, as it is different to 'rr'. [1] https://www.keepalived.org/doc/scheduling_algorithms.html Story 2008462 Task 41491 Change-Id: Ic63929d8864e5285baf70dd85e6362988bf2863f
This commit is contained in:
parent
c93a76b9f3
commit
5352a10f62
@ -30,7 +30,7 @@ PROTOCOL_MAP = {
|
||||
}
|
||||
|
||||
BALANCE_MAP = {
|
||||
constants.LB_ALGORITHM_ROUND_ROBIN: 'rr',
|
||||
constants.LB_ALGORITHM_ROUND_ROBIN: 'wrr',
|
||||
constants.LB_ALGORITHM_LEAST_CONNECTIONS: 'lc',
|
||||
constants.LB_ALGORITHM_SOURCE_IP: 'sh'
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ class TestLvsCfg(base.TestCase):
|
||||
"# Configuration for Listener sample_listener_id_1\n\n"
|
||||
"net_namespace amphora-haproxy\n\n"
|
||||
"virtual_server 10.0.0.2 80 {\n"
|
||||
" lb_algo rr\n"
|
||||
" lb_algo wrr\n"
|
||||
" lb_kind NAT\n"
|
||||
" protocol UDP\n"
|
||||
" persistence_timeout 33\n"
|
||||
@ -88,7 +88,7 @@ class TestLvsCfg(base.TestCase):
|
||||
"# Configuration for Listener sample_listener_id_1\n\n"
|
||||
"net_namespace amphora-haproxy\n\n"
|
||||
"virtual_server 10.0.0.2 80 {\n"
|
||||
" lb_algo rr\n"
|
||||
" lb_algo wrr\n"
|
||||
" lb_kind NAT\n"
|
||||
" protocol UDP\n"
|
||||
" delay_loop 30\n"
|
||||
@ -131,7 +131,7 @@ class TestLvsCfg(base.TestCase):
|
||||
"# Configuration for Listener sample_listener_id_1\n\n"
|
||||
"net_namespace amphora-haproxy\n\n"
|
||||
"virtual_server 10.0.0.2 80 {\n"
|
||||
" lb_algo rr\n"
|
||||
" lb_algo wrr\n"
|
||||
" lb_kind NAT\n"
|
||||
" protocol UDP\n"
|
||||
" delay_loop 30\n"
|
||||
@ -174,7 +174,7 @@ class TestLvsCfg(base.TestCase):
|
||||
"# Configuration for Listener sample_listener_id_1\n\n"
|
||||
"net_namespace amphora-haproxy\n\n"
|
||||
"virtual_server 10.0.0.2 80 {\n"
|
||||
" lb_algo rr\n"
|
||||
" lb_algo wrr\n"
|
||||
" lb_kind NAT\n"
|
||||
" protocol UDP\n"
|
||||
" delay_loop 30\n"
|
||||
@ -229,7 +229,7 @@ class TestLvsCfg(base.TestCase):
|
||||
"# Configuration for Listener sample_listener_id_1\n\n"
|
||||
"net_namespace amphora-haproxy\n\n"
|
||||
"virtual_server 10.0.0.2 80 {\n"
|
||||
" lb_algo rr\n"
|
||||
" lb_algo wrr\n"
|
||||
" lb_kind NAT\n"
|
||||
" protocol UDP\n\n\n"
|
||||
" # Configuration for Pool sample_pool_id_0\n"
|
||||
@ -247,7 +247,7 @@ class TestLvsCfg(base.TestCase):
|
||||
"# Configuration for Listener sample_listener_id_1\n\n"
|
||||
"net_namespace amphora-haproxy\n\n"
|
||||
"virtual_server 10.0.0.2 80 {\n"
|
||||
" lb_algo rr\n"
|
||||
" lb_algo wrr\n"
|
||||
" lb_kind NAT\n"
|
||||
" protocol UDP\n\n\n"
|
||||
" # Pool sample_pool_id_1 is disabled\n"
|
||||
@ -358,7 +358,7 @@ class TestLvsCfg(base.TestCase):
|
||||
"# Configuration for Listener sample_listener_id_1\n\n"
|
||||
"net_namespace amphora-haproxy\n\n"
|
||||
"virtual_server 10.0.0.2 80 {\n"
|
||||
" lb_algo rr\n"
|
||||
" lb_algo wrr\n"
|
||||
" lb_kind NAT\n"
|
||||
" protocol UDP\n"
|
||||
" delay_loop 30\n"
|
||||
@ -419,7 +419,7 @@ class TestLvsCfg(base.TestCase):
|
||||
"# Configuration for Listener sample_listener_id_1\n\n"
|
||||
"net_namespace amphora-haproxy\n\n"
|
||||
"virtual_server 10.0.0.2 80 {\n"
|
||||
" lb_algo rr\n"
|
||||
" lb_algo wrr\n"
|
||||
" lb_kind NAT\n"
|
||||
" protocol UDP\n"
|
||||
" delay_loop 30\n"
|
||||
@ -477,7 +477,7 @@ class TestLvsCfg(base.TestCase):
|
||||
"# Configuration for Listener sample_listener_id_1\n\n"
|
||||
"net_namespace amphora-haproxy\n\n"
|
||||
"virtual_server 10.0.0.2 80 {\n"
|
||||
" lb_algo rr\n"
|
||||
" lb_algo wrr\n"
|
||||
" lb_kind NAT\n"
|
||||
" protocol SCTP\n"
|
||||
" persistence_timeout 33\n"
|
||||
@ -523,7 +523,7 @@ class TestLvsCfg(base.TestCase):
|
||||
"# Configuration for Listener sample_listener_id_1\n\n"
|
||||
"net_namespace amphora-haproxy\n\n"
|
||||
"virtual_server 10.0.0.2 80 {\n"
|
||||
" lb_algo rr\n"
|
||||
" lb_algo wrr\n"
|
||||
" lb_kind NAT\n"
|
||||
" protocol SCTP\n"
|
||||
" delay_loop 30\n"
|
||||
@ -566,7 +566,7 @@ class TestLvsCfg(base.TestCase):
|
||||
"# Configuration for Listener sample_listener_id_1\n\n"
|
||||
"net_namespace amphora-haproxy\n\n"
|
||||
"virtual_server 10.0.0.2 80 {\n"
|
||||
" lb_algo rr\n"
|
||||
" lb_algo wrr\n"
|
||||
" lb_kind NAT\n"
|
||||
" protocol SCTP\n"
|
||||
" delay_loop 30\n"
|
||||
@ -609,7 +609,7 @@ class TestLvsCfg(base.TestCase):
|
||||
"# Configuration for Listener sample_listener_id_1\n\n"
|
||||
"net_namespace amphora-haproxy\n\n"
|
||||
"virtual_server 10.0.0.2 80 {\n"
|
||||
" lb_algo rr\n"
|
||||
" lb_algo wrr\n"
|
||||
" lb_kind NAT\n"
|
||||
" protocol SCTP\n"
|
||||
" delay_loop 30\n"
|
||||
@ -749,7 +749,7 @@ class TestLvsCfg(base.TestCase):
|
||||
"# Configuration for Listener sample_listener_id_1\n\n"
|
||||
"net_namespace amphora-haproxy\n\n"
|
||||
"virtual_server 10.0.0.2 80 {\n"
|
||||
" lb_algo rr\n"
|
||||
" lb_algo wrr\n"
|
||||
" lb_kind NAT\n"
|
||||
" protocol SCTP\n"
|
||||
" delay_loop 30\n"
|
||||
@ -810,7 +810,7 @@ class TestLvsCfg(base.TestCase):
|
||||
"# Configuration for Listener sample_listener_id_1\n\n"
|
||||
"net_namespace amphora-haproxy\n\n"
|
||||
"virtual_server 10.0.0.2 80 {\n"
|
||||
" lb_algo rr\n"
|
||||
" lb_algo wrr\n"
|
||||
" lb_kind NAT\n"
|
||||
" protocol SCTP\n"
|
||||
" delay_loop 30\n"
|
||||
|
@ -461,7 +461,7 @@ RET_UDP_POOL = {
|
||||
'id': 'sample_pool_id_1',
|
||||
'enabled': True,
|
||||
'health_monitor': RET_UDP_HEALTH_MONITOR,
|
||||
'lb_algorithm': 'rr',
|
||||
'lb_algorithm': 'wrr',
|
||||
'members': [UDP_MEMBER_1, UDP_MEMBER_2],
|
||||
'protocol': 'udp',
|
||||
'session_persistence': UDP_SOURCE_IP_BODY
|
||||
@ -473,7 +473,7 @@ RET_UDP_LISTENER = {
|
||||
'id': 'sample_pool_id_1',
|
||||
'enabled': True,
|
||||
'health_monitor': RET_UDP_HEALTH_MONITOR,
|
||||
'lb_algorithm': 'rr',
|
||||
'lb_algorithm': 'wrr',
|
||||
'members': [UDP_MEMBER_1, UDP_MEMBER_2],
|
||||
'protocol': 'udp',
|
||||
'session_persistence': UDP_SOURCE_IP_BODY
|
||||
@ -544,7 +544,7 @@ RET_SCTP_POOL = {
|
||||
'id': 'sample_pool_id_1',
|
||||
'enabled': True,
|
||||
'health_monitor': RET_SCTP_HEALTH_MONITOR,
|
||||
'lb_algorithm': 'rr',
|
||||
'lb_algorithm': 'wrr',
|
||||
'members': [SCTP_MEMBER_1, SCTP_MEMBER_2],
|
||||
'protocol': 'sctp',
|
||||
'session_persistence': SCTP_SOURCE_IP_BODY
|
||||
@ -556,7 +556,7 @@ RET_SCTP_LISTENER = {
|
||||
'id': 'sample_pool_id_1',
|
||||
'enabled': True,
|
||||
'health_monitor': RET_SCTP_HEALTH_MONITOR,
|
||||
'lb_algorithm': 'rr',
|
||||
'lb_algorithm': 'wrr',
|
||||
'members': [SCTP_MEMBER_1, SCTP_MEMBER_2],
|
||||
'protocol': 'sctp',
|
||||
'session_persistence': SCTP_SOURCE_IP_BODY
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fix weighted round-robin for UDP and SCTP listeners with keepalived and
|
||||
lvs. The algorithm must be specified as 'wrr' in order for weighted
|
||||
round-robin to work correctly, but was being set to 'rr'.
|
Loading…
Reference in New Issue
Block a user