openvswitch: only init bridges when (re)starting
authorStijn Tintel <stijn@linux-ipv6.be>
Tue, 20 Jul 2021 17:22:49 +0000 (20:22 +0300)
committerStijn Tintel <stijn@linux-ipv6.be>
Fri, 23 Jul 2021 09:16:29 +0000 (12:16 +0300)
Calling the ovs_bridge_init function when stopping the service will
result in ovs-vsctl being called after ovsdb-server has been shut down.
This causes the following error:

ovs-vsctl: unix:/var/run/openvswitch/db.sock: database connection failed (No such file or directory)

Calling the ovs_bridge_init function when requesting the service status
has no added value.

Only call ovs_bridge_init during start or restart to fix this.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
net/openvswitch/files/openvswitch.init

index 23b75c38f72c7ec2e92ca7c60bf8eeecb2e5dbc8..9958f9892897014da016b3ab5256ce77bd44957a 100755 (executable)
@@ -59,7 +59,12 @@ ovs_action() {
                config_foreach "ovs_xx" "$cfgtype" "$action" "$cfgtype"
        done
 
-       config_foreach ovs_bridge_init "ovs_bridge"
+       case "$action" in
+               restart|start)
+                       config_foreach ovs_bridge_init "ovs_bridge"
+                       ;;
+       esac
+
 }
 
 ovs_xx() {