Message ID | 1522358210-26103-1-git-send-email-guru@ovn.org |
---|---|
State | Changes Requested |
Headers | show |
Series | [ovs-dev] rhel/systemd: Prevent deletion of runtime directory. | expand |
Gurucharan Shetty <guru@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@redhat.com > Signed-off-by: Gurucharan Shetty <guru@ovn.org> > --- NOTE: https://mail.openvswitch.org/pipermail/ovs-dev/2018-March/345508.html I'm going to look into this more carefully. Two people submitting basically the same patch within the same week is probably not just a coincidence. -Aaron
Gurucharan Shetty <guru@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@redhat.com > Signed-off-by: Gurucharan Shetty <guru@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.
On 4 April 2018 at 08:13, Aaron Conole <aconole@redhat.com> wrote: > Gurucharan Shetty <guru@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@redhat.com > > Signed-off-by: Gurucharan Shetty <guru@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@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev >
Guru Shetty <guru@ovn.org> writes: > On 4 April 2018 at 08:13, Aaron Conole <aconole@redhat.com> wrote: > > Gurucharan Shetty <guru@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@redhat.com > > Signed-off-by: Gurucharan Shetty <guru@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? I agree. It is probably worth spending some time to get the dependencies correct between these in the systemd files. A quick guess would be northd should use the same runtimedir settings, and only have a Wants= line, instead of Requires= (if ovn-northd can tolerate a restart of ovsdb). > _______________________________________________ > dev mailing list > dev@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
diff --git a/rhel/usr_lib_systemd_system_ovsdb-server.service b/rhel/usr_lib_systemd_system_ovsdb-server.service index e05742d..5fac90b 100644 --- a/rhel/usr_lib_systemd_system_ovsdb-server.service +++ b/rhel/usr_lib_systemd_system_ovsdb-server.service @@ -21,5 +21,3 @@ ExecStop=/usr/share/openvswitch/scripts/ovs-ctl --no-ovs-vswitchd stop ExecReload=/usr/share/openvswitch/scripts/ovs-ctl --no-ovs-vswitchd \ ${OVSUSER} \ --no-monitor restart $OPTIONS -RuntimeDirectory=openvswitch -RuntimeDirectoryMode=0755
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@redhat.com Signed-off-by: Gurucharan Shetty <guru@ovn.org> --- I don't know whether there are other drawbacks of removing 'RuntimeDirectory' --- rhel/usr_lib_systemd_system_ovsdb-server.service | 2 -- 1 file changed, 2 deletions(-)