[ovs-dev] [PATCH ovn] Fix an issue with may-exist flag for lr_nat_add

Aniket Bhat anbhat at redhat.com
Fri Aug 7 16:11:56 UTC 2020


This commit fixes a case where may-exist flag was not honored.
When the nat type and logical ip both match for snat, but the
external_ip is not the same, the may-exist flag was being ignored.

Signed-off-by: Aniket Bhat <anbhat at redhat.com>
---
 utilities/ovn-nbctl.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/utilities/ovn-nbctl.c b/utilities/ovn-nbctl.c
index e6d8dbe..8194414 100644
--- a/utilities/ovn-nbctl.c
+++ b/utilities/ovn-nbctl.c
@@ -4295,11 +4295,13 @@ nbctl_lr_nat_add(struct ctl_context *ctx)
                             should_return = true;
                         }
                 } else {
-                    ctl_error(ctx, "a NAT with this type (%s) and %s (%s) "
-                              "already exists",
-                              nat_type,
-                              is_snat ? "logical_ip" : "external_ip",
-                              is_snat ? new_logical_ip : new_external_ip);
+                    if (!may_exist) {
+                        ctl_error(ctx, "a NAT with this type (%s) and %s (%s) "
+                                  "already exists",
+                                  nat_type,
+                                  is_snat ? "logical_ip" : "external_ip",
+                                  is_snat ? new_logical_ip : new_external_ip);
+                    }
                     should_return = true;
                 }
             }
-- 
2.9.5



More information about the dev mailing list