From patchwork Thu Jul 28 18:10:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Moats X-Patchwork-Id: 653845 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 3s0fzf1wrRz9sXx for ; Fri, 29 Jul 2016 04:10:38 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 1994F11319; Thu, 28 Jul 2016 11:10:37 -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 427DC112CC for ; Thu, 28 Jul 2016 11:10:35 -0700 (PDT) Received: from bar5.cudamail.com (unknown [192.168.21.12]) by mx1e4.cudamail.com (Postfix) with ESMTPS id CB9791E0047 for ; Thu, 28 Jul 2016 12:10:34 -0600 (MDT) X-ASG-Debug-ID: 1469729433-09eadd7aea2dc300001-byXFYA Received: from mx1-pf1.cudamail.com ([192.168.24.1]) by bar5.cudamail.com with ESMTP id IHerSr8ySNLnMnI8 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 28 Jul 2016 12:10:34 -0600 (MDT) X-Barracuda-Envelope-From: stack@tombstone-01.cloud.svl.ibm.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.1 Received: from unknown (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by mx1-pf1.cudamail.com with ESMTPS (AES256-SHA encrypted); 28 Jul 2016 18:10:33 -0000 Received-SPF: none (mx1-pf1.cudamail.com: domain at tombstone-01.cloud.svl.ibm.com does not designate permitted sender hosts) X-Barracuda-Apparent-Source-IP: 148.163.156.1 X-Barracuda-RBL-IP: 148.163.156.1 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u6SIAKxH021871 for ; Thu, 28 Jul 2016 14:10:33 -0400 Received: from e37.co.us.ibm.com (e37.co.us.ibm.com [32.97.110.158]) by mx0a-001b2d01.pphosted.com with ESMTP id 24fhts7t92-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 28 Jul 2016 14:10:32 -0400 Received: from localhost by e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 28 Jul 2016 12:10:32 -0600 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e37.co.us.ibm.com (192.168.1.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 28 Jul 2016 12:10:28 -0600 X-IBM-Helo: d03dlp02.boulder.ibm.com X-IBM-MailFrom: stack@tombstone-01.cloud.svl.ibm.com Received: from b01cxnp22035.gho.pok.ibm.com (b01cxnp22035.gho.pok.ibm.com [9.57.198.25]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id B41823E40072 for ; Thu, 28 Jul 2016 12:10:26 -0600 (MDT) Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u6SIAN0P56229910; Thu, 28 Jul 2016 18:10:26 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2AC04AE034; Thu, 28 Jul 2016 14:10:26 -0400 (EDT) Received: from localhost (unknown [9.30.183.40]) by b01ledav005.gho.pok.ibm.com (Postfix) with SMTP id DB3B1AE052; Thu, 28 Jul 2016 14:10:25 -0400 (EDT) Received: by localhost (Postfix, from userid 1000) id AC1B1601AA; Thu, 28 Jul 2016 18:10:18 +0000 (UTC) X-CudaMail-Envelope-Sender: stack@tombstone-01.cloud.svl.ibm.com From: Ryan Moats To: dev@openvswitch.org X-CudaMail-MID: CM-E1-727050925 X-CudaMail-DTE: 072816 X-CudaMail-Originating-IP: 148.163.156.1 Date: Thu, 28 Jul 2016 18:10:16 +0000 X-ASG-Orig-Subj: [##CM-E1-727050925##][PATCH] ovn-controller: Clean up cases that lead to duplicate OF flows. X-Mailer: git-send-email 1.9.1 X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16072818-0024-0000-0000-000014368D24 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005537; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000177; SDB=6.00736735; UDB=6.00346030; IPR=6.00509330; BA=6.00004629; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012095; XFM=3.00000011; UTC=2016-07-28 18:10:30 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16072818-0025-0000-0000-0000431A42AB Message-Id: <1469729416-10019-1-git-send-email-rmoats@us.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-07-28_12:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1607280181 X-Barracuda-Connect: UNKNOWN[192.168.24.1] X-Barracuda-Start-Time: 1469729433 X-Barracuda-Encrypted: ECDHE-RSA-AES256-GCM-SHA384 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.31584 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] ovn-controller: Clean up cases that lead to duplicate OF 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" In physical_run, there are multiple places where OF flows can be produced each cycle. Because the desired flow table may not have been completely cleared first, remove flows created during previous runs before creating new flows. This avoid collisions. Signed-off-by: Ryan Moats --- ovn/controller/physical.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ovn/controller/physical.c b/ovn/controller/physical.c index e5df4f2..2e9fb73 100644 --- a/ovn/controller/physical.c +++ b/ovn/controller/physical.c @@ -603,6 +603,7 @@ physical_run(struct controller_ctx *ctx, enum mf_field_id mff_ovn_geneve, if (!hc_uuid) { hc_uuid = xmalloc(sizeof(struct uuid)); uuid_generate(hc_uuid); + VLOG_INFO("Hard coded uuid is "UUID_FMT, UUID_ARGS(hc_uuid)); } /* This bool tracks physical mapping changes. */ @@ -750,6 +751,10 @@ physical_run(struct controller_ctx *ctx, enum mf_field_id mff_ovn_geneve, const struct sbrec_port_binding *binding; if (full_binding_processing) { SBREC_PORT_BINDING_FOR_EACH (binding, ctx->ovnsb_idl) { + /* Because it is possible in the above code to enter this + * for loop without having cleared the flow table first, we + * should clear the old flows to avoid collisions. */ + ofctrl_remove_flows(&binding->header_.uuid); consider_port_binding(mff_ovn_geneve, ct_zones, local_datapaths, patched_datapaths, binding, &ofpacts); } @@ -773,12 +778,21 @@ physical_run(struct controller_ctx *ctx, enum mf_field_id mff_ovn_geneve, struct ofpbuf remote_ofpacts; ofpbuf_init(&remote_ofpacts, 0); SBREC_MULTICAST_GROUP_FOR_EACH (mc, ctx->ovnsb_idl) { + /* As multicast groups are always reprocessed each time, + * the first step is to clean the old flows for the group + * so that we avoid warning messages on collisions. */ + ofctrl_remove_flows(&mc->header_.uuid); consider_mc_group(mff_ovn_geneve, ct_zones, local_datapaths, mc, &ofpacts, &remote_ofpacts); } ofpbuf_uninit(&remote_ofpacts); + /* Because flows using the hard-coded uuid are recalculated each + * cycle, let's first remove the old flows to avoid duplicate flow + * warnings. */ + ofctrl_remove_flows(hc_uuid); + /* Table 0, priority 100. * ====================== *