diff mbox series

[ovs-dev,2/2] ovn-ctl: Make sure OVN_RUNDIR is created for central nodes.

Message ID 1553209591-121446-2-git-send-email-hzhou8@ebay.com
State Accepted
Headers show
Series [ovs-dev,1/2] ovn-ctl: Unify OVN_RUNDIR usage. | expand

Commit Message

Han Zhou March 21, 2019, 11:06 p.m. UTC
From: Han Zhou <hzhou8@ebay.com>

When ovn-ctl tries to start ovsdb, it didn't ensure the rundir
(e.g. /var/run/openvswitch) exist, because it is not calling
start_daemon(). Usually, if OVS is started by ovs-ctl before
on the same node, the folder is created already. However, for
OVN central node, OVS is usually not needed. If the folder is
not created (it is common case when system restarted because
/var/run is usually tmpfs), ovn-ctl will fail to start ovsdb.
This patch always ensures the OVN_RUNDIR is created.

Signed-off-by: Han Zhou <hzhou8@ebay.com>
---
 ovn/utilities/ovn-ctl | 1 +
 1 file changed, 1 insertion(+)

Comments

Ben Pfaff March 22, 2019, 9:50 p.m. UTC | #1
On Thu, Mar 21, 2019 at 04:06:31PM -0700, Han Zhou wrote:
> From: Han Zhou <hzhou8@ebay.com>
> 
> When ovn-ctl tries to start ovsdb, it didn't ensure the rundir
> (e.g. /var/run/openvswitch) exist, because it is not calling
> start_daemon(). Usually, if OVS is started by ovs-ctl before
> on the same node, the folder is created already. However, for
> OVN central node, OVS is usually not needed. If the folder is
> not created (it is common case when system restarted because
> /var/run is usually tmpfs), ovn-ctl will fail to start ovsdb.
> This patch always ensures the OVN_RUNDIR is created.
> 
> Signed-off-by: Han Zhou <hzhou8@ebay.com>

Thank you.  I applied this series to master.
Han Zhou March 28, 2019, 6:07 p.m. UTC | #2
On Fri, Mar 22, 2019 at 2:50 PM Ben Pfaff <blp@ovn.org> wrote:
>
> On Thu, Mar 21, 2019 at 04:06:31PM -0700, Han Zhou wrote:
> > From: Han Zhou <hzhou8@ebay.com>
> >
> > When ovn-ctl tries to start ovsdb, it didn't ensure the rundir
> > (e.g. /var/run/openvswitch) exist, because it is not calling
> > start_daemon(). Usually, if OVS is started by ovs-ctl before
> > on the same node, the folder is created already. However, for
> > OVN central node, OVS is usually not needed. If the folder is
> > not created (it is common case when system restarted because
> > /var/run is usually tmpfs), ovn-ctl will fail to start ovsdb.
> > This patch always ensures the OVN_RUNDIR is created.
> >
> > Signed-off-by: Han Zhou <hzhou8@ebay.com>
>
> Thank you.  I applied this series to master.

Thanks Ben, it is better to backport this series to at least 2.10
onwards, since it impacts failure recovery of OVN (e.g. node restart),
especially OVN active-standby HA (services managed by pacemaker -
openvswitch-switch service disabled on central node).
diff mbox series

Patch

diff --git a/ovn/utilities/ovn-ctl b/ovn/utilities/ovn-ctl
index 83f026e..cca5fac 100755
--- a/ovn/utilities/ovn-ctl
+++ b/ovn/utilities/ovn-ctl
@@ -144,6 +144,7 @@  start_ovsdb__() {
     eval ovn_db_ssl_cert=\$OVN_${DB}_DB_SSL_CERT
     eval ovn_db_ssl_cacert=\$OVN_${DB}_DB_SSL_CA_CERT
 
+    install_dir "$OVN_RUNDIR"
     # Check and eventually start ovsdb-server for DB
     if pidfile_is_running $db_pid_file; then
         return