switch-to-configuration-ng: Better handling of socket-activated units

Previously, if any unit had a socket associated with it, stc-ng
counted it as "socket-activated", meaning that the unit would get
stopped and the socket get restarted. That can wreak havoc on units
like systemd-udevd and systemd-networkd.

Instead, let units set the new flag notSocketActivated, which sets a
boolean on the unit indicating to stc-ng that the unit wants to be
treated like any other non-socket-activated unit instead. That will
stop/start or restart these units on upgrades, without unnecessarily
tearing down any machinery that the system needs to run.
This commit is contained in:
Andreas Fuchs 2024-11-27 21:06:35 -05:00
parent 5083ec8877
commit bf9c6c9861
5 changed files with 28 additions and 2 deletions

View file

@ -535,6 +535,18 @@ in rec {
'';
};
notSocketActivated = mkOption {
type = types.bool;
default = false;
description = ''
If set, a changed unit is never assumed to be
socket-activated on configuration activation, even if
it might have associated socket units. Instead, the unit
will be restarted (or stopped/started) as if it had no
associated sockets.
'';
};
startAt = mkOption {
type = with types; either str (listOf str);
default = [];