Skip to content

Add retry for plumbing route entry#223

Merged
liwenwu-amazon merged 1 commit intoaws:masterfrom
liwenwu-amazon:bad-route
Nov 12, 2018
Merged

Add retry for plumbing route entry#223
liwenwu-amazon merged 1 commit intoaws:masterfrom
liwenwu-amazon:bad-route

Conversation

@liwenwu-amazon
Copy link
Copy Markdown
Contributor

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

retry, maxRetryRouteAdd)
time.Sleep(retryRouteAddInterval)
} else if isRouteExistsError(err) {
if err := netlink.RouteReplace(&r); err != nil {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this replace works, shouldn't we just break the loop and log a success?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!

if err := netlink.RouteReplace(&r); err != nil {
return errors.Wrapf(err, "eni network setup: unable to replace route entry %s", r.Dst.IP.String())
}
break
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a debug log as well? Something like
log.Debugf("Successfully replaced route to be %s/0", r.Dst.IP.String())

r.Dst.IP.String(), gw.IP.String(), eniTable)
}
} else {
log.Debugf("Successfully added route route %s/0 via %s table %d", r.Dst.IP.String(), gw.IP.String(), eniTable)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"route" is there twice.

Copy link
Copy Markdown
Contributor

@mogren mogren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fixes, LGTM!

@liwenwu-amazon liwenwu-amazon merged commit 15a69f2 into aws:master Nov 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants