ovn-ic generates a lot of logs unnecessarily.
"Route sync ignores port %s on ts %s for router"
 %s because the addresses are invalid."

Signed-off-by: Lucas Vargas Dias <[email protected]>
---
 ic/ovn-ic.c     |  4 ++++
 tests/ovn-ic.at | 28 ++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c
index fd20c73be..f7cc41748 100644
--- a/ic/ovn-ic.c
+++ b/ic/ovn-ic.c
@@ -2952,6 +2952,10 @@ collect_lr_routes(struct ic_context *ctx,
             shash_add(routes_ad_by_ts, ts_name, routes_ad);
         }
 
+        if (!lrouter_is_enabled(ic_lr->lr)) {
+            continue;
+        }
+
         if (!extract_lsp_addresses(isb_pb->address, &ts_port_addrs)) {
             static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1);
             VLOG_INFO_RL(&rl, "Route sync ignores port %s on ts %s for router"
diff --git a/tests/ovn-ic.at b/tests/ovn-ic.at
index d884de282..1435a19a3 100644
--- a/tests/ovn-ic.at
+++ b/tests/ovn-ic.at
@@ -1185,6 +1185,34 @@ AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep 
-c learned], [0], [dnl
 1
 ])
 
+# Disable lr1.  Route collection must be skipped for it, so AZ1 stops
+# advertising lr1's routes and both AZs drop what they learned through it.
+# The skip must happen before the TS port addresses are parsed, so no
+# "addresses are invalid" message may be logged for the disabled router.
+n_addr_log=$(grep -c "Route sync ignores port" az1/ic/ovn-ic.log || :)
+check ovn_as az1 ovn-nbctl set logical_router lr1 enabled=false
+check ovn-ic-nbctl --wait=sb sync
+check ovn-ic-nbctl --wait=sb sync
+wait_row_count ic-sb:Route 0 ip_prefix=10.11.1.0/24
+OVS_WAIT_WHILE([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned])
+OVS_WAIT_WHILE([ovn_as az1 ovn-nbctl lr-route-list lr1 | grep learned])
+AT_CHECK([test "$(grep -c "Route sync ignores port" az1/ic/ovn-ic.log || :)" \
+          = "$n_addr_log"])
+AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr1], [0], [dnl
+IPv4 Routes
+Route Table <main>:
+             10.11.1.0/24               169.254.0.1 dst-ip
+             10.22.1.0/24               169.254.0.2 src-ip
+])
+
+# Re-enable lr1, advertising and learning should resume.
+check ovn_as az1 ovn-nbctl set logical_router lr1 enabled=true
+check ovn-ic-nbctl --wait=sb sync
+check ovn-ic-nbctl --wait=sb sync
+wait_row_count ic-sb:Route 1 ip_prefix=10.11.1.0/24
+OVS_WAIT_UNTIL([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 
10.11.1.0])
+OVS_WAIT_UNTIL([ovn_as az1 ovn-nbctl lr-route-list lr1 | grep learned | grep 
10.11.2.0])
+
 # Disable route-learning for AZ1
 ovn_as az1 ovn-nbctl set nb_global . options:ic-route-learn=false
 ovn-ic-nbctl --wait=sb sync
-- 
2.43.0


-- 




_'Esta mensagem é direcionada apenas para os endereços constantes no 
cabeçalho inicial. Se você não está listado nos endereços constantes no 
cabeçalho, pedimos-lhe que desconsidere completamente o conteúdo dessa 
mensagem e cuja cópia, encaminhamento e/ou execução das ações citadas estão 
imediatamente anuladas e proibidas'._


* **'Apesar do Magazine Luiza tomar 
todas as precauções razoáveis para assegurar que nenhum vírus esteja 
presente nesse e-mail, a empresa não poderá aceitar a responsabilidade por 
quaisquer perdas ou danos causados por esse e-mail ou por seus anexos'.*



_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to