Currently, ``ovs-ctl start'' will attempt to start both the DB and
vswitchd. This is quite convenient when the database already has all of
the configuration values required, and when using a single services file
for systemd integration. The same goes for the ``ovs-ctl stop'' command.

However, there are some cases which are not easily covered. The case
where we want to set values in the database prior to starting the
forwarding path, as well as the case of supporting multiple service
files, one per daemon (which is how systemd expects services to look).

Signed-off-by: Aaron Conole <acon...@redhat.com>
---
v1: Limited testing (just some quick start/stop testing). The documentation
    updates are rather quick.
    See http://openvswitch.org/pipermail/dev/2016-February/066502.html for
    more information.

 NEWS                 |  3 +++
 utilities/ovs-ctl.8  |  4 ++--
 utilities/ovs-ctl.in | 26 ++++++++++++++++++++++----
 3 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/NEWS b/NEWS
index 2271c45..ff9f726 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,9 @@ Post-v2.5.0
      bitrot.
    - ovs-appctl:
      * New "vlog/close" command.
+   - ovs-ctl:
+     * Added the ability to selectively start the forwarding and database
+       functions (ovs-vswitchd and ovsdb-server, respectively).
    - ovsdb-server:
      * Remove max number of sessions limit, to enable connection scaling
        testing.
diff --git a/utilities/ovs-ctl.8 b/utilities/ovs-ctl.8
index 6a9a544..f98dbe8 100644
--- a/utilities/ovs-ctl.8
+++ b/utilities/ovs-ctl.8
@@ -81,7 +81,7 @@ If the database does exist, but it has an obsolete version, it
 upgrades it to the latest schema.
 .
 .IP 3.
-Starts \fBovsdb-server\fR.
+Starts \fBovsdb-server\fR, unless the \fB\-\-no\-control\-ovsdb\fR argument is 
given.
 .
 .IP 4.
 Initializes a few values inside the database.
@@ -96,7 +96,7 @@ that have \fBother_config:transient\fR set to true.
 .
 .PP
 The \fBstart\fR command skips the following step if
-\fBovs\-vswitchd\fR is already running:
+\fBovs\-vswitchd\fR is already running, or if the 
\fB\-\-no\-control\-forwarding\fR:
 .IP 7.
 Starts \fBovs\-vswitchd\fR.
 .
diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
index 0082bed..26211a9 100755
--- a/utilities/ovs-ctl.in
+++ b/utilities/ovs-ctl.in
@@ -136,7 +136,7 @@ del_transient_ports () {
     done
 }
 
-start_ovsdb () {
+do_start_ovsdb () {
     check_force_cores
 
     if daemon_is_running ovsdb-server; then
@@ -184,6 +184,12 @@ start_ovsdb () {
     fi
 }
 
+start_ovsdb() {
+    if test X"$CONTROL_OVSDB" = Xyes; then
+        do_start_ovsdb
+    fi
+}
+
 add_managers () {
     # Now that ovs-vswitchd has started and completed its initial
     # configuration, tell ovsdb-server to conenct to the remote managers.  We
@@ -197,7 +203,7 @@ add_managers () {
            db:Open_vSwitch,Open_vSwitch,manager_options
 }
 
-start_forwarding () {
+do_start_forwarding () {
     check_force_cores
 
     insert_mod_if_required || return 1
@@ -224,16 +230,26 @@ start_forwarding () {
     fi
 }
 
+start_forwarding () {
+    if test X"$CONTROL_FORWARDING" = Xyes; then
+        do_start_forwarding
+    fi
+}
+
 ## ---- ##
 ## stop ##
 ## ---- ##
 
 stop_ovsdb () {
-    stop_daemon ovsdb-server
+    if test X"$CONTROL_OVSDB" = Xyes; then
+        stop_daemon ovsdb-server
+    fi
 }
 
 stop_forwarding () {
-    stop_daemon ovs-vswitchd
+    if test X"$CONTROL_FORWARDING" = Xyes; then
+        stop_daemon ovs-vswitchd
+    fi
 }
 
 ## ----------------- ##
@@ -519,6 +535,8 @@ set_defaults () {
 
     type_file=$etcdir/system-type.conf
     version_file=$etcdir/system-version.conf
+    CONTROL_OVSDB=yes
+    CONTROL_FORWARDING=yes
 
     if test -e "$type_file" ; then
         SYSTEM_TYPE=`cat $type_file`
-- 
2.5.0

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to