From patchwork Tue Sep 1 20:56:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thadeu Lima de Souza Cascardo X-Patchwork-Id: 513059 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (li376-54.members.linode.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 9E475140082 for ; Wed, 2 Sep 2015 06:56:38 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id DA233109B3; Tue, 1 Sep 2015 13:56:37 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e3.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id 99581105AC for ; Tue, 1 Sep 2015 13:56:36 -0700 (PDT) Received: from bar2.cudamail.com (localhost [127.0.0.1]) by mx1e3.cudamail.com (Postfix) with ESMTPS id 0D0274204B1 for ; Tue, 1 Sep 2015 14:56:36 -0600 (MDT) X-ASG-Debug-ID: 1441140995-03dc53680c4da30001-byXFYA Received: from mx1-pf1.cudamail.com ([192.168.24.1]) by bar2.cudamail.com with ESMTP id jD1EytOE6TwmvY72 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 01 Sep 2015 14:56:35 -0600 (MDT) X-Barracuda-Envelope-From: cascardo@redhat.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.1 Received: from unknown (HELO mx1.redhat.com) (209.132.183.28) by mx1-pf1.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 1 Sep 2015 20:56:34 -0000 Received-SPF: error (mx1-pf1.cudamail.com: error in processing during lookup of redhat.com: DNS problem) X-Barracuda-Apparent-Source-IP: 209.132.183.28 X-Barracuda-RBL-IP: 209.132.183.28 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 7FB1BA4522 for ; Tue, 1 Sep 2015 20:56:33 +0000 (UTC) Received: from indiana.gru.redhat.com (ovpn-113-128.phx2.redhat.com [10.3.113.128]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t81KuWbc011374 for ; Tue, 1 Sep 2015 16:56:32 -0400 X-CudaMail-Envelope-Sender: cascardo@redhat.com From: Thadeu Lima de Souza Cascardo To: dev@openvswitch.org X-CudaMail-MID: CM-E1-831082055 X-CudaMail-DTE: 090115 X-CudaMail-Originating-IP: 209.132.183.28 Date: Tue, 1 Sep 2015 17:56:09 -0300 X-ASG-Orig-Subj: [##CM-E1-831082055##][PATCH v3] ovs-ctl: add option to delete transient ports Message-Id: <1441140969-26799-1-git-send-email-cascardo@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-GBUdb-Analysis: 0, 209.132.183.28, Ugly c=0.200527 p=-0.142857 Source Normal X-MessageSniffer-Rules: 0-0-0-8162-c X-Barracuda-Connect: UNKNOWN[192.168.24.1] X-Barracuda-Start-Time: 1441140995 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 1.10 X-Barracuda-Spam-Status: No, SCORE=1.10 using per-user scores of TAG_LEVEL=3.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=3.0 tests=BSF_RULE7568M, BSF_SC5_MJ1963, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.22133 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS 0.50 BSF_SC5_MJ1963 Custom Rule MJ1963 Subject: [ovs-dev] [PATCH v3] ovs-ctl: add option to delete transient ports X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" When using virtualization, new ports are created and removed all the time. These ports do not persist after a system reboot, for example. They may be created again by the virtualization manager, but that will happen after the vswitch is already running, and the virtualization manager will add them again to the bridge. If a reboot happens without properly deleting such ports, all kinds of errors will happen. The absence of the ports will be logged as errors, and adding those ports again to the database will fail. Deleting all bridges may not be an option, if the system cannot persist other information outside of OVSDB. This patch introduces the notion of transient ports. Ports may be added as transient, as a boolean in other_config smap. When openvswitch is started by using --delete-transient-ports ovs-ctl option, all transient ports will be removed. Signed-off-by: Thadeu Lima de Souza Cascardo --- utilities/ovs-ctl.8 | 11 ++++++++++- utilities/ovs-ctl.in | 10 ++++++++++ vswitchd/vswitch.xml | 8 ++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/utilities/ovs-ctl.8 b/utilities/ovs-ctl.8 index c08c7db..9728d0d 100644 --- a/utilities/ovs-ctl.8 +++ b/utilities/ovs-ctl.8 @@ -90,10 +90,14 @@ Initializes a few values inside the database. If the \fB\-\-delete\-bridges\fR option was used, deletes all of the bridges from the database. . +.IP 6. +If the \fB\-\-delete\-transient\-ports\fR option was used, deletes all ports +that have other_config:transient set to true. +. .PP The \fBstart\fR command skips the following step if \fBovs\-vswitchd\fR is already running: -.IP 6. +.IP 7. Starts \fBovs\-vswitchd\fR. . .SS "Options" @@ -148,6 +152,11 @@ on every boot. This option supports that, by deleting all Open vSwitch bridges after starting \fBovsdb\-server\fR but before starting \fBovs\-vswitchd\fR. . +.IP "\fB\-\-delete\-transient\-ports\fR" +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. +. .PP The following options are less important: . diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in index 9bbbe0d..bca8c56 100755 --- a/utilities/ovs-ctl.in +++ b/utilities/ovs-ctl.in @@ -177,6 +177,12 @@ check_force_cores () { fi } +del_transient_ports () { + for port in `ovs-vsctl --bare -- --columns=name find port other_config:transient=true`; do + ovs_vsctl -- del-port "$port" + done +} + start_ovsdb () { check_force_cores @@ -219,6 +225,9 @@ start_ovsdb () { ovs_vsctl del-br $bridge done fi + if test X"$DELETE_TRANSIENT_PORTS" = Xyes; then + del_transient_ports + fi fi } @@ -536,6 +545,7 @@ set_defaults () { SYSTEM_ID= DELETE_BRIDGES=no + DELETE_TRANSIENT_PORTS=no DAEMON_CWD=/ FORCE_COREFILES=yes diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index 457f34a..0ab4a9a 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -1659,6 +1659,14 @@ fake-bridge-, e.g. fake-bridge-xs-network-uuids. + + +

+ If set to true, the port will be removed when + ovs-ctl start --delete-transient-ports is used. +

+