Subject: Re: [alpine-aports] [PATCH] main/openvswitch: fix ifupdown script

From: Natanael Copa <[email-masked]>
Date: Tue, 25 Aug 2015 09:47:47 +0200

On Mon, 17 Aug 2015 22:39:22 +0000
Stuart Cardall <[email-masked]> wrote:

> --- a/main/openvswitch/ifupdown.sh
> +++ b/main/openvswitch/ifupdown.sh
> @@ -29,7 +29,9 @@ if (ovs_vsctl --version) > /dev/null 2>&1; then :; else
>      exit 0
>  fi
>  
> -if /etc/init.d/ovs-vswitchd status > /dev/null 2>&1; then :; else
> +if ! /etc/init.d/ovs-vswitchd status &>/dev/null; then
> +    /etc/init.d/ovs-modules start
> +    /etc/init.d/ovsdb-server start
>      /etc/init.d/ovs-vswitchd start
>  fi
>  

Why don't we add ovsdb-server and ovs-modules as dependencies for ovs-vswitchd?

If it is not a hard dependency (but a configurable, soft dependency),
then maybe the /etc/conf.d/ovs-vswitchd should have:

  rc_depend="ovs-modules ovsdb-server"

I think hardcoding it in the ifupdown.sh script is wrong in case the
dependencies for the ovs-vswitchd service changes in future version.

-nc

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: IT Developer <[email-masked]>
Date: Wed, 26 Aug 2015 00:07:08 +0100

Adding rc_depends to /etc/conf.d/ovs-vswitchd did not start the depends.

Starting init scripts from within a shell script does not start the
depends so I revised the ifupdown script to loop through:

DEPENDS=$(/lib/rc/bin/rc-depend -t ineed -qq ovs-vswitchd)

2 new ovs patches sent a little earlier.

Stuart.

---

From: Natanael Copa <[email-masked]>
Date: Wed, 2 Sep 2015 15:38:08 +0200

On Wed, 26 Aug 2015 00:07:08 +0100
IT Developer <[email-masked]> wrote:

> depends 

How was the script started? via a manual "ifup something" of pulled in
from the networking service?

> so I revised the ifupdown script to loop through:
> 

I still don't like this.

Questions:

- Are there any situation that ovs-vswitchd may run without that
  ovsdb-server runs? eg can you run ovsdb-server on a remove host? can
  you run a ovs-vswitchd configuration without ovsdb-server?

- If both ovsdb-server and ovs-vswitchd serivce are running, and you
  stop or restart the ovsdb-server service. What should happen? should
  ovs-vswitchd also stop/restart?

When it comes to the ovs-modules service, it is fully possible to
configure your system so that you load kernel module vi /etc/modules so
you technically dont need the ovs-modules serivce (I suppose). If that
is the case, then I don't start it in a hardcoded script.

What i think is:
if you have marked ovs-vswitchd service to autostart at boot and also
marked networking service to autostart, then should the openrc
dependency handling make sure that ovsd-vswitchd is started before
networking. (ovs-vswitchd should have an rc_before="networking")

If there are any valid (theoretical) situations where you need to start
networking service before you start ovs-vswitchd (maybe ovsdb-server is
on a remote host?), then we cannot hardcode it and the start order
needs to be a part of configuration (eg /etc/conf.d)

The only time the ovs-vswitchd service may be started from the
ifupdown.sh script is when "networking" is not started, and you do
"ifup ovsbr0" or similar, but then should the dependencies for the
ovs-vswitchd be pulled in by openrc, not by the ifupdown.sh script.

-nc

---