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