utilities/ovs-ctl.in: Only add_managers with vswitchd
authorAaron Conole <aconole@redhat.com>
Fri, 20 May 2016 14:50:46 +0000 (10:50 -0400)
committerBen Pfaff <blp@ovn.org>
Fri, 20 May 2016 14:58:17 +0000 (07:58 -0700)
The ovs-ctl script was changed recently to have per-service start/stop
control. However, when that change was made the add_managers() call was
overlooked. This results in calls to `ovs-ctl --no-ovs-vswitchd start`
telling the ovsdb-server to connect to the remote controllers.

The fix presented will defer signaling to remote managers until the
following are both true:
1. At least one of OVSDB_SERVER or OVS_VSWITCHD was told to start
2. Both daemons are running.

Fixes: 7fc28c50c012 ("ovs-ctl: Allow selective start for db and switch")
Signed-off-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
utilities/ovs-ctl.in

index 4aa2999..6bc7ced 100755 (executable)
@@ -199,9 +199,14 @@ add_managers () {
     # churn in the database at startup or restart.  (For example, managers
     # won't briefly see empty datapath-id or ofport columns for records that
     # exist at startup.)
-    action "Enabling remote OVSDB managers" \
-       ovs-appctl -t ovsdb-server ovsdb-server/add-remote \
-           db:Open_vSwitch,Open_vSwitch,manager_options
+    if test X"$OVSDB_SERVER" = Xyes || test X"$OVS_VSWITCHD" = Xyes; then
+        if daemon_is_running ovsdb-server \
+                && daemon_is_running ovs-vswitchd; then
+            action "Enabling remote OVSDB managers" \
+                   ovs-appctl -t ovsdb-server ovsdb-server/add-remote \
+                   db:Open_vSwitch,Open_vSwitch,manager_options
+        fi
+    fi
 }
 
 do_start_forwarding () {