From patchwork Tue Aug 30 21:16:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Gross X-Patchwork-Id: 664297 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (archives.nicira.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 3sP1Z03xRpz9s9x for ; Wed, 31 Aug 2016 07:17:28 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 8A84E106E9; Tue, 30 Aug 2016 14:17:27 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e4.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id D0E33106DE for ; Tue, 30 Aug 2016 14:17:25 -0700 (PDT) Received: from bar5.cudamail.com (unknown [192.168.21.12]) by mx1e4.cudamail.com (Postfix) with ESMTPS id 61A621E043C for ; Tue, 30 Aug 2016 15:17:25 -0600 (MDT) X-ASG-Debug-ID: 1472591844-09eadd1685852e0001-byXFYA Received: from mx1-pf1.cudamail.com ([192.168.24.1]) by bar5.cudamail.com with ESMTP id qQoUIRXe1FcUFNJ4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 30 Aug 2016 15:17:24 -0600 (MDT) X-Barracuda-Envelope-From: jesse@kernel.org X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.1 Received: from unknown (HELO mail.kernel.org) (198.145.29.136) by mx1-pf1.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 30 Aug 2016 21:17:24 -0000 Received-SPF: none (mx1-pf1.cudamail.com: domain at kernel.org does not designate permitted sender hosts) X-Barracuda-Apparent-Source-IP: 198.145.29.136 X-Barracuda-RBL-IP: 198.145.29.136 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 42E2B201F2 for ; Tue, 30 Aug 2016 21:17:23 +0000 (UTC) Received: from localhost.localdomain (c-71-202-123-143.hsd1.ca.comcast.net [71.202.123.143]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5E7FC201EF for ; Tue, 30 Aug 2016 21:17:22 +0000 (UTC) X-CudaMail-Envelope-Sender: jesse@kernel.org From: Jesse Gross To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-E1-829076946 X-CudaMail-DTE: 083016 X-CudaMail-Originating-IP: 198.145.29.136 Date: Tue, 30 Aug 2016 14:16:36 -0700 X-ASG-Orig-Subj: [##CM-E1-829076946##][PATCH] ovs-save: Restore tunnel TLV map before flows. Message-Id: <1472591796-80057-1-git-send-email-jesse@kernel.org> X-Mailer: git-send-email 2.7.4 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP X-Barracuda-Connect: UNKNOWN[192.168.24.1] X-Barracuda-Start-Time: 1472591844 X-Barracuda-Encrypted: ECDHE-RSA-AES256-GCM-SHA384 X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Subject: [ovs-dev] [PATCH] ovs-save: Restore tunnel TLV map before flows. 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" Scripts that integrate OVS with a distribution often save and restore flows across distruptive events, such as an upgrade. The ovs-save utility generates a script to assist with this. When flows include tunnel metadata, we also need to restore the TLV mappings before the flows are re-added. Otherwise, the instance of OVS receiving the new flows won't know the meaning of these fields and will ignore them. Signed-off-by: Jesse Gross Acked-by: Ben Pfaff --- utilities/ovs-save | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/utilities/ovs-save b/utilities/ovs-save index d4d3c35..4ae8fde 100755 --- a/utilities/ovs-save +++ b/utilities/ovs-save @@ -106,6 +106,12 @@ save_flows () { fi for bridge in "$@"; do + echo -n "ovs-ofctl add-tlv-map ${bridge} '" + ovs-ofctl dump-tlv-map br-int | \ + awk '/^ 0x/ {if (cnt != 0) printf ","; \ + cnt++;printf "{class="$1",type="$2",len="$3"}->"$4}' + echo "'" + echo "ovs-ofctl add-flows ${bridge} - << EOF" ovs-ofctl dump-flows "${bridge}" | sed -e '/NXST_FLOW/d' \ -e 's/\(idle\|hard\)_age=[^,]*,//g'