[ovs-dev] [PATCH] rhel/systemd: Prevent deletion of runtime directory.

Guru Shetty guru at ovn.org
Fri Apr 13 21:26:44 UTC 2018


On 4 April 2018 at 08:13, Aaron Conole <aconole at redhat.com> wrote:

> Gurucharan Shetty <guru at ovn.org> writes:
>
> > Currently, when we do a 'service openvswitch stop',
> > '/var/run/openvswitch' gets deleted. This is a problem
> > if you have other users (like OVN) using the same
> > runtime directory since we delete all the files
> > related to ovsdb-server backing OVN's databases.
> >
> > This commit fixes it by removing the runtime directory
> > information from the systemd unit file.
> >
> > CC: aconole at redhat.com
> > Signed-off-by: Gurucharan Shetty <guru at ovn.org>
> > ---
> > I don't know whether there are other drawbacks of removing
> > 'RuntimeDirectory'
>
> Hi Guru,
>
> I noticed that if I use 'systemctl restart openvswitch' with the
> ovn-northd service running, I get the following output:
>
>   11:06:40 aconole {master} ~/git/ovs$ ls -lah /var/run/openvswitch/
>   total 24K
>   drwxr-xr-x.  2 openvswitch openvswitch  360 Apr  4 11:06 .
>   drwxr-xr-x. 44 root        root        1.3K Apr  4 11:06 ..
>   srwxr-x---.  1 openvswitch openvswitch    0 Apr  4 11:06 br0.mgmt
>   srwxr-x---.  1 openvswitch openvswitch    0 Apr  4 11:06 br0.snoop
>   srwxr-x---.  1 openvswitch openvswitch    0 Apr  4 11:06 db.sock
>   srwxr-x---.  1 root        root           0 Apr  4 11:06 ovnnb_db.ctl
>   -rw-r--r--.  1 root        root           6 Apr  4 11:06 ovnnb_db.pid
>   srwxr-x---.  1 root        root           0 Apr  4 11:06 ovnnb_db.sock
>   srwxr-x---.  1 root        root           0 Apr  4 11:06
> ovn-northd.30673.ctl
>   -rw-r--r--.  1 root        root           6 Apr  4 11:06 ovn-northd.pid
>   srwxr-x---.  1 root        root           0 Apr  4 11:06 ovnsb_db.ctl
>   -rw-r--r--.  1 root        root           6 Apr  4 11:06 ovnsb_db.pid
>   srwxr-x---.  1 root        root           0 Apr  4 11:06 ovnsb_db.sock
>   srwxr-x---.  1 openvswitch openvswitch    0 Apr  4 11:06
> ovsdb-server.30569.ctl
>   -rw-r--r--.  1 openvswitch openvswitch    6 Apr  4 11:06 ovsdb-server.pid
>   srwxr-x---.  1 openvswitch openvswitch    0 Apr  4 11:06
> ovs-vswitchd.30612.ctl
>   -rw-r--r--.  1 openvswitch openvswitch    6 Apr  4 11:06 ovs-vswitchd.pid
>   -rw-r--r--.  1 root        root          43 Apr  4 11:06 useropts
>   11:06:47 aconole {master} ~/git/ovs$ ps aux | grep ovn-northd\
>   root     30673  0.0  0.0  27544  2952 ?        S<   11:06   0:00
> ovn-northd -vconsole:emer -vsyslog:err -vfile:info --ovnnb-db=unix:/run/openvswitch/ovnnb_db.sock
> --ovnsb-db=unix:/run/openvswitch/ovnsb_db.sock --no-chdir
> --log-file=/var/log/openvswitch/ovn-northd.log --pidfile=/run/openvswitch/ovn-northd.pid
> --detach --monitor
>   aconole  30730  0.0  0.0 119532  1048 pts/0    S+   11:07   0:00 grep
> --color=auto northd
>   11:09:22 aconole {master} ~/git/ovs$ sudo systemctl restart
> openvswitch.service 11:09:24 aconole {master} ~/git/ovs$ ls -lah
> /var/run/openvswitch/
>   total 24K
>   drwxr-xr-x.  2 openvswitch openvswitch  360 Apr  4 11:09 .
>   drwxr-xr-x. 44 root        root        1.3K Apr  4 11:09 ..
>   srwxr-x---.  1 openvswitch openvswitch    0 Apr  4 11:09 br0.mgmt
>   srwxr-x---.  1 openvswitch openvswitch    0 Apr  4 11:09 br0.snoop
>   srwxr-x---.  1 openvswitch openvswitch    0 Apr  4 11:09 db.sock
>   srwxr-x---.  1 root        root           0 Apr  4 11:09 ovnnb_db.ctl
>   -rw-r--r--.  1 root        root           6 Apr  4 11:09 ovnnb_db.pid
>   srwxr-x---.  1 root        root           0 Apr  4 11:09 ovnnb_db.sock
>   srwxr-x---.  1 root        root           0 Apr  4 11:09
> ovn-northd.31264.ctl
>   -rw-r--r--.  1 root        root           6 Apr  4 11:09 ovn-northd.pid
>   srwxr-x---.  1 root        root           0 Apr  4 11:09 ovnsb_db.ctl
>   -rw-r--r--.  1 root        root           6 Apr  4 11:09 ovnsb_db.pid
>   srwxr-x---.  1 root        root           0 Apr  4 11:09 ovnsb_db.sock
>   srwxr-x---.  1 openvswitch openvswitch    0 Apr  4 11:09
> ovsdb-server.31160.ctl
>   -rw-r--r--.  1 openvswitch openvswitch    6 Apr  4 11:09 ovsdb-server.pid
>   srwxr-x---.  1 openvswitch openvswitch    0 Apr  4 11:09
> ovs-vswitchd.31203.ctl
>   -rw-r--r--.  1 openvswitch openvswitch    6 Apr  4 11:09 ovs-vswitchd.pid
>   -rw-r--r--.  1 root        root          43 Apr  4 11:09 useropts
>
> This looks like both the ovn-northd and openvswitch services are
> restarting in concert (which is what I'd expect to happen due to the
> "Requires=" and "After=" stanzas).
>
> Is there a set of reproduction steps that helps demonstrates the issue?
>
> NOTE: I used 'sudo systemctl start ovn-northd' to start the northd
> service.  Also note, this behavior seems to happen regardless of
> "RuntimeDirectory" setting.
>

In my case, I was using debian packages built by a university in newzealand
- https://packages.wand.net.nz/
They seem to have copied over the rhel systemd file over - but only for OVS
(not for OVN) and hence the difference.

Nevertheless, it looks like a big hammer to restart ovn-northd too when you
restart OVS. Thoughts?


> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>


More information about the dev mailing list