From patchwork Thu Jul 7 18:37:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Moats X-Patchwork-Id: 646016 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 3rlmZH6rSsz9sdn for ; Fri, 8 Jul 2016 04:37:27 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id A38F410AE5; Thu, 7 Jul 2016 11:37:24 -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 A3FFD10AE2 for ; Thu, 7 Jul 2016 11:37:23 -0700 (PDT) Received: from bar5.cudamail.com (unknown [192.168.21.12]) by mx1e4.cudamail.com (Postfix) with ESMTPS id 294F31E010D for ; Thu, 7 Jul 2016 12:37:23 -0600 (MDT) X-ASG-Debug-ID: 1467916641-09eadd47e72e7290001-byXFYA Received: from mx1-pf2.cudamail.com ([192.168.24.2]) by bar5.cudamail.com with ESMTP id hrLVJnqbz9dDDEqX (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 07 Jul 2016 12:37:21 -0600 (MDT) X-Barracuda-Envelope-From: rmoats@oc7146733065.ibm.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.2 Received: from unknown (HELO fed1rmfepo101.cox.net) (68.230.241.143) by mx1-pf2.cudamail.com with SMTP; 7 Jul 2016 18:37:20 -0000 Received-SPF: none (mx1-pf2.cudamail.com: domain at oc7146733065.ibm.com does not designate permitted sender hosts) X-Barracuda-Apparent-Source-IP: 68.230.241.143 X-Barracuda-RBL-IP: 68.230.241.143 Received: from fed1rmimpo209.cox.net ([68.230.241.160]) by fed1rmfepo101.cox.net (InterMail vM.8.01.05.28 201-2260-151-171-20160122) with ESMTP id <20160707183719.RHYA14123.fed1rmfepo101.cox.net@fed1rmimpo209.cox.net> for ; Thu, 7 Jul 2016 14:37:19 -0400 Received: from oc7146733065.ibm.com ([68.13.99.247]) by fed1rmimpo209.cox.net with cox id FudK1t0035LF6cs01udKSX; Thu, 07 Jul 2016 14:37:19 -0400 X-CT-Class: Clean X-CT-Score: 0.00 X-CT-RefID: str=0001.0A020201.577EA15F.020F, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CT-Spam: 0 X-Authority-Analysis: v=2.1 cv=H/J7u7si c=1 sm=1 tr=0 a=Jmqd6mthTashISSy/JkQqg==:117 a=Jmqd6mthTashISSy/JkQqg==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=cAmyUtKerLwA:10 a=VnNF1IyMAAAA:8 a=TYZn4TcQimSxqZc5SwkA:9 a=XuRW3p1_rOqPa3EB:21 a=WfIPFSeTXTBcSzDU:21 a=skCgnbhlp52w9zbo2JeP:22 X-CM-Score: 0.00 Authentication-Results: cox.net; none Received: by oc7146733065.ibm.com (Postfix, from userid 500) id 509BA1880390; Thu, 7 Jul 2016 13:37:18 -0500 (CDT) X-CudaMail-Envelope-Sender: rmoats@oc7146733065.ibm.com From: Ryan Moats To: dev@openvswitch.org X-CudaMail-MID: CM-E2-706053484 X-CudaMail-DTE: 070716 X-CudaMail-Originating-IP: 68.230.241.143 Date: Thu, 7 Jul 2016 13:37:04 -0500 X-ASG-Orig-Subj: [##CM-E2-706053484##][PATCH v2] ovn-controller: Remove old address set after change. Message-Id: <1467916624-12564-1-git-send-email-rmoats@us.ibm.com> X-Mailer: git-send-email 1.7.1 X-GBUdb-Analysis: 0, 68.230.241.143, Ugly c=0.303425 p=-0.157895 Source Normal X-MessageSniffer-Rules: 0-0-0-5441-c X-Barracuda-Connect: UNKNOWN[192.168.24.2] X-Barracuda-Start-Time: 1467916641 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: 0.60 X-Barracuda-Spam-Status: No, SCORE=0.60 using global scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=4.0 tests=BSF_SC5_MJ1963, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.31097 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 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 v2] ovn-controller: Remove old address set after change. 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" Currently, when address set value changes, ovn controller doesn't remove the old entry from the tracking hash, it just adds the new one, leading to multiple entries for the same symbol. Fix this behavior and add a smoke test to avoid a regression in the future. Signed-off-by: Ryan Moats Acked-by: Flavio Fernandes --- ovn/controller/lflow.c | 1 + tests/ovn.at | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/ovn/controller/lflow.c b/ovn/controller/lflow.c index 05e1eaf..00d1d6e 100644 --- a/ovn/controller/lflow.c +++ b/ovn/controller/lflow.c @@ -258,6 +258,7 @@ update_address_sets(struct controller_ctx *ctx) * if the symtab entry needs to be updated due to a change. */ sset_find_and_delete(&cur_addr_set_names, addr_set_rec->name); if (!address_sets_match(addr_set, addr_set_rec)) { + shash_find_and_delete(&local_address_sets, addr_set_rec->name); expr_macros_remove(&expr_address_sets, addr_set_rec->name); address_set_destroy(addr_set); addr_set = NULL; diff --git a/tests/ovn.at b/tests/ovn.at index 3436417..344d07f 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -3348,3 +3348,26 @@ done OVN_CLEANUP([hv1]) AT_CLEANUP + +AT_SETUP([ovn -- address sets modification/removal smoke test]) +AT_KEYWORDS([ovn-addr]) +ovn_start + +net_add n1 + +sim_add hv1 +as hv1 +ovs-vsctl add-br br-phys +ovn_attach n1 br-phys 192.168.0.1 + +row=`ovn-nbctl create Address_Set name=set1 addresses=\"1.1.1.1\"` +ovn-nbctl set Address_Set $row name=set1 addresses=\"1.1.1.1,1.1.1.2\" +ovn-nbctl destroy Address_Set $row + +sleep 1 + +AT_CHECK([ovs-appctl -t ovn-controller version], [0], [ignore]) + +OVN_CLEANUP([hv1]) + +AT_CLEANUP