diff --git a/octavia/common/jinja/lvs/jinja_cfg.py b/octavia/common/jinja/lvs/jinja_cfg.py index 02a52d8d50..6632404a30 100644 --- a/octavia/common/jinja/lvs/jinja_cfg.py +++ b/octavia/common/jinja/lvs/jinja_cfg.py @@ -27,7 +27,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/functional/amphorae/backend/agent/api_server/test_keepalivedlvs.py b/octavia/tests/functional/amphorae/backend/agent/api_server/test_keepalivedlvs.py index ee6dc5b024..b2fe490191 100644 --- a/octavia/tests/functional/amphorae/backend/agent/api_server/test_keepalivedlvs.py +++ b/octavia/tests/functional/amphorae/backend/agent/api_server/test_keepalivedlvs.py @@ -42,7 +42,7 @@ class KeepalivedLvsTestCase(base.TestCase): "# Configuration for Listener %(listener_id)s\n\n" "net_namespace haproxy-amphora\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" diff --git a/octavia/tests/unit/amphorae/backends/utils/test_keepalivedlvs_query.py b/octavia/tests/unit/amphorae/backends/utils/test_keepalivedlvs_query.py index 82888f70c7..4d10d57181 100644 --- a/octavia/tests/unit/amphorae/backends/utils/test_keepalivedlvs_query.py +++ b/octavia/tests/unit/amphorae/backends/utils/test_keepalivedlvs_query.py @@ -56,7 +56,7 @@ CFG_FILE_TEMPLATE_v4 = ( "# Configuration for Listener %(listener_id)s\n\n" "net_namespace %(ns_name)s\n\n" "virtual_server 10.0.0.37 7777 {\n" - " lb_algo rr\n" + " lb_algo wrr\n" " lb_kind NAT\n" " protocol udp\n\n\n" " # Configuration for Pool %(pool_id)s\n" @@ -97,7 +97,7 @@ CFG_FILE_TEMPLATE_v6 = ( "# Configuration for Listener %(listener_id)s\n\n" "net_namespace %(ns_name)s\n\n" "virtual_server fd79:35e2:9963:0:f816:3eff:fe6d:7a2a 7777 {\n" - " lb_algo rr\n" + " lb_algo wrr\n" " lb_kind NAT\n" " protocol udp\n\n\n" " # Configuration for Pool %(pool_id)s\n" diff --git a/octavia/tests/unit/common/jinja/lvs/test_lvs_jinja_cfg.py b/octavia/tests/unit/common/jinja/lvs/test_lvs_jinja_cfg.py index 1ac9c34f32..6c8d1d15b5 100644 --- a/octavia/tests/unit/common/jinja/lvs/test_lvs_jinja_cfg.py +++ b/octavia/tests/unit/common/jinja/lvs/test_lvs_jinja_cfg.py @@ -40,7 +40,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" @@ -86,7 +86,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" @@ -129,7 +129,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" @@ -172,7 +172,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" @@ -227,7 +227,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" @@ -245,7 +245,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" 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 d59949f944..3694ccc349 100644 --- a/octavia/tests/unit/common/sample_configs/sample_configs_combined.py +++ b/octavia/tests/unit/common/sample_configs/sample_configs_combined.py @@ -469,7 +469,7 @@ RET_UDP_POOL = { 'id': 'sample_pool_id_1', 'enabled': True, 'health_monitor': UDP_HEALTH_MONITOR_NO_SCRIPT, - 'lb_algorithm': 'rr', + 'lb_algorithm': 'wrr', 'members': [UDP_MEMBER_1, UDP_MEMBER_2], 'protocol': 'udp', 'session_persistence': UDP_SOURCE_IP_BODY @@ -481,7 +481,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 diff --git a/octavia/tests/unit/common/sample_configs/sample_configs_split.py b/octavia/tests/unit/common/sample_configs/sample_configs_split.py index 4aa57d709b..1ab198ce72 100644 --- a/octavia/tests/unit/common/sample_configs/sample_configs_split.py +++ b/octavia/tests/unit/common/sample_configs/sample_configs_split.py @@ -468,7 +468,7 @@ RET_UDP_POOL = { 'id': 'sample_pool_id_1', 'enabled': True, 'health_monitor': UDP_HEALTH_MONITOR_NO_SCRIPT, - 'lb_algorithm': 'rr', + 'lb_algorithm': 'wrr', 'members': [UDP_MEMBER_1, UDP_MEMBER_2], 'protocol': 'udp', 'session_persistence': UDP_SOURCE_IP_BODY diff --git a/releasenotes/notes/fix-udp-listener-wrr-50de9dc0774a8ea1.yaml b/releasenotes/notes/fix-udp-listener-wrr-50de9dc0774a8ea1.yaml new file mode 100644 index 0000000000..c795d9f8c3 --- /dev/null +++ b/releasenotes/notes/fix-udp-listener-wrr-50de9dc0774a8ea1.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fix weighted round-robin for UDP 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'.