fix #21745, preserve container connectivity when the bridge changes#22850
Conversation
|
👍 on the approach. I think something along these lines is the only viable solution. @volth I also did not test it yet, but the code definitely fixes your first issue. Regarding the second, I'm not sure if the unit will be restarted or reloaded in that case. We could also move @kampfschlaefer's code from reload to postStop and save all interfaces not part of the previous nixos config. When the unit is started again, those interfaces should be added along with the configured ones. |
|
Ok, as we didn't get any other feedback and I did some testing, I think we will go with this approach. It's a bit sad that this won't work when changing the status of RSTP, but documenting this fact will suffice IMHO. |
|
Actually, once you have one bridge with stp enabled, changing the stp state on the other interfaces should not be a problem anymore. Because then the rstp daemon is already running and all is well. |
And adopt the tests to add an interface and remove it again. It should work when deactivating rstp, it will not work when activating rstp for the first bridge as then the userspace daemon is not yet available. But once one bridge is active with stp, it should work with the reload for any further bridge. Fixes NixOS#21745. Also see NixOS#22547.
8e21c99 to
6872995
Compare
|
Thanks! |
Motivation for this change
When a container has interfaces added to bridges on the host, there are changes to the host where the interface is removed from the bridge during switch-to-configuration as the bridge is stopped and restarted.
This tries to make the bridge only reload and preserve as much as possible.
I don't yet like the file in /run/.interfaces to remember which interfaces to remove when reloading. But we have to save this somewhere and not just remove all interfaces and re-add them as that would add removed devices. And we can't remove all enslaved devices and only add those configured as that would drop all containers from the bridge…
Things done
(nix.useSandbox on NixOS,
or option
build-use-sandboxinnix.confon non-NixOS)
nix-shell -p nox --run "nox-review wip"./result/bin/)