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.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. RHEL 9 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]>
---
 rhel/usr_lib_systemd_system_ovs-vswitchd.service.in | 1 +
 rhel/usr_lib_systemd_system_ovsdb-server.service    | 1 +
 2 files changed, 2 insertions(+)

diff --git a/rhel/usr_lib_systemd_system_ovs-vswitchd.service.in 
b/rhel/usr_lib_systemd_system_ovs-vswitchd.service.in
index 28f6dfc54..cf80c144e 100644
--- a/rhel/usr_lib_systemd_system_ovs-vswitchd.service.in
+++ b/rhel/usr_lib_systemd_system_ovs-vswitchd.service.in
@@ -10,6 +10,7 @@ PartOf=openvswitch.service
 Type=forking
 PIDFile=/run/openvswitch/ovs-vswitchd.pid
 Restart=on-failure
+RestartMode=direct
 Environment=XDG_RUNTIME_DIR=/run/openvswitch
 EnvironmentFile=/etc/openvswitch/default.conf
 EnvironmentFile=-/etc/sysconfig/openvswitch
diff --git a/rhel/usr_lib_systemd_system_ovsdb-server.service 
b/rhel/usr_lib_systemd_system_ovsdb-server.service
index c6d5d4b52..c12269e0d 100644
--- a/rhel/usr_lib_systemd_system_ovsdb-server.service
+++ b/rhel/usr_lib_systemd_system_ovsdb-server.service
@@ -10,6 +10,7 @@ PartOf=openvswitch.service
 Type=forking
 PIDFile=/run/openvswitch/ovsdb-server.pid
 Restart=on-failure
+RestartMode=direct
 EnvironmentFile=/etc/openvswitch/default.conf
 EnvironmentFile=-/etc/sysconfig/openvswitch
 EnvironmentFile=-/run/openvswitch.useropts
-- 
2.54.0

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

Reply via email to