From patchwork Tue Jul 18 09:53:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Simonart X-Patchwork-Id: 1809133 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=) 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=gWZKzntL; dkim-atps=neutral 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4R4vRG2Qqlz20Cs for ; Tue, 18 Jul 2023 19:53:46 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 7350D40C2D; Tue, 18 Jul 2023 09:53:42 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 7350D40C2D 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=gWZKzntL X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1-0MTCMYK4_A; Tue, 18 Jul 2023 09:53:41 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id 5DD4B40C16; Tue, 18 Jul 2023 09:53:40 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 5DD4B40C16 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 319D0C0DD6; Tue, 18 Jul 2023 09:53:38 +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 57953C0032 for ; Tue, 18 Jul 2023 09:53:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 25E7580F26 for ; Tue, 18 Jul 2023 09:53:36 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 25E7580F26 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=gWZKzntL X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GggxvdNvR5ij for ; Tue, 18 Jul 2023 09:53:35 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org ED3FC80E6E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id ED3FC80E6E for ; Tue, 18 Jul 2023 09:53:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689674013; 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=t1n0KQZxEDSx8o1hoTzk4v6iqeSk0pG1zWZKp+gshAE=; b=gWZKzntLBW9C1kcnfQigJVpmHXhV2BUUQHNbXXOaRdLhRHNqzGqnBEUynu7x2948KZj2AV Us/rL9pJf5vzNpYyIgsa04zPqz7I6WEx2/63ARBgGCUH0nCufhv0XwRlz06bQ9R5ZIX54g pyaVU9GiobCmNL9GFOnbWRDO/e6tN5Y= Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-668-TjYRbTD1PbuJ0MMIRUP06g-1; Tue, 18 Jul 2023 05:53:32 -0400 X-MC-Unique: TjYRbTD1PbuJ0MMIRUP06g-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 490DF29AA388 for ; Tue, 18 Jul 2023 09:53:32 +0000 (UTC) Received: from wsfd-netdev90.ntdv.lab.eng.bos.redhat.com (wsfd-netdev90.ntdv.lab.eng.bos.redhat.com [10.19.188.196]) by smtp.corp.redhat.com (Postfix) with ESMTP id 315331454142; Tue, 18 Jul 2023 09:53:32 +0000 (UTC) From: Xavier Simonart To: xsimonar@redhat.com, dev@openvswitch.org Date: Tue, 18 Jul 2023 11:53:31 +0200 Message-Id: <20230718095331.2443200-4-xsimonar@redhat.com> In-Reply-To: <20230718095331.2443200-1-xsimonar@redhat.com> References: <20230718095331.2443200-1-xsimonar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 3/3] ovn-controller: remove un-necessary "trying to release" warnings 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 is added and deleted in the same loop by ovn-controller this was causing the following warning if_status|WARN|Trying to release unknown interface We now avoid the warning in that ascenario. Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=2222252 Signed-off-by: Xavier Simonart Acked-by: Ales Musil --- controller/binding.c | 12 ++++++++++-- controller/if-status.c | 12 ++++++++++++ controller/if-status.h | 2 ++ tests/ofproto-macros.at | 4 ++-- tests/ovn.at | 27 +++++++++++++++++++++++++++ 5 files changed, 53 insertions(+), 4 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index f619aba2e..bc7adb048 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -2682,7 +2682,13 @@ handle_deleted_lport(const struct sbrec_port_binding *pb, if (ld) { remove_pb_from_local_datapath(pb, b_ctx_out, ld); - if_status_mgr_release_iface(b_ctx_out->if_mgr, pb->logical_port); + /* Only try to release the port if it was ever claimed. + * If a port was added and deleted within the same ovn-controller loop, + * it is seen as never claimed. + */ + if (if_status_is_port_claimed(b_ctx_out->if_mgr, pb->logical_port)) { + if_status_mgr_release_iface(b_ctx_out->if_mgr, pb->logical_port); + } return; } @@ -2706,7 +2712,9 @@ handle_deleted_lport(const struct sbrec_port_binding *pb, remove_pb_from_local_datapath(pb, b_ctx_out, ld); } - if_status_mgr_release_iface(b_ctx_out->if_mgr, pb->logical_port); + if (if_status_is_port_claimed(b_ctx_out->if_mgr, pb->logical_port)) { + if_status_mgr_release_iface(b_ctx_out->if_mgr, pb->logical_port); + } } } diff --git a/controller/if-status.c b/controller/if-status.c index b45208746..faf4e1f67 100644 --- a/controller/if-status.c +++ b/controller/if-status.c @@ -820,3 +820,15 @@ if_status_mgr_get_memory_usage(struct if_status_mgr *mgr, simap_increase(usage, "if_status_mgr_ifaces_state_usage-KB", ROUND_UP(ifaces_state_usage, 1024) / 1024); } + +bool +if_status_is_port_claimed(const struct if_status_mgr *mgr, + const char *iface_id) +{ + struct ovs_iface *iface = shash_find_data(&mgr->ifaces, iface_id); + if (!iface || (iface->state > OIF_INSTALLED)) { + return false; + } else { + return true; + } +} diff --git a/controller/if-status.h b/controller/if-status.h index 15624bcfa..9714f6d8d 100644 --- a/controller/if-status.h +++ b/controller/if-status.h @@ -62,5 +62,7 @@ uint16_t if_status_mgr_iface_get_mtu(const struct if_status_mgr *mgr, const char *iface_id); bool if_status_mgr_iface_update(const struct if_status_mgr *mgr, const struct ovsrec_interface *iface_rec); +bool if_status_is_port_claimed(const struct if_status_mgr *mgr, + const char *iface_id); # endif /* controller/if-status.h */ diff --git a/tests/ofproto-macros.at b/tests/ofproto-macros.at index b0101330f..07ef1d092 100644 --- a/tests/ofproto-macros.at +++ b/tests/ofproto-macros.at @@ -250,11 +250,11 @@ m4_define([OVS_VSWITCHD_START], # check_logs scans through all *.log files (except '*.log' and '*testsuite.log') # and reports all WARN, ERR, EMER log entries. User can add custom sed filters -# in $1. +# in $1 and select folder with $2. m4_divert_push([PREPARE_TESTS]) check_logs () { local logs - for log in *.log; do + for log in ./$2/*.log; do case ${log} in # ( '*.log'|*testsuite.log) ;; # ( *) logs="${logs} ${log}" ;; diff --git a/tests/ovn.at b/tests/ovn.at index f2148faac..f57e0f263 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -36568,3 +36568,30 @@ OVS_WAIT_UNTIL([test $(as hv-1 ovs-vsctl list qos | grep -c linux-htb) -eq 1]) AT_CLEANUP ]) + +OVN_FOR_EACH_NORTHD([ +AT_SETUP([Add and delete port]) +ovn_start + +net_add n1 + +sim_add hv1 +as hv1 +check ovs-vsctl add-br br-phys +ovn_attach n1 br-phys 192.168.0.11 + +check ovn-nbctl ls-add ls0 +check ovn-nbctl --wait=hv lsp-add ls0 lsp1 +as hv1 check ovs-vsctl -- add-port br-int lsp1 -- \ + set Interface lsp1 external-ids:iface-id=lsp1 + +wait_for_ports_up +sleep_controller hv1 +check ovn-nbctl --wait=sb lsp-add ls0 lsp0 +check ovn-nbctl --wait=sb lsp-del lsp0 +wake_up_controller hv1 +AT_CHECK([check_logs [""] hv1]) +OVN_CLEANUP([hv1]) + +AT_CLEANUP +])