Comment 9 for bug 1910209

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

openvswitch-switch consists of three services actually:

openvswitch-switch.service (top level)
  -> ovsdb-server.service
    -> ovs-vswitchd.service

Of those the start/stop/restart of ovsdb-server.service is the one creating/removing the directory of /var/run/openvswitch/. The latter ovs-vswitchd.service then re-uses that directory.

The path is created due to /lib/systemd/system/ovsdb-server.service:
RuntimeDirectory=openvswitch
RuntimeDirectoryMode=0755

Acoording to [1] that will be "In case of RuntimeDirectory= the innermost subdirectories are removed when the unit is stopped. It is possible to preserve the specified directories in this case if RuntimeDirectoryPreserve= is configured to restart or yes (see below)"

So the behavior atm is exactly as configured.

The service files are "ours" (= packaging). Upstream only has rhel service files and those do not dynamically add/remove the path. Instead I've even seen discussions [2] saying about RuntimeDirectoryPreserve "We need to have this either as 'yes', or 'restart' - OVN daemons depend on this directory persisting even when the OVS daemons go away."

We can add a change via:
$ sudo systemctl edit ovsdb-server.service
[Service]
RuntimeDirectoryPreserve=yes

That will keep the directory alive and avoid the issue.
@Yi - for now that could be your solution as it would avoid having you to reconfigure (potentially many) other places.

Packaging wise that would be as easy as [3]

But I'm unsure if there is intention in removing this directory - e.g. to get the DB state cleaned and re-initialized for sure. I'd leave that up to James/Frode who have looked more at OVS. Based on their decision we can try to make this statement part of the default config (or not).
Subscribing James/Frode here on the bug and on the MP to carry on from here.

[1]: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
[2]: https://github.com/openvswitch/ovs/pull/247/files#r208172722
[3]: https://code.launchpad.net/~paelzer/ubuntu/+source/openvswitch/+git/openvswitch/+merge/395882