diff mbox

[ovs-dev,v2,1/2] ovs-ctl: Add option to delete transient ports only on boot.

Message ID 927260eabe0127fc851b0a3e2b2458d03fa9dfdf.1495719241.git.tredaelli@redhat.com
State Superseded
Headers show

Commit Message

Timothy Redaelli May 25, 2017, 1:38 p.m. UTC
The first time after boot, when openvswitch is started by using
--delete-transient-ports-on-boot ovs-ctl option, all transient ports will be
removed.

Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
---

Changed since v1:
  * Added --delete-transient-ports-on-boot flag to manpage

 utilities/ovs-ctl.8  | 13 ++++++++++++-
 utilities/ovs-ctl.in |  6 ++++++
 2 files changed, 18 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/utilities/ovs-ctl.8 b/utilities/ovs-ctl.8
index 84fa33f..a15d729 100644
--- a/utilities/ovs-ctl.8
+++ b/utilities/ovs-ctl.8
@@ -95,11 +95,16 @@  bridges from the database.
 If the \fB\-\-delete\-transient\-ports\fR option was used, deletes all ports
 that have \fBother_config:transient\fR set to true.
 .
+.IP 7.
+If the \fB\-\-delete\-transient\-ports\-on\-boot\fR option was used, deletes
+all ports that have \fBother_config:transient\fR set to true, but only the
+first time after a boot.
+.
 .PP
 The \fBstart\fR command skips the following step if
 \fBovs\-vswitchd\fR is already running, or if the \fB\-\-no\-ovs\-vswitchd\fR
 command option is given:
-.IP 7.
+.IP 8.
 Starts \fBovs\-vswitchd\fR.
 .
 .SS "Options"
@@ -159,6 +164,12 @@  Deletes all ports that have the other_config:transient value set to true. This
 is important on certain environments where some ports are going to be recreated
 after reboot, but other ports need to be persisted in the database.
 .
+.IP "\fB\-\-delete\-transient\-ports\-on\-boot\fR"
+The first time after a boot, deletes all ports that have the
+other_config:transient value set to true. This is important on certain
+environments where some ports are going to be recreated after reboot,
+but other ports need to be persisted in the database.
+.
 .IP "\fB\-\-ovs\-user=user[:group]\fR"
 Ordinarily Open vSwitch daemons are started as the user invoking the ovs-ctl
 command.  Some system administrators would prefer to have the various daemons
diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
index 575ffa0..c3130fa 100755
--- a/utilities/ovs-ctl.in
+++ b/utilities/ovs-ctl.in
@@ -189,6 +189,11 @@  do_start_ovsdb () {
         if test X"$DELETE_TRANSIENT_PORTS" = Xyes; then
             del_transient_ports
         fi
+        if test X"$DELETE_TRANSIENT_PORTS_ON_BOOT" = Xyes && \
+            ! test -f "$rundir/deleted_transient_ports"; then
+            del_transient_ports
+            : > "$rundir/deleted_transient_ports"
+        fi
     fi
 }
 
@@ -503,6 +508,7 @@  set_defaults () {
 
     DELETE_BRIDGES=no
     DELETE_TRANSIENT_PORTS=no
+    DELETE_TRANSIENT_PORTS_ON_BOOT=no
 
     DAEMON_CWD=/
     FORCE_COREFILES=yes