2014-01-09 01:04:33 -02:00
|
|
|
[Unit]
|
2016-07-25 14:03:53 -04:00
|
|
|
Description=Open vSwitch Database Unit
|
2016-10-07 13:36:45 -04:00
|
|
|
After=syslog.target network-pre.target
|
|
|
|
Before=network.target network.service
|
2017-09-13 09:35:34 +02:00
|
|
|
Wants=ovs-delete-transient-ports.service
|
2014-01-09 01:04:33 -02:00
|
|
|
PartOf=openvswitch.service
|
|
|
|
|
|
|
|
[Service]
|
2016-07-25 14:03:53 -04:00
|
|
|
Type=forking
|
2021-05-12 17:08:08 +02:00
|
|
|
PIDFile=/run/openvswitch/ovsdb-server.pid
|
rhel-systemd: Restart openvswitch service if a daemon crashes
Currently if either ovsdb-server or ovs-vswitchd is crashing the
daemon is not restarting leaving the system in faulty state.
This patch will detect the daemon crash and will restart the
openvswitch service.
Here is a (bit to wide) table showing the behavior before and after
the patch. Note that only the Crash behavior has changed:
Before patch:
| Process Status | systemctl <> status |
| ovs-vswitchd | ovsdb-server | openvswitch | ovs-vswitchd | ovsdb-server |
+--------------+--------------+--------------+--------------+--------------+
systemctl start openvswitch* | started | started |active,exited |active,running|active,running|
Crash vswitchd | crashed | stopped |inactive, dead|failed |inactive,dead |
Crash ovsdb | stopped | crashed |inactive, dead|inactive,dead |failed |
systemctl restart openvswitch | re-started | re-started |active,exited |active,running|active,running|
systemctl restart ovs-vswitchd | re-started | re-started |active,exited |active,running|active,running|
systemctl restart ovsdb-server | re-started | re-started |active,exited |active,running|active,running|
systemctl stop openvswitch | stopped | stopped |inactive, dead|inactive,dead |inactive,dead |
systemctl stop ovs-vswitchd | stopped | stopped |inactive, dead|inactive,dead |inactive,dead |
systemctl stop ovsdb-server | stopped | stopped |inactive, dead|inactive,dead |inactive,dead |
systemctl start ovs-vswitchd* | started | started |inactive, dead|active,running|active,running|
systemctl start ovsdb-server* | not started | started |inactive, dead|inactive, dead|active,running|
With patch:
| Process Status | systemctk <> status |
| ovs-vswitchd | ovsdb-server | openvswitch | ovs-vswitchd | ovsdb-server |
+--------------+--------------+--------------+--------------+--------------+
systemctl start openvswitch* | started | started |active,exited |active,running|active,running|
Crash vswitchd | crash,started| re-started |active,exited |active,running|active,running|
Crash ovsdb | re-started | crash,started|active,exited |active,running|active,running|
systemctl restart openvswitch | re-started | re-started |active,exited |active,running|active,running|
systemctl restart ovs-vswitchd | re-started | re-started |active,exited |active,running|active,running|
systemctl restart ovsdb-server | re-started | re-started |active,exited |active,running|active,running|
systemctl stop openvswitch | stopped | stopped |inactive, dead|inactive,dead |inactive,dead |
systemctl stop ovs-vswitchd | stopped | stopped |inactive, dead|inactive,dead |inactive,dead |
systemctl stop ovsdb-server | stopped | stopped |inactive, dead|inactive,dead |inactive,dead |
systemctl start ovs-vswitchd* | started | started |inactive, dead|active,running|active,running|
systemctl start ovsdb-server* | not started | started |inactive, dead|inactive, dead|active,running|
* These commands where executed when no ovs related processes where
running. All other commands where executed when OVS was successfully
running.
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Markos Chandras <mchandras@suse.de>
Acked-by: Aaron Conole <aconole@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Russell Bryant <russell@ovn.org>
2017-02-27 15:56:41 -05:00
|
|
|
Restart=on-failure
|
2017-08-04 13:00:53 -04:00
|
|
|
EnvironmentFile=/etc/openvswitch/default.conf
|
2014-01-09 01:04:33 -02:00
|
|
|
EnvironmentFile=-/etc/sysconfig/openvswitch
|
2020-05-12 18:38:20 +02:00
|
|
|
EnvironmentFile=-/run/openvswitch.useropts
|
|
|
|
|
|
|
|
# Environment is reloaded for each Exec*, make sure to
|
|
|
|
# remove openvswitch.useropts first to reload a fresh
|
|
|
|
# OVS_USER_ID from default.conf or sysconfig.
|
|
|
|
ExecStartPre=/usr/bin/rm -f /run/openvswitch.useropts
|
|
|
|
|
2021-05-12 17:08:08 +02:00
|
|
|
ExecStartPre=-/usr/bin/chown ${OVS_USER_ID} /run/openvswitch /var/log/openvswitch
|
2020-05-12 18:38:20 +02:00
|
|
|
ExecStartPre=/bin/sh -c '/usr/bin/echo "OVS_USER_ID=${OVS_USER_ID}" > /run/openvswitch.useropts'
|
2019-05-08 13:53:48 +02:00
|
|
|
ExecStartPre=/bin/sh -c 'if [ "$${OVS_USER_ID/:*/}" != "root" ]; then /usr/bin/echo "OVS_USER_OPT=--ovs-user=${OVS_USER_ID}" >> /run/openvswitch.useropts; fi'
|
2016-07-25 14:03:53 -04:00
|
|
|
ExecStart=/usr/share/openvswitch/scripts/ovs-ctl \
|
|
|
|
--no-ovs-vswitchd --no-monitor --system-id=random \
|
2019-05-08 13:53:48 +02:00
|
|
|
${OVS_USER_OPT} \
|
2016-07-25 14:03:53 -04:00
|
|
|
start $OPTIONS
|
|
|
|
ExecStop=/usr/share/openvswitch/scripts/ovs-ctl --no-ovs-vswitchd stop
|
|
|
|
ExecReload=/usr/share/openvswitch/scripts/ovs-ctl --no-ovs-vswitchd \
|
2019-05-08 13:53:48 +02:00
|
|
|
${OVS_USER_OPT} \
|
2016-07-25 14:03:53 -04:00
|
|
|
--no-monitor restart $OPTIONS
|