Add check to see if the LR actually has NAT entries configured.
Otherwise we spam the log unnecessarily.
Fixes: b8194738c99e ("northd: Properly warn for NAT on LR with multiple gw
ports.")
Signed-off-by: Dumitru Ceara <[email protected]>
---
northd/northd.c | 2 +-
tests/ovn-northd.at | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/northd/northd.c b/northd/northd.c
index a2cf8d6fc7..87d9b2867a 100644
--- a/northd/northd.c
+++ b/northd/northd.c
@@ -13242,7 +13242,7 @@ build_lrouter_nat_defrag_and_lb(struct ovn_datapath
*od, struct hmap *lflows,
/* NAT rules are not currently supported on logical routers with multiple
* distributed gateway ports. */
- if (od->n_l3dgw_ports > 1) {
+ if (od->nbr->n_nat && od->n_l3dgw_ports > 1) {
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
VLOG_WARN_RL(&rl, "NAT is configured on logical router %s, which has %"
PRIuSIZE" distributed gateway ports. NAT is not supported"
diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
index 17d4f31b39..4883360c97 100644
--- a/tests/ovn-northd.at
+++ b/tests/ovn-northd.at
@@ -5807,8 +5807,8 @@ AT_CHECK([grep lr_in_gw_redirect lrflows | grep cr-DR |
sed 's/table=../table=??
# Check that ovn-northd logs a warning when trying to configure NAT
# on the router with multiple distributed gw ports. Such configurations are
# not supported yet.
-check ovn-nbctl lr-nat-add DR dnat_and_snat 42.42.42.1 20.0.0.2
-AT_CHECK([grep -q 'NAT is configured on logical router DR, which has 2
distributed gateway ports. NAT is not supported yet when there is more than one
distributed gateway port on the router.' northd/ovn-northd.log], [0])
+check ovn-nbctl --wait=sb lr-nat-add DR dnat_and_snat 42.42.42.1 20.0.0.2
+AT_CHECK([grep -q 'NAT is configured on logical router DR, which has 3
distributed gateway ports. NAT is not supported yet when there is more than one
distributed gateway port on the router.' northd/ovn-northd.log], [0])
AT_CLEANUP
])
--
2.27.0
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev