|
|
ebb439 |
From 8c5c3ca0fc5c28aac937868e9ce5b11010e693f5 Mon Sep 17 00:00:00 2001
|
|
|
ebb439 |
Message-Id: <8c5c3ca0fc5c28aac937868e9ce5b11010e693f5.1605177623.git.lorenzo.bianconi@redhat.com>
|
|
|
ebb439 |
From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
|
|
|
ebb439 |
Date: Wed, 11 Nov 2020 13:39:17 +0100
|
|
|
ebb439 |
Subject: [PATCH ovn 20.09] northd: Fix lb_action when there are no active backends
|
|
|
ebb439 |
for lb health_check.
|
|
|
ebb439 |
|
|
|
ebb439 |
Fix the following warning reported by ovn-controller when there are no
|
|
|
ebb439 |
active backends for lb health_check and selection_fields has been
|
|
|
ebb439 |
configured for hash computation.
|
|
|
ebb439 |
|
|
|
ebb439 |
flow|WARN|error parsing actions "drop; hash_fields="ip_dst,ip_src,tcp_dst,tcp_src");":
|
|
|
ebb439 |
Syntax error at `hash_fields' expecting end of input.
|
|
|
ebb439 |
|
|
|
ebb439 |
Tested-by: Flavio Fernandes <flavio@flaviof.com>
|
|
|
ebb439 |
Fixes: 5af304e747 ("Support selection fields in load balancer.")
|
|
|
ebb439 |
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
|
|
|
ebb439 |
Signed-off-by: Numan Siddique <numans@ovn.org>
|
|
|
ebb439 |
---
|
|
|
ebb439 |
northd/ovn-northd.c | 5 ++++-
|
|
|
ebb439 |
tests/ovn.at | 6 ++++--
|
|
|
ebb439 |
2 files changed, 8 insertions(+), 3 deletions(-)
|
|
|
ebb439 |
|
|
|
ebb439 |
--- a/northd/ovn-northd.c
|
|
|
ebb439 |
+++ b/northd/ovn-northd.c
|
|
|
ebb439 |
@@ -3613,6 +3613,8 @@ static void build_lb_vip_ct_lb_actions(s
|
|
|
ebb439 |
struct ds *action,
|
|
|
ebb439 |
char *selection_fields)
|
|
|
ebb439 |
{
|
|
|
ebb439 |
+ bool skip_hash_fields = false;
|
|
|
ebb439 |
+
|
|
|
ebb439 |
if (lb_vip->health_check) {
|
|
|
ebb439 |
ds_put_cstr(action, "ct_lb(backends=");
|
|
|
ebb439 |
|
|
|
ebb439 |
@@ -3631,6 +3633,7 @@ static void build_lb_vip_ct_lb_actions(s
|
|
|
ebb439 |
}
|
|
|
ebb439 |
|
|
|
ebb439 |
if (!n_active_backends) {
|
|
|
ebb439 |
+ skip_hash_fields = true;
|
|
|
ebb439 |
ds_clear(action);
|
|
|
ebb439 |
ds_put_cstr(action, "drop;");
|
|
|
ebb439 |
} else {
|
|
|
ebb439 |
@@ -3641,7 +3644,7 @@ static void build_lb_vip_ct_lb_actions(s
|
|
|
ebb439 |
ds_put_format(action, "ct_lb(backends=%s);", lb_vip->backend_ips);
|
|
|
ebb439 |
}
|
|
|
ebb439 |
|
|
|
ebb439 |
- if (selection_fields && selection_fields[0]) {
|
|
|
ebb439 |
+ if (!skip_hash_fields && selection_fields && selection_fields[0]) {
|
|
|
ebb439 |
ds_chomp(action, ';');
|
|
|
ebb439 |
ds_chomp(action, ')');
|
|
|
ebb439 |
ds_put_format(action, "; hash_fields=\"%s\");", selection_fields);
|
|
|
ebb439 |
--- a/tests/ovn.at
|
|
|
ebb439 |
+++ b/tests/ovn.at
|
|
|
ebb439 |
@@ -19601,6 +19601,8 @@ ovn-nbctl lsp-set-addresses sw1-lr0 rout
|
|
|
ebb439 |
ovn-nbctl lsp-set-options sw1-lr0 router-port=lr0-sw1
|
|
|
ebb439 |
|
|
|
ebb439 |
ovn-nbctl lb-add lb1 10.0.0.10:80 10.0.0.3:80,20.0.0.3:80
|
|
|
ebb439 |
+OVN_LB_ID=$(ovn-nbctl --bare --column _uuid find load_balancer name=lb1)
|
|
|
ebb439 |
+ovn-nbctl set load_balancer ${OVN_LB_ID} selection_fields="ip_dst,ip_src,tp_dst,tp_src"
|
|
|
ebb439 |
|
|
|
ebb439 |
ovn-nbctl --wait=sb set load_balancer . ip_port_mappings:10.0.0.3=sw0-p1:10.0.0.2
|
|
|
ebb439 |
ovn-nbctl --wait=sb set load_balancer . ip_port_mappings:20.0.0.3=sw1-p1:20.0.0.2
|
|
|
ebb439 |
@@ -19637,12 +19639,12 @@ service_monitor | sed '/^$/d' | wc -l`])
|
|
|
ebb439 |
|
|
|
ebb439 |
ovn-sbctl dump-flows sw0 | grep ct_lb | grep priority=120 > lflows.txt
|
|
|
ebb439 |
AT_CHECK([cat lflows.txt], [0], [dnl
|
|
|
ebb439 |
- table=11(ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(backends=10.0.0.3:80,20.0.0.3:80);)
|
|
|
ebb439 |
+ table=11(ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(backends=10.0.0.3:80,20.0.0.3:80; hash_fields="ip_dst,ip_src,tcp_dst,tcp_src");)
|
|
|
ebb439 |
])
|
|
|
ebb439 |
|
|
|
ebb439 |
ovn-sbctl dump-flows lr0 | grep ct_lb | grep priority=120 > lflows.txt
|
|
|
ebb439 |
AT_CHECK([cat lflows.txt], [0], [dnl
|
|
|
ebb439 |
- table=6 (lr_in_dnat ), priority=120 , match=(ct.new && ip && ip4.dst == 10.0.0.10 && tcp && tcp.dst == 80 && is_chassis_resident("cr-lr0-public")), action=(ct_lb(backends=10.0.0.3:80,20.0.0.3:80);)
|
|
|
ebb439 |
+ table=6 (lr_in_dnat ), priority=120 , match=(ct.new && ip && ip4.dst == 10.0.0.10 && tcp && tcp.dst == 80 && is_chassis_resident("cr-lr0-public")), action=(ct_lb(backends=10.0.0.3:80,20.0.0.3:80; hash_fields="ip_dst,ip_src,tcp_dst,tcp_src");)
|
|
|
ebb439 |
])
|
|
|
ebb439 |
|
|
|
ebb439 |
# get the svc monitor mac.
|