When ovsdb-server or ovs-vswitchd fails and auto-restarts
(Restart=on-failure), it briefly passes through the failed/inactive
state.  This causes a cascade: openvswitch-switch.service (which
Requires both) sees the failure and stops, which in turn stops the
other service via PartOf.  When the failed service comes back, the
other does not automatically restart.

RestartMode=direct (systemd v254+) makes the service transition
directly to the activating state during auto-restart, skipping the
failed/inactive state.  Dependents never see the failure, so the
cascade does not happen.

On older systemd versions (e.g. Debian 12 with systemd 252) the
directive is silently ignored with a harmless journal warning
("Unknown key name 'RestartMode'"), so this change is safe for
all supported platforms.

Signed-off-by: Timothy Redaelli <[email protected]>
---
 debian/openvswitch-switch.ovs-vswitchd.service | 1 +
 debian/openvswitch-switch.ovsdb-server.service | 1 +
 2 files changed, 2 insertions(+)

diff --git a/debian/openvswitch-switch.ovs-vswitchd.service 
b/debian/openvswitch-switch.ovs-vswitchd.service
index 6a624b39a..f47e55cb3 100644
--- a/debian/openvswitch-switch.ovs-vswitchd.service
+++ b/debian/openvswitch-switch.ovs-vswitchd.service
@@ -12,6 +12,7 @@ LimitNOFILE=1048576
 Type=forking
 PIDFile=/run/openvswitch/ovs-vswitchd.pid
 Restart=on-failure
+RestartMode=direct
 Environment=HOME=/var/run/openvswitch
 EnvironmentFile=-/etc/default/openvswitch-switch
 ExecStart=/usr/share/openvswitch/scripts/ovs-ctl \
diff --git a/debian/openvswitch-switch.ovsdb-server.service 
b/debian/openvswitch-switch.ovsdb-server.service
index 207478b7e..1b22f29ae 100644
--- a/debian/openvswitch-switch.ovsdb-server.service
+++ b/debian/openvswitch-switch.ovsdb-server.service
@@ -11,6 +11,7 @@ LimitNOFILE=1048576
 Type=forking
 PIDFile=/run/openvswitch/ovsdb-server.pid
 Restart=on-failure
+RestartMode=direct
 EnvironmentFile=-/etc/default/openvswitch-switch
 ExecStart=/usr/share/openvswitch/scripts/ovs-ctl \
           --no-ovs-vswitchd --no-monitor --system-id=random \
-- 
2.54.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to