[ovs-dev] [PATCH v2] utilities/ovs-ctl.in: Only add_managers with vswitchd

Aaron Conole aconole at redhat.com
Fri May 20 14:50:46 UTC 2016


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 at redhat.com>
---
v1->v2:
- refactored to only start when both daemons are up, and only when a start
  or restart command includes at least one of the daemons.

 utilities/ovs-ctl.in | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
index 4aa2999..6bc7ced 100755
--- a/utilities/ovs-ctl.in
+++ b/utilities/ovs-ctl.in
@@ -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 () {
-- 
2.5.5




More information about the dev mailing list