From patchwork Tue Apr 23 11:53:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Simonart X-Patchwork-Id: 1926502 X-Patchwork-Delegate: nusiddiq@redhat.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cU91yweq; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VP0rV5ytKz1yP2 for ; Tue, 23 Apr 2024 21:53:46 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 4540A80002; Tue, 23 Apr 2024 11:53:40 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id Sp9d2bH6aNMV; Tue, 23 Apr 2024 11:53:39 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 232C5814A9 Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cU91yweq Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id 232C5814A9; Tue, 23 Apr 2024 11:53:39 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id DE85FC0DCE; Tue, 23 Apr 2024 11:53:38 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 713F3C0037 for ; Tue, 23 Apr 2024 11:53:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 604686060A for ; Tue, 23 Apr 2024 11:53:37 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 1gvKYnHRlfpb for ; Tue, 23 Apr 2024 11:53:36 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.133.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=xsimonar@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org 9F5B8605AA Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 9F5B8605AA Authentication-Results: smtp3.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cU91yweq Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 9F5B8605AA for ; Tue, 23 Apr 2024 11:53:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713873215; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hLN7z4Z4J3fYn+94BW9oe+jBvVH9KhQxiDkR6JTUm/s=; b=cU91yweqxM5flJ8LlcXjUnj75OXlmPpz2ryH03/Myn1xH9j6dQ6ljpTDKBHuQ4KFrtMiIL Yai4cYhKrh+82VJcAZhN2bQyST+Qp7xeDqSjww+4BN78dcDnOLWa11PsCsdvw4kPnOysy+ gdR00WDCjy51WGA1yut7w3UClQb2ShY= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-56-_Q-OEp-UMeW5dRuZvJDGuQ-1; Tue, 23 Apr 2024 07:53:34 -0400 X-MC-Unique: _Q-OEp-UMeW5dRuZvJDGuQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ECE5F29ABA18 for ; Tue, 23 Apr 2024 11:53:33 +0000 (UTC) Received: from wsfd-netdev90.ntdv.lab.eng.bos.redhat.com (wsfd-netdev90.anl.eng.rdu2.dc.redhat.com [10.6.38.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id E6D66400EB2; Tue, 23 Apr 2024 11:53:33 +0000 (UTC) From: Xavier Simonart To: xsimonar@redhat.com, dev@openvswitch.org Date: Tue, 23 Apr 2024 13:53:29 +0200 Message-Id: <20240423115333.2796843-2-xsimonar@redhat.com> In-Reply-To: <20240423115333.2796843-1-xsimonar@redhat.com> References: <20240423115333.2796843-1-xsimonar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 1/5] controller: Fix iface-id-ver handling. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" If iface-id-ver was wrong and modified to a correct value, the port was correctly claimed, but the flows were not installed by I+P. Signed-off-by: Xavier Simonart Acked-by: Numan Siddique --- controller/binding.c | 14 ++++++++++++++ tests/ovn.at | 2 ++ 2 files changed, 16 insertions(+) diff --git a/controller/binding.c b/controller/binding.c index 8ac2ce3e2..c9658cb2a 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -757,6 +757,8 @@ update_active_pb_ras_pd(const struct sbrec_port_binding *pb, } } +static bool is_ext_id_changed(const struct smap *a, const struct smap *b, + const char *key); static struct local_binding *local_binding_create( const char *name, const struct ovsrec_interface *); static void local_binding_add(struct shash *local_bindings, @@ -2311,6 +2313,18 @@ consider_iface_claim(const struct ovsrec_interface *iface_rec, return true; } + /* Check if iface-id-ver just becomes correct */ + struct smap *external_ids_old = + shash_find_data(b_ctx_in->iface_table_external_ids_old, + iface_rec->name); + + if (external_ids_old && + is_ext_id_changed(&iface_rec->external_ids, + external_ids_old, + "iface-id-ver")) { + b_ctx_out->local_lports_changed = true; + } + /* If multiple bindings to the same port, remove the "old" binding. * This ensures that change tracking is correct. */ diff --git a/tests/ovn.at b/tests/ovn.at index e81cd4f45..f974cbb15 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -33239,6 +33239,8 @@ check as hv1 ovs-vsctl set interface vif11 external_ids:iface-id-ver=foo wait_for_ports_up sw0-port1 +CHECK_FLOWS_AFTER_RECOMPUTE([hv1], [hv1]) + AT_CHECK([as hv1 ovn-appctl -t ovn-controller debug/dump-local-bindings], [0], [dnl Local bindings: name: [[sw0-port1]], OVS interface name : [[vif11]], num binding lports : [[1]] From patchwork Tue Apr 23 11:53:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Simonart X-Patchwork-Id: 1926507 X-Patchwork-Delegate: nusiddiq@redhat.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=KJNRACvQ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VP0rj5fzQz1yP2 for ; Tue, 23 Apr 2024 21:53:57 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 35C6581FBB; Tue, 23 Apr 2024 11:53:55 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id OiLZOlmCp3aN; Tue, 23 Apr 2024 11:53:54 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 5ABBE802D5 Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=KJNRACvQ Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id 5ABBE802D5; Tue, 23 Apr 2024 11:53:41 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C6CB9C0DD4; Tue, 23 Apr 2024 11:53:40 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 98DDDC0037 for ; Tue, 23 Apr 2024 11:53:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 86B224114E for ; Tue, 23 Apr 2024 11:53:38 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 40YJK_WEX7JR for ; Tue, 23 Apr 2024 11:53:37 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=xsimonar@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org 10093400D9 Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 10093400D9 Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=KJNRACvQ Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id 10093400D9 for ; Tue, 23 Apr 2024 11:53:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713873215; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AZtLRxrfUMrMVBG8d9WGPlY0ip5Ia7v1yBvNJZEl/Ik=; b=KJNRACvQs8jO4lmKFhZM91dYqQQIHlti8f+iIF9RTcOtDKErFBVNIfNnEm4mOvrJ9XPKQq orutISy3oylMaH4kD1eHfdwFzDI9SEUZz4PUW13xi0m+r9TTExV/G69tlPMYzHyIZeBfhC GqWAEdJxYPqS/8wvikXt6izGP+YGBVM= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-563-0HQOkx22OG-Mx6NFndQEdw-1; Tue, 23 Apr 2024 07:53:34 -0400 X-MC-Unique: 0HQOkx22OG-Mx6NFndQEdw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F2D0429ABA11 for ; Tue, 23 Apr 2024 11:53:33 +0000 (UTC) Received: from wsfd-netdev90.ntdv.lab.eng.bos.redhat.com (wsfd-netdev90.anl.eng.rdu2.dc.redhat.com [10.6.38.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id EBAC640C465; Tue, 23 Apr 2024 11:53:33 +0000 (UTC) From: Xavier Simonart To: xsimonar@redhat.com, dev@openvswitch.org Date: Tue, 23 Apr 2024 13:53:30 +0200 Message-Id: <20240423115333.2796843-3-xsimonar@redhat.com> In-Reply-To: <20240423115333.2796843-1-xsimonar@redhat.com> References: <20240423115333.2796843-1-xsimonar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 2/5] controller: Nonvif related lports handling. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" This patches fixes flows not properly deleted in scenarios similar to: foo1 (hv1) - foo - R1 - join - R2 (chassis = hv2) - alice - alice1 (hv2). When R2 is deleted, alice_R2 changed from l3gateway to patch, and, on hv1, alice_R2 was added to related ports. When R2 was added back (together with R2-alice and R2-join), alice_R2 changed back from patch to l3gateway and alice_R2 remained in related_lports on hv1. This is now fixed: a l3_gateway port is not a related_port if not for our chassis. A test case has been modified to highlight the error, but also to make the test easier to read (e.g avoid using same name for a port and for a switch). Signed-off-by: Xavier Simonart Acked-by: Numan Siddique --- controller/binding.c | 12 ++++++++---- tests/ovn.at | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index c9658cb2a..3b36ed881 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -1824,7 +1824,7 @@ consider_localport(const struct sbrec_port_binding *pb, */ static bool consider_nonvif_lport_(const struct sbrec_port_binding *pb, - bool our_chassis, + bool our_chassis, bool is_ha_chassis, struct binding_ctx_in *b_ctx_in, struct binding_ctx_out *b_ctx_out) { @@ -1844,6 +1844,9 @@ consider_nonvif_lport_(const struct sbrec_port_binding *pb, b_ctx_out->if_mgr, b_ctx_out->postponed_ports); } + if (!is_ha_chassis) { + remove_related_lport(pb, b_ctx_out); + } if (pb->chassis == b_ctx_in->chassis_rec || is_additional_chassis(pb, b_ctx_in->chassis_rec) @@ -1867,7 +1870,7 @@ consider_l2gw_lport(const struct sbrec_port_binding *pb, bool our_chassis = chassis_id && !strcmp(chassis_id, b_ctx_in->chassis_rec->name); - return consider_nonvif_lport_(pb, our_chassis, b_ctx_in, b_ctx_out); + return consider_nonvif_lport_(pb, our_chassis, false, b_ctx_in, b_ctx_out); } static bool @@ -1879,7 +1882,7 @@ consider_l3gw_lport(const struct sbrec_port_binding *pb, bool our_chassis = chassis_id && !strcmp(chassis_id, b_ctx_in->chassis_rec->name); - return consider_nonvif_lport_(pb, our_chassis, b_ctx_in, b_ctx_out); + return consider_nonvif_lport_(pb, our_chassis, false, b_ctx_in, b_ctx_out); } static void @@ -1942,7 +1945,8 @@ consider_ha_lport(const struct sbrec_port_binding *pb, update_related_lport(pb, b_ctx_out); } - return consider_nonvif_lport_(pb, our_chassis, b_ctx_in, b_ctx_out); + return consider_nonvif_lport_(pb, our_chassis, is_ha_chassis, b_ctx_in, + b_ctx_out); } static bool diff --git a/tests/ovn.at b/tests/ovn.at index f974cbb15..3c888aaf5 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -7781,9 +7781,9 @@ ovn-nbctl lsp-add foo rp-foo -- set Logical_Switch_Port rp-foo \ type=router options:router-port=foo addresses=\"00:00:01:01:02:03\" # Connect alice to R2 -ovn-nbctl lrp-add R2 alice 00:00:02:01:02:03 172.16.1.1/24 -ovn-nbctl lsp-add alice rp-alice -- set Logical_Switch_Port rp-alice \ - type=router options:router-port=alice addresses=\"00:00:02:01:02:03\" +ovn-nbctl lrp-add R2 R2-alice 00:00:02:01:02:03 172.16.1.1/24 +ovn-nbctl lsp-add alice alice-R2 -- set Logical_Switch_Port alice-R2 \ + type=router options:router-port=R2-alice addresses=\"00:00:02:01:02:03\" # Connect R1 to join ovn-nbctl lrp-add R1 R1_join 00:00:04:01:02:03 20.0.0.1/24 @@ -7871,11 +7871,13 @@ echo "----------------------------" echo $expected > expected OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [expected]) +CHECK_FLOWS_AFTER_RECOMPUTE([hv1], [hv1]) + # Delete the router and re-create it. Things should work as before. ovn-nbctl lr-del R2 ovn-nbctl create Logical_Router name=R2 options:chassis="hv2" # Connect alice to R2 -ovn-nbctl lrp-add R2 alice 00:00:02:01:02:03 172.16.1.1/24 +ovn-nbctl lrp-add R2 R2-alice 00:00:02:01:02:03 172.16.1.1/24 # Connect R2 to join ovn-nbctl lrp-add R2 R2_join 00:00:04:01:02:04 20.0.0.2/24 @@ -7887,6 +7889,8 @@ R2 static_routes @lrt wait_for_ports_up check ovn-nbctl --wait=hv sync +CHECK_FLOWS_AFTER_RECOMPUTE([hv1], [hv1]) + # Send the packet again. as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet From patchwork Tue Apr 23 11:53:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Simonart X-Patchwork-Id: 1926506 X-Patchwork-Delegate: nusiddiq@redhat.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=CmJuzZYb; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VP0rg2jlpz1yP2 for ; Tue, 23 Apr 2024 21:53:55 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 0086981373; Tue, 23 Apr 2024 11:53:48 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id MFjuYGQdXusY; Tue, 23 Apr 2024 11:53:46 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 0BE95812D9 Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=CmJuzZYb Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 0BE95812D9; Tue, 23 Apr 2024 11:53:44 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6BCBDC0DD5; Tue, 23 Apr 2024 11:53:43 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 56C3AC0037 for ; Tue, 23 Apr 2024 11:53:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id C99CE40464 for ; Tue, 23 Apr 2024 11:53:38 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id uDNn4Mfoh8vI for ; Tue, 23 Apr 2024 11:53:37 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=xsimonar@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org 89388404A6 Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 89388404A6 Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=CmJuzZYb Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id 89388404A6 for ; Tue, 23 Apr 2024 11:53:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713873216; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mwUB+kUN+iZtqwdwz2Ol8zt8aEdsaNzuYbh4/FzdEDc=; b=CmJuzZYbaSlxgtYcJAjqZGmtswkKOIcvFRaLv7+BwZSEMOYEFi2vek6rtZP4qYrknvj+pe 0CEqa/EdK1/jXnDrLV1PIBS5aF8e+AceNH9FZ1dKiH/IB9lIHu9sXay0CjkwySOu6y4ibX OQa+CCd1Bm3nTv6uMO4ORsCyLWyNAMs= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-145-_03dPjpfNw6Fwr12TFjZ0w-1; Tue, 23 Apr 2024 07:53:34 -0400 X-MC-Unique: _03dPjpfNw6Fwr12TFjZ0w-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0472E104B507 for ; Tue, 23 Apr 2024 11:53:34 +0000 (UTC) Received: from wsfd-netdev90.ntdv.lab.eng.bos.redhat.com (wsfd-netdev90.anl.eng.rdu2.dc.redhat.com [10.6.38.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id F120D400EAC; Tue, 23 Apr 2024 11:53:33 +0000 (UTC) From: Xavier Simonart To: xsimonar@redhat.com, dev@openvswitch.org Date: Tue, 23 Apr 2024 13:53:31 +0200 Message-Id: <20240423115333.2796843-4-xsimonar@redhat.com> In-Reply-To: <20240423115333.2796843-1-xsimonar@redhat.com> References: <20240423115333.2796843-1-xsimonar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 3/5] controller: Fix deletion of container parent port. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Flows were not properly removed when parent port of a container port was deleted. Signed-off-by: Xavier Simonart Acked-by: Numan Siddique --- controller/binding.c | 1 + controller/physical.c | 3 ++- tests/ovn.at | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/controller/binding.c b/controller/binding.c index 3b36ed881..1499ceae1 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -2759,6 +2759,7 @@ handle_deleted_vif_lport(const struct sbrec_port_binding *pb, * deleted 'pb' type is LP_VIF. */ struct binding_lport *c_lport; LIST_FOR_EACH (c_lport, list_node, &lbinding->binding_lports) { + remove_local_lports(c_lport->pb->logical_port, b_ctx_out); if (!release_binding_lport(b_ctx_in->chassis_rec, c_lport, !b_ctx_in->ovnsb_idl_txn, b_ctx_out)) { diff --git a/controller/physical.c b/controller/physical.c index 7ee308694..98f7dbab2 100644 --- a/controller/physical.c +++ b/controller/physical.c @@ -1026,7 +1026,8 @@ put_local_common_flows(uint32_t dp_key, put_resubmit(OFTABLE_LOG_TO_PHY, ofpacts_p); put_stack(MFF_IN_PORT, ofpact_put_STACK_POP(ofpacts_p)); ofctrl_check_and_add_flow_metered(flow_table, OFTABLE_SAVE_INPORT, 100, - 0, &match, ofpacts_p, hc_uuid, + parent_pb->header_.uuid.parts[0], + &match, ofpacts_p, &pb->header_.uuid, NX_CTLR_NO_METER, NULL, false); } } diff --git a/tests/ovn.at b/tests/ovn.at index 3c888aaf5..b68678472 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -37794,3 +37794,37 @@ OVS_WAIT_FOR_OUTPUT([as hv1 ovs-ofctl dump-flows br-int table=0 |grep priority=1 OVN_CLEANUP([hv1]) AT_CLEANUP ]) + +OVN_FOR_EACH_NORTHD([ +AT_SETUP([Delete parent of container port]) +ovn_start + +ovn-nbctl ls-add ls0 +ovn-nbctl lsp-add ls0 lsp0 + +# Add a second logical port, so that deleting lsp0 does not result in deleting +# the last port of the datapath. +ovn-nbctl lsp-add ls0 lsp1 + +check ovn-nbctl lsp-add ls0 lsp-cont1 lsp0 1 + +net_add n1 + +sim_add hv1 +as hv1 +ovs-vsctl add-br br-phys +ovn_attach n1 br-phys 192.168.0.1 + +as hv1 +ovs-vsctl -- add-port br-int vif \ + -- set Interface vif external-ids:iface-id=lsp0 +ovs-vsctl -- add-port br-int vif1 \ + -- set Interface vif1 external-ids:iface-id=lsp1 + +check ovn-nbctl --wait=hv lsp-del lsp0 +CHECK_FLOWS_AFTER_RECOMPUTE([hv1], [hv1]) + +OVN_CLEANUP([hv1]) + +AT_CLEANUP +]) From patchwork Tue Apr 23 11:53:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Simonart X-Patchwork-Id: 1926505 X-Patchwork-Delegate: nusiddiq@redhat.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=VIJiy4pJ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VP0rc0syLz1yZt for ; Tue, 23 Apr 2024 21:53:51 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 4482340551; Tue, 23 Apr 2024 11:53:45 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id Vu0u2m7vAaFy; Tue, 23 Apr 2024 11:53:43 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org E3F46404D2 Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=VIJiy4pJ Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id E3F46404D2; Tue, 23 Apr 2024 11:53:42 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 55C5AC0DD6; Tue, 23 Apr 2024 11:53:42 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 08293C0DD4 for ; Tue, 23 Apr 2024 11:53:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id EE40D6060A for ; Tue, 23 Apr 2024 11:53:38 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id Fjg255c6fhtB for ; Tue, 23 Apr 2024 11:53:37 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=xsimonar@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org 7C7D4605AA Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 7C7D4605AA Authentication-Results: smtp3.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=VIJiy4pJ Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 7C7D4605AA for ; Tue, 23 Apr 2024 11:53:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713873216; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=g8pQLd4dA2RJfx2MgIejJ0ft9Odafn3OjLIx0csd6CA=; b=VIJiy4pJ82HsBy9ezzbf1r/VLE9x+z9k+RbgdgOntkHQDZnxAgZF1jfP6lFLwSFzPLR5XG CaDGPOcW21UgjwzLXjgl1KhRQUxCt8du0Bke1IAF+P6dhgCTCDfnsialt9k1MQyQPLbW+u ATsZ1UmvAnNHjG5+7e85kB6kDSMJuv8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-145-Zq5Pp-A5P9q2ym5Ppytjaw-1; Tue, 23 Apr 2024 07:53:34 -0400 X-MC-Unique: Zq5Pp-A5P9q2ym5Ppytjaw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 08B7A81B561 for ; Tue, 23 Apr 2024 11:53:34 +0000 (UTC) Received: from wsfd-netdev90.ntdv.lab.eng.bos.redhat.com (wsfd-netdev90.anl.eng.rdu2.dc.redhat.com [10.6.38.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id 01EDA40BB24; Tue, 23 Apr 2024 11:53:34 +0000 (UTC) From: Xavier Simonart To: xsimonar@redhat.com, dev@openvswitch.org Date: Tue, 23 Apr 2024 13:53:32 +0200 Message-Id: <20240423115333.2796843-5-xsimonar@redhat.com> In-Reply-To: <20240423115333.2796843-1-xsimonar@redhat.com> References: <20240423115333.2796843-1-xsimonar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 4/5] controller: Handle postponed ports claims. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" When a port was claimed by two chassis, both chassis were fighting for the port; a claim was postponed if the port was claimed recently. However, there were two issues: - Not all the flows were properly removed when the remote chassis was claiming the port. - A port was not properly released if claim was postponed when the port_binding was deleted. There were also multiple cases causing ovn-controller to always wake-up immediately as a port was not removed from postponed_port list. - Changing port type to localport while port claim was postponed. - Deleting parent of a container port while parent was postponed. Signed-off-by: Xavier Simonart Acked-by: Numan Siddique --- controller/binding.c | 29 +++++++++++++++++++++++++++-- tests/ovn.at | 10 ++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index 1499ceae1..0bef5dc42 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -1270,6 +1270,18 @@ update_port_additional_encap_if_needed( return true; } +static bool +is_requested_additional_chassis(const struct sbrec_port_binding *pb, + const struct sbrec_chassis *chassis_rec) +{ + for (size_t i = 0; i < pb->n_requested_additional_chassis; i++) { + if (pb->requested_additional_chassis[i] == chassis_rec) { + return true; + } + } + return false; +} + bool is_additional_chassis(const struct sbrec_port_binding *pb, const struct sbrec_chassis *chassis_rec) @@ -1587,6 +1599,15 @@ consider_vif_lport_(const struct sbrec_port_binding *pb, b_ctx_out->if_mgr); } } + if (pb->chassis != b_ctx_in->chassis_rec + && !is_requested_additional_chassis(pb, b_ctx_in->chassis_rec) + && if_status_is_port_claimed(b_ctx_out->if_mgr, + pb->logical_port)) { + update_lport_tracking(pb, b_ctx_out->tracked_dp_bindings, false); + if_status_mgr_remove_ovn_installed(b_ctx_out->if_mgr, + b_lport->lbinding->iface->name, + &b_lport->lbinding->iface->header_.uuid); + } return true; } @@ -1787,7 +1808,8 @@ consider_localport(const struct sbrec_port_binding *pb, struct shash *local_bindings = &b_ctx_out->lbinding_data->bindings; struct local_binding *lbinding = local_binding_find(local_bindings, pb->logical_port); - + /* Make sure there is no previous postponed port claim */ + sset_find_and_delete(b_ctx_out->postponed_ports, pb->logical_port); if (!lbinding) { return true; } @@ -2754,11 +2776,14 @@ handle_deleted_vif_lport(const struct sbrec_port_binding *pb, binding_lport_delete(binding_lports, b_lport); } - if (bound && lbinding && lport_type == LP_VIF) { + if ((lbinding && lport_type == LP_VIF) && + (bound || sset_find_and_delete(b_ctx_out->postponed_ports, + pb->logical_port))) { /* We need to release the container/virtual binding lports (if any) if * deleted 'pb' type is LP_VIF. */ struct binding_lport *c_lport; LIST_FOR_EACH (c_lport, list_node, &lbinding->binding_lports) { + sset_find_and_delete(b_ctx_out->postponed_ports, c_lport->name); remove_local_lports(c_lport->pb->logical_port, b_ctx_out); if (!release_binding_lport(b_ctx_in->chassis_rec, c_lport, !b_ctx_in->ovnsb_idl_txn, diff --git a/tests/ovn.at b/tests/ovn.at index b68678472..74c5bccc0 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -16413,6 +16413,10 @@ ovn_start ovn-nbctl ls-add ls0 ovn-nbctl lsp-add ls0 lsp0 +ovn-nbctl lsp-add ls0 lsp1 +ovn-nbctl lsp-add ls0 lsp2 +check ovn-nbctl lsp-add ls0 lsp-cont1 lsp0 1 + net_add n1 for i in 1 2; do @@ -16426,6 +16430,8 @@ for i in 1 2; do as hv$i ovs-vsctl -- add-port br-int vif \ -- set Interface vif external-ids:iface-id=lsp0 + ovs-vsctl -- add-port br-int vif$i \ + -- set Interface vif$i external-ids:iface-id=lsp$i done # give controllers some time to fight for the port binding @@ -16443,6 +16449,10 @@ max_claims=20 AT_CHECK([test "${hv1_claims}" -le "${max_claims}"], [0], []) AT_CHECK([test "${hv2_claims}" -le "${max_claims}"], [0], []) +check ovn-nbctl --wait=hv lsp-del lsp0 +CHECK_FLOWS_AFTER_RECOMPUTE([hv1], [hv1]) +CHECK_FLOWS_AFTER_RECOMPUTE([hv2], [hv2]) + OVN_CLEANUP([hv1],[hv2]) AT_CLEANUP From patchwork Tue Apr 23 11:53:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Simonart X-Patchwork-Id: 1926503 X-Patchwork-Delegate: nusiddiq@redhat.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Z4JPCoD1; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VP0rW2pCQz1yZt for ; Tue, 23 Apr 2024 21:53:47 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 9A19641499; Tue, 23 Apr 2024 11:53:44 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id LOHqxHFJb8vu; Tue, 23 Apr 2024 11:53:42 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org CD4D541171 Authentication-Results: smtp2.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Z4JPCoD1 Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id CD4D541171; Tue, 23 Apr 2024 11:53:41 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7CCD0C0DCE; Tue, 23 Apr 2024 11:53:41 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id AB176C007C for ; Tue, 23 Apr 2024 11:53:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 7FA7F81754 for ; Tue, 23 Apr 2024 11:53:38 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id HYaHEriQDitu for ; Tue, 23 Apr 2024 11:53:37 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=xsimonar@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 8983E814A9 Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 8983E814A9 Authentication-Results: smtp1.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Z4JPCoD1 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id 8983E814A9 for ; Tue, 23 Apr 2024 11:53:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713873216; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=An3qNu/zBODGwx45AT5KPpPYIW9yu4fUuGNjt6Xa234=; b=Z4JPCoD1orN1UoWOulkjW6sgBVJnulxFfsQaU5EX8PsZtD8wRI/LfHUza4qHMZRlNPQBeA 95eiK92KyamIcvlVqywcqFRfiAV2yeqdvVYKJQYlYQQ9i8lQ3mYOZB7AGTofgoQQZtehY7 nJ/aHTdY5U81jafo0ASoa1wepsWo7FI= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-145-bxfuVO7YNKSj5-o-3xHh1w-1; Tue, 23 Apr 2024 07:53:34 -0400 X-MC-Unique: bxfuVO7YNKSj5-o-3xHh1w-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0DD44385A187 for ; Tue, 23 Apr 2024 11:53:34 +0000 (UTC) Received: from wsfd-netdev90.ntdv.lab.eng.bos.redhat.com (wsfd-netdev90.anl.eng.rdu2.dc.redhat.com [10.6.38.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id 075FB40EE0E; Tue, 23 Apr 2024 11:53:34 +0000 (UTC) From: Xavier Simonart To: xsimonar@redhat.com, dev@openvswitch.org Date: Tue, 23 Apr 2024 13:53:33 +0200 Message-Id: <20240423115333.2796843-6-xsimonar@redhat.com> In-Reply-To: <20240423115333.2796843-1-xsimonar@redhat.com> References: <20240423115333.2796843-1-xsimonar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 5/5] controller: Handle postponed ports release. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2023-May/405107.html Suggested-by: Priyankar Jain Signed-off-by: Xavier Simonart Acked-by: Numan Siddique --- controller/binding.c | 12 +++++++++- tests/ovn.at | 57 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/controller/binding.c b/controller/binding.c index 0bef5dc42..c37066cbe 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -1317,6 +1317,14 @@ lport_maybe_postpone(const char *port_name, long long int now, return true; } +static bool +is_postponed_port(const char *port_name) +{ + struct claimed_port *cp = + (struct claimed_port *) sset_find(&_postponed_ports, port_name); + return !!cp; +} + /* Returns false if lport is not claimed due to 'sb_readonly'. * Returns true otherwise. */ @@ -1491,7 +1499,8 @@ is_binding_lport_this_chassis(struct binding_lport *b_lport, { return (b_lport && b_lport->pb && chassis && (b_lport->pb->chassis == chassis - || is_additional_chassis(b_lport->pb, chassis))); + || is_additional_chassis(b_lport->pb, chassis) + || is_postponed_port(b_lport->pb->logical_port))); } /* Returns 'true' if the 'lbinding' has binding lports of type LP_CONTAINER, @@ -1593,6 +1602,7 @@ consider_vif_lport_(const struct sbrec_port_binding *pb, } if (!lbinding_set || !can_bind) { + remove_related_lport(pb, b_ctx_out); return release_lport(pb, b_ctx_in->chassis_rec, !b_ctx_in->ovnsb_idl_txn, b_ctx_out->tracked_dp_bindings, diff --git a/tests/ovn.at b/tests/ovn.at index 74c5bccc0..b0aba2207 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -37838,3 +37838,60 @@ OVN_CLEANUP([hv1]) AT_CLEANUP ]) + +OVN_FOR_EACH_NORTHD([ +AT_SETUP([Deleting vif while controller fight for port claim]) +ovn_start + +ovn-nbctl ls-add ls0 +ovn-nbctl lsp-add ls0 lsp0 +ovn-nbctl lsp-add ls0 lsp1 + +net_add n1 +for i in 1 2; do + sim_add hv$i + as hv$i + ovs-vsctl add-br br-phys + ovn_attach n1 br-phys 192.168.0.$i +done + +check ovn-nbctl --wait=hv sync +hv1_uuid=$(ovn-sbctl --bare --columns _uuid list chassis hv1) +hv2_uuid=$(ovn-sbctl --bare --columns _uuid list chassis hv2) + +as hv1 ovs-vsctl -- add-port br-int vif1 -- set Interface vif1 external-ids:iface-id=lsp1 +as hv1 ovs-vsctl -- add-port br-int vif -- set Interface vif external-ids:iface-id=lsp0 +wait_for_ports_up + +# Delete vif => store flows w/ only vif1, and no vif +as hv1 ovs-vsctl -- del-port br-int vif +check ovn-nbctl --wait=hv sync +DUMP_FLOWS([hv1], [oflows1]) +sleep_controller hv1 +as hv2 ovs-vsctl -- add-port br-int vif -- set Interface vif external-ids:iface-id=lsp0 +as hv1 ovs-vsctl -- add-port br-int vif -- set Interface vif external-ids:iface-id=lsp0 + +OVS_WAIT_UNTIL([ + chassis=$(ovn-sbctl --bare --columns chassis list port_binding lsp0) + test "$chassis" = $hv2_uuid +]) + +sleep_sb +wake_up_controller hv1 +sleep_controller hv2 + +as hv1 ovs-vsctl -- del-port br-int vif +wake_up_sb +wake_up_controller hv2 + +as hv2 ovs-vsctl -- del-port br-int vif +check ovn-nbctl --wait=hv sync + +DUMP_FLOWS([hv1], [oflows2]) + +check diff oflows1 oflows2 +OVN_CLEANUP([hv1],[hv2]) + +AT_CLEANUP +]) +