[Bug 1910209] Re: "systemctl stop openvswitch-switch" will remove /var/run/openvswitch

Christian Ehrhardt  1910209 at bugs.launchpad.net
Thu Jan 7 07:39:24 UTC 2021


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

-- 
You received this bug notification because you are a member of Ubuntu
OpenStack, which is subscribed to openvswitch in Ubuntu.
https://bugs.launchpad.net/bugs/1910209

Title:
  "systemctl stop openvswitch-switch" will remove /var/run/openvswitch

Status in Ubuntu Server Guide:
  Fix Released
Status in dpdk package in Ubuntu:
  Invalid
Status in openvswitch package in Ubuntu:
  Confirmed

Bug description:
  TL;DR:
  - stoping/restarting OVS clears /var/run/openvswitch
  - out of the "vhostuser" connection times a common socket path used
    was at /var/run/openvswitch
  - if that path used with "vhostuserclient" that removes the sockets
    on OVS stop/restart
  - Since qemu in server mode only creates this sockets once (as by
    the client/server design makes sense) that breaks the guests until
    restarted which is what the tech of vhostuserclient wanted to avoid.
  + Workaround: do use a different path like e.g. 
    "/var/run/vhostuserclient/vhost-user-client-1"
  + Solution: let us think if we could keep the path around on stop/restart

  --- vv original report vv ---

  My system is Ubuntu 18.04, I installed ovs DPDK by apt-get and used
  ovs-vswitchd DPDK version, but when I stop openvswitch-switch (sudo
  systemctl stop openvswitch-switch), /var/run/openvswitch is removed,
  so the exisitng VMs can't be accessed any more. I don't know why it is
  removed and who removed it.

To manage notifications about this bug go to:
https://bugs.launchpad.net/serverguide/+bug/1910209/+subscriptions



More information about the Ubuntu-openstack-bugs mailing list