-
Notifications
You must be signed in to change notification settings - Fork 908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cloudinit/net: handle two different routes for the same ip #1124
Conversation
@esposem , can you give me a little more context for this change? Why are you seeing the same route being added twice? How does using append fix it? Trying append twice still gives the same error for me:
This is in the Ephemeral IP network code, so if the route needed may already exist, does it make more sense to try the connectivity url instead? |
@TheRealFalcon , thanks for the review and questions. The context for this change comes from a specific configuration from customer.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this makes sense now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, shouldn't have hit that approve quite yet.
The change here looks good, but we still need an updated unit test as well. You should just be able to modify the currently failing one.
26ab47e
to
d4f6f33
Compare
Thank you @zhaohuijuan for the explanation, and @TheRealFalcon for the review! I updated the failing test case, and gave a better PR description according to Huijuan comments. |
If we set a dhcp server side like this: $ cat /var/tmp/cloud-init/cloud-init-dhcp-f0rie5tm/dhcp.leases lease { ... option classless-static-routes 31.169.254.169.254 0.0.0.0,31.169.254.169.254 10.112.143.127,22.10.112.140 0.0.0.0,0 10.112.140.1; ... } cloud-init fails to configure the routes via 'ip route add' because to there are two different routes for 169.254.169.254: $ ip -4 route add 192.168.1.1/32 via 0.0.0.0 dev eth0 $ ip -4 route add 192.168.1.1/32 via 10.112.140.248 dev eth0 But NetworkManager can handle such scenario successfully as it uses "ip route append". So change cloud-init to also use "ip route append" to fix the issue: $ ip -4 route append 192.168.1.1/32 via 0.0.0.0 dev eth0 $ ip -4 route append 192.168.1.1/32 via 10.112.140.248 dev eth0 Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
d4f6f33
to
d7f958c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM now, thanks! I pushed a rebase of main due to a dependency issue. I can merge once CI completes successfully.
Proposed Commit Message
Checklist: