diff --git a/octavia/common/jinja/lvs/jinja_cfg.py b/octavia/common/jinja/lvs/jinja_cfg.py index 68a33bd1d6..e8344256b6 100644 --- a/octavia/common/jinja/lvs/jinja_cfg.py +++ b/octavia/common/jinja/lvs/jinja_cfg.py @@ -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' } diff --git a/octavia/tests/unit/common/jinja/lvs/test_jinja_cfg.py b/octavia/tests/unit/common/jinja/lvs/test_jinja_cfg.py index ba64e582ae..d83ca1ccaa 100644 --- a/octavia/tests/unit/common/jinja/lvs/test_jinja_cfg.py +++ b/octavia/tests/unit/common/jinja/lvs/test_jinja_cfg.py @@ -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" diff --git a/octavia/tests/unit/common/sample_configs/sample_configs_combined.py b/octavia/tests/unit/common/sample_configs/sample_configs_combined.py index 77dd76728e..fc35cc79e2 100644 --- a/octavia/tests/unit/common/sample_configs/sample_configs_combined.py +++ b/octavia/tests/unit/common/sample_configs/sample_configs_combined.py @@ -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 diff --git a/releasenotes/notes/fix-udp-and-sctp-listener-wrr-50de9dc0774a8ea1.yaml b/releasenotes/notes/fix-udp-and-sctp-listener-wrr-50de9dc0774a8ea1.yaml new file mode 100644 index 0000000000..97a98236a5 --- /dev/null +++ b/releasenotes/notes/fix-udp-and-sctp-listener-wrr-50de9dc0774a8ea1.yaml @@ -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'.