nixos/switch-to-configuration: Document and test handling of socket-activated services#161838
Conversation
|
@ofborg test switchTest |
|
Also cc @aanderse to remind people that you want the script rewritten ;) |
roberth
left a comment
There was a problem hiding this comment.
Found a flaw 😢 This will break services where ExecStop relies on still having the old etc.
I'm not confident that this can be fixed without fixing systemd or mutating the old units. We really need to inhibit the old service start; otherwise it seems we'll have to introduce new corner cases.
nixos/tests/switch-test.nix
Outdated
There was a problem hiding this comment.
This switches from a non-ExecStop service to an ExecStop one, so it doesn't need to stop the socket yet, but does need to do so on the next switch, even when ExecStop is removed.
There was a problem hiding this comment.
This means that despite stopIfChanged being enabled, the old service will run until after etc has been switched.
I don't think that's acceptable.
|
@roberth thank you for reviewing the change. Do you have an alternative suggestion I can implement? If we don't come to an agreement I can redo this PR to only clean the code, add test cases, and add docs to at least have the current behavior properly specified and tested. |
79349fe to
df75fef
Compare
|
I removed most of the logic after a longer discussion with Robert. We came to the conclusion that there was no way we can keep up with the race-free nature of the current behavior (please correct me if I got your points wrong). So this PR mostly adds test cases and proper docs for handling of socket-activated units and leaves the current logic intact. |
There was a problem hiding this comment.
why is this snake case when all the other variables are camel case?
There was a problem hiding this comment.
There was a problem hiding this comment.
makes sense, but what is unitsToReload?
There was a problem hiding this comment.
There is currently a mix between camel case (not yet refactored) and snake case (already refactored)
nixos/tests/switch-test.nix
Outdated
There was a problem hiding this comment.
why not throw it out then?
There was a problem hiding this comment.
To make it clear that this check was left out explicitly and not just forgotten
nixos/tests/switch-test.nix
Outdated
There was a problem hiding this comment.
why aren't we stripping away the spaces from each out variable (or rather in the switch_to_specialisation function)? is it important to check the newline everywhere?
There was a problem hiding this comment.
Because restarting the following units and starting the following units must somehow be differentiated and using regex would be pretty expensive to run hundreds of times
There was a problem hiding this comment.
ah, i didn't know out was a string, thought it was an array, my bad
df75fef to
d56d805
Compare
|
If there are no more strong opinions, I'd merge this today or so. It's mostly docs and tests and doesn't touch the logic |
roberth
left a comment
There was a problem hiding this comment.
Just the suggestions from my comment just now. Lgtm!
d56d805 to
f6ad15f
Compare
Motivation for this change
More tests, more docs
The manual should explain what this is doing exactly.
Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)nixos/doc/manual/md-to-db.shto update generated release notes