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 +]) +