-
Notifications
You must be signed in to change notification settings - Fork 224
Fix netplan try revert (LP: #2083029)
#548
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
Conversation
|
I opened this PR prematurely; the current changes do not fix the bug. I would mark this as a draft but I don't have permission to do so. Still working on this... |
36a7101 to
77f321f
Compare
|
This is ready for review. Test failures:
The integration tests pass when run manually in a VM/container (Noble, Oracular, Trixie). I was able to reproduce the Debian testing failure using autopkgtest locally. I ran the Ubuntu autopkgtests locally; they fail too but with an error message: I'm willing to continue chasing these but I'd appreciate a review of this PR to make sure that this is a reasonable set of fixes before I sink more time into the CI. Thanks! |
netplan try revert when using systemd-networkdnetplan try revert
|
@MggMuggins Thank you very much for your work on this. I retriggered some of the test cases that failed for odd reasons. The |
|
Yeah, this is definitely a bug in my tests; fixing these is my priority for this morning. Thanks for your patience. |
|
Tests are green. Also added a commit to fix debug logging of the merged config. |
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.
Thank you very much this contribution! This is an excellent analysis and test coverage. Much appreciated! It solves an important issue with netplan try.
I left some minor comments inline. Let me know what you think.
I think this might also solve https://bugs.launchpad.net/netplan/+bug/2027583
Signed-off-by: Wesley Hershberger <[email protected]>
194ca7b to
76ae3f6
Compare
Signed-off-by: Wesley Hershberger <[email protected]>
systemd-networkd will not read .netdev and .network files unless the group is set to 'systemd-network'. Fixes LP#2083029 Signed-off-by: Wesley Hershberger <[email protected]>
Signed-off-by: Wesley Hershberger <[email protected]>
Generate may be called by NetworkManager (via Dbus) in Ubuntu >23.10. While `netplan try` is waiting for revert, there is no situation where the generator should be called. Signed-off-by: Wesley Hershberger <[email protected]>
Read from the beginning of the file instead of the end. Signed-off-by: Wesley Hershberger <[email protected]>
|
Thanks for the review! Test failure should clear on a re-run. |
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.
Thank you very much for addressing my remarks. Test are now all green. I just pushed a little rename, as suggested by @MggMuggins (b87c3a5).
LGTM!
Description
Fixes LP#2083029
When using
systemd-networkdas a backend,netplan trybacks up/run/systemd/networkbefore applying the new configuration. If the user fails to confirm the new configuration before the timeout is up, Netplan restores the old configuration by moving the backup into/run/systemd/networkand invokesnetworkctl reloadto apply the known-good configuration.However,
networkdwill not/cannot read config files if their ownership is notroot:systemd-network.In effect,
netplan trydoes not revert network changes at all when usingnetworkd.Additionally, following the Ubuntu patches to NetworkManager in 23.10 (see netplan everywhere),
netplan generateis called (via DBus) when NetworkManager refreshes its config. This "reverts the revert" fromnetplan try, so restoring the old config doesn't work withNetworkManagerin Ubuntu >23.10 either.This PR adds an autopkg test for
netplan tryso as to catch these regressions before they are released.Implementation Notes
I took advantage of the stamp that exists when
netplan tryis running. There doesn't appear to me to be a way to prevent NetworkManager from calling generate on reload.I considered that this may be prone to races if NetworkManager takes its time reloading the configuration; however, it looks like
netplan trycallscommand_applywithsync=True, so it shouldn't delete the stamp until after NetworkManager has finished loading its config.Test Plan
Using the default netplan configuration in a LXD instance:
Replace the configuration with a static IP and run
netplan try --timeout 3, and allow the timeout to elapse.Before the fix in Jammy, the static IP remains assigned to
enp5s0after the revert. In Noble and later, the interface has the IPv4 removed, but a new dhcp lease is not acquired.networkctl status --allwill report the device asunmanaged. In Jammy:Checklist
make checksuccessfully.make check-coverage).New/changed keys in YAML format are documented.Adds example YAML for new feature.Test failures look like Launchpad having trouble.