Message ID | fdb9df310c76168f7813a1c75dd3ad26bb531da6.1620849904.git.lorenzo.bianconi@redhat.com |
---|---|
State | Accepted |
Headers | show |
Series | [ovs-dev] ovn-nbctl: do not report an error for duplicated ecmp routes with --may-exist | expand |
On Wed, May 12, 2021 at 1:06 PM Lorenzo Bianconi < lorenzo.bianconi@redhat.com> wrote: > > Do not report an error adding a duplicated ecmp route if --may-exist > parameter is provided. > Related bz: https://bugzilla.redhat.com/show_bug.cgi?id=1959909 > > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> > --- > tests/ovn-nbctl.at | 2 ++ > utilities/ovn-nbctl.c | 4 +++- > 2 files changed, 5 insertions(+), 1 deletion(-) > > diff --git a/tests/ovn-nbctl.at b/tests/ovn-nbctl.at > index 6d91aa4c5..8af55161f 100644 > --- a/tests/ovn-nbctl.at > +++ b/tests/ovn-nbctl.at > @@ -1551,6 +1551,7 @@ IPv4 Routes > AT_CHECK([ovn-nbctl --ecmp lr-route-add lr0 10.0.0.0/24 11.0.0.2], [1], [], > [ovn-nbctl: duplicate nexthop for the same ECMP route > ]) > +AT_CHECK([ovn-nbctl --may-exist --ecmp lr-route-add lr0 10.0.0.0/24 11.0.0.2]) > > dnl Delete ecmp routes > AT_CHECK([ovn-nbctl lr-route-del lr0 10.0.0.0/24 11.0.0.1]) > @@ -1614,6 +1615,7 @@ AT_CHECK([ovn-nbctl --ecmp-symmetric-reply lr-route-add lr0 2003:0db8:1::/64 200 > AT_CHECK([ovn-nbctl --ecmp-symmetric-reply lr-route-add lr0 2003:0db8:1::/64 2001:0db8:0:f103::6], [1], [], > [ovn-nbctl: duplicate nexthop for the same ECMP route > ]) > +AT_CHECK([ovn-nbctl --may-exist --ecmp-symmetric-reply lr-route-add lr0 2003:0db8:1::/64 2001:0db8:0:f103::6]) > > AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl > IPv4 Routes > diff --git a/utilities/ovn-nbctl.c b/utilities/ovn-nbctl.c > index 48fd0b7ee..84e228f02 100644 > --- a/utilities/ovn-nbctl.c > +++ b/utilities/ovn-nbctl.c > @@ -4073,7 +4073,9 @@ nbctl_lr_route_add(struct ctl_context *ctx) > goto cleanup; > } > } else if (route) { > - ctl_error(ctx, "duplicate nexthop for the same ECMP route"); > + if (!may_exist) { > + ctl_error(ctx, "duplicate nexthop for the same ECMP route"); > + } > goto cleanup; > } > Thanks Lorenzo. I applied it to master branch. Let me know if backport is needed. > -- > 2.31.1 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
diff --git a/tests/ovn-nbctl.at b/tests/ovn-nbctl.at index 6d91aa4c5..8af55161f 100644 --- a/tests/ovn-nbctl.at +++ b/tests/ovn-nbctl.at @@ -1551,6 +1551,7 @@ IPv4 Routes AT_CHECK([ovn-nbctl --ecmp lr-route-add lr0 10.0.0.0/24 11.0.0.2], [1], [], [ovn-nbctl: duplicate nexthop for the same ECMP route ]) +AT_CHECK([ovn-nbctl --may-exist --ecmp lr-route-add lr0 10.0.0.0/24 11.0.0.2]) dnl Delete ecmp routes AT_CHECK([ovn-nbctl lr-route-del lr0 10.0.0.0/24 11.0.0.1]) @@ -1614,6 +1615,7 @@ AT_CHECK([ovn-nbctl --ecmp-symmetric-reply lr-route-add lr0 2003:0db8:1::/64 200 AT_CHECK([ovn-nbctl --ecmp-symmetric-reply lr-route-add lr0 2003:0db8:1::/64 2001:0db8:0:f103::6], [1], [], [ovn-nbctl: duplicate nexthop for the same ECMP route ]) +AT_CHECK([ovn-nbctl --may-exist --ecmp-symmetric-reply lr-route-add lr0 2003:0db8:1::/64 2001:0db8:0:f103::6]) AT_CHECK([ovn-nbctl lr-route-list lr0], [0], [dnl IPv4 Routes diff --git a/utilities/ovn-nbctl.c b/utilities/ovn-nbctl.c index 48fd0b7ee..84e228f02 100644 --- a/utilities/ovn-nbctl.c +++ b/utilities/ovn-nbctl.c @@ -4073,7 +4073,9 @@ nbctl_lr_route_add(struct ctl_context *ctx) goto cleanup; } } else if (route) { - ctl_error(ctx, "duplicate nexthop for the same ECMP route"); + if (!may_exist) { + ctl_error(ctx, "duplicate nexthop for the same ECMP route"); + } goto cleanup; }
Do not report an error adding a duplicated ecmp route if --may-exist parameter is provided. Related bz: https://bugzilla.redhat.com/show_bug.cgi?id=1959909 Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> --- tests/ovn-nbctl.at | 2 ++ utilities/ovn-nbctl.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-)