From patchwork Mon Jul 17 15:06:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Simonart X-Patchwork-Id: 1808794 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=140.211.166.138; helo=smtp1.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=PxAlwoeI; dkim-atps=neutral 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4R4QR54wGdz20FM for ; Tue, 18 Jul 2023 01:06:57 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 908B581ED5; Mon, 17 Jul 2023 15:06:54 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 908B581ED5 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=PxAlwoeI 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 s2hxom0N-W0k; Mon, 17 Jul 2023 15:06:53 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 82DF681EC6; Mon, 17 Jul 2023 15:06:52 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 82DF681EC6 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C53C5C0DDA; Mon, 17 Jul 2023 15:06:49 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id C25C4C0032 for ; Mon, 17 Jul 2023 15:06:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 8E3BF414C5 for ; Mon, 17 Jul 2023 15:06:47 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 8E3BF414C5 Authentication-Results: smtp4.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PxAlwoeI X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9bVr5aBnkEg6 for ; Mon, 17 Jul 2023 15:06:46 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org B1E3F4137D Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id B1E3F4137D for ; Mon, 17 Jul 2023 15:06:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689606405; 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=P33W1zKxgIoJ1KBX4KTX8uWVMSBo/BnOc/L3dcTB9rQ=; b=PxAlwoeIYaWm8psmAXwi2AMBZkYBsqsYlXwuoA4vfaHpFnZd1regny/18DcIhprhOVzbfl DByb7eRgAEmCjF8femDKQRTZOx7fjJpUoJ2qLOll3f2JvJ8s316M6TcJYYK1NzUoud4Nbn PnPjKz2wa4xqvBLS6TKnrz278pv3Gfs= 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-425-g3O6MOGwOb-GlPAgIjeC3Q-1; Mon, 17 Jul 2023 11:06:42 -0400 X-MC-Unique: g3O6MOGwOb-GlPAgIjeC3Q-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9706E1C08969 for ; Mon, 17 Jul 2023 15:06:42 +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 7F56B4CD0C8; Mon, 17 Jul 2023 15:06:42 +0000 (UTC) From: Xavier Simonart To: xsimonar@redhat.com, dev@openvswitch.org Date: Mon, 17 Jul 2023 17:06:39 +0200 Message-Id: <20230717150641.2069008-2-xsimonar@redhat.com> In-Reply-To: <20230717150641.2069008-1-xsimonar@redhat.com> References: <20230717150641.2069008-1-xsimonar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 1/3] tests: fixed typos in macro logs 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" Fixes: 0794a6edf40b ("qos: fix potential double deletion of ovs idl row") Signed-off-by: Xavier Simonart --- tests/ovn-macros.at | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/ovn-macros.at b/tests/ovn-macros.at index 7c23db514..4898b0bc8 100644 --- a/tests/ovn-macros.at +++ b/tests/ovn-macros.at @@ -848,8 +848,8 @@ wake_up_sb() { AT_CHECK([kill -CONT $(cat ovn-sb/ovsdb-server.pid)]) } sleep_controller() { - echo Controller $hv going to sleep hv=$1 + echo Controller $hv going to sleep as $hv check ovn-appctl debug/pause OVS_WAIT_UNTIL([test x$(ovn-appctl -t ovn-controller debug/status) = "xpaused"]) @@ -869,7 +869,7 @@ sleep_ovs() { wake_up_ovs() { hv=$1 - echo ovs $hv going to sleep + echo ovs $hv going to wake-up AT_CHECK([kill -CONT $(cat $hv/ovs-vswitchd.pid)]) } From patchwork Mon Jul 17 15:06:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Simonart X-Patchwork-Id: 1808792 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=140.211.166.137; helo=smtp4.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=BmVOFE3z; dkim-atps=neutral Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (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 4R4QR169q9z20FK for ; Tue, 18 Jul 2023 01:06:53 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id E2641415FB; Mon, 17 Jul 2023 15:06:50 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org E2641415FB 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=BmVOFE3z X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id r52av357JgDv; Mon, 17 Jul 2023 15:06:49 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id 86A2F414C5; Mon, 17 Jul 2023 15:06:48 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 86A2F414C5 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 435B5C0072; Mon, 17 Jul 2023 15:06:48 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5EFFDC0032 for ; Mon, 17 Jul 2023 15:06:46 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 25FD081B53 for ; Mon, 17 Jul 2023 15:06:46 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 25FD081B53 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=BmVOFE3z 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 dBF_OYsUAvyB for ; Mon, 17 Jul 2023 15:06:45 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 3845481947 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 3845481947 for ; Mon, 17 Jul 2023 15:06:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689606404; 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=Lo9dvlcCI4d+UFRbrNGJqpnfE8WWFQv+gDBowsyW5dQ=; b=BmVOFE3zlrXlRJ8dGnEfYg7BMIzWkAz4W7hmB8qt2AB1Ln8lnKYR7d4OvYjZQVOhpOWjj8 6jsNR9+neiqJZiicrf+j7NjcSQ2CwpaxPmIkeCSfkSKSomTBNnnvJYup909ssRdGEdKcay qgYO9hETuT1GYcXuXjZeT4fzlH+JqYw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-407-KLkc7tFHNearMcWPVNA8Pw-1; Mon, 17 Jul 2023 11:06:43 -0400 X-MC-Unique: KLkc7tFHNearMcWPVNA8Pw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B688B88D06E for ; Mon, 17 Jul 2023 15:06:42 +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 9EDFC4CD0F1; Mon, 17 Jul 2023 15:06:42 +0000 (UTC) From: Xavier Simonart To: xsimonar@redhat.com, dev@openvswitch.org Date: Mon, 17 Jul 2023 17:06:40 +0200 Message-Id: <20230717150641.2069008-3-xsimonar@redhat.com> In-Reply-To: <20230717150641.2069008-1-xsimonar@redhat.com> References: <20230717150641.2069008-1-xsimonar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 2/3] binding: fixed ovn-installed not properly removed (migration) 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" Fixed another potential race condition causing ovn-controller to not properly remove ovn-install. Before this patch, ovn-installed was not removed if an hypervisor was receiving the port_binding->chassis change (to another hv) within the same idl as the requested-chassis change. This caused random failures to test "options:multiple requested-chassis for logical port" Signed-off-by: Xavier Simonart --- controller/binding.c | 13 +++++++++++-- controller/if-status.c | 19 ++++++++++++++++--- controller/if-status.h | 2 ++ tests/ovn.at | 29 +++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 5 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index f619aba2e..75319c4e7 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -1506,8 +1506,9 @@ release_lport(const struct sbrec_port_binding *pb, if (!release_lport_additional_chassis(pb, chassis_rec, sb_readonly)) { return false; } + } else { + VLOG_INFO("Releasing lport %s", pb->logical_port); } - update_lport_tracking(pb, tracked_datapaths, false); if_status_mgr_release_iface(if_mgr, pb->logical_port); return true; @@ -1616,8 +1617,16 @@ consider_vif_lport_(const struct sbrec_port_binding *pb, } if (pb->chassis == b_ctx_in->chassis_rec - || is_additional_chassis(pb, b_ctx_in->chassis_rec)) { + || is_additional_chassis(pb, b_ctx_in->chassis_rec) + || if_status_is_port_claimed(b_ctx_out->if_mgr, + pb->logical_port)) { /* Release the lport if there is no lbinding. */ + if (lbinding_set && !can_bind) { + if_status_mgr_remove_ovn_installed(b_ctx_out->if_mgr, + b_lport->lbinding->iface->name, + &b_lport->lbinding->iface->header_.uuid); + } + if (!lbinding_set || !can_bind) { return release_lport(pb, b_ctx_in->chassis_rec, !b_ctx_in->ovnsb_idl_txn, diff --git a/controller/if-status.c b/controller/if-status.c index b45208746..6c5afc866 100644 --- a/controller/if-status.c +++ b/controller/if-status.c @@ -71,12 +71,12 @@ enum if_state { * but not yet marked "up" in the binding module (in * SB and OVS databases). */ - OIF_MARK_DOWN, /* Released interface but not yet marked "down" in - * the binding module (in SB and/or OVS databases). - */ OIF_INSTALLED, /* Interface flows programmed in OVS and binding * marked "up" in the binding module. */ + OIF_MARK_DOWN, /* Released interface but not yet marked "down" in + * the binding module (in SB and/or OVS databases). + */ OIF_UPDATE_PORT, /* Logical ports need to be set down, and pb->chassis * removed. */ @@ -820,3 +820,16 @@ 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/ovn.at b/tests/ovn.at index f2148faac..11da1bd78 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -14499,6 +14499,35 @@ wait_column "$hv1_uuid" Port_Binding requested_additional_chassis logical_port=l check ovn-nbctl lsp-set-options lsp0 requested-chassis=hv2 wait_column "" Port_Binding additional_encap logical_port=lsp0 +# Migration with some race conditions +check ovn-nbctl lsp-set-options lsp0 \ + requested-chassis=hv2,hv1 +wait_column "$hv2_uuid" Port_Binding chassis logical_port=lsp0 +wait_column "$hv2_uuid" Port_Binding requested_chassis logical_port=lsp0 +wait_column "$hv1_uuid" Port_Binding additional_chassis logical_port=lsp0 +wait_column "$hv1_uuid" Port_Binding requested_additional_chassis logical_port=lsp0 + +# Check ovn-installed updated for both chassis +wait_for_ports_up + +for hv in hv1 hv2; do + OVS_WAIT_UNTIL([test `as $hv ovs-vsctl get Interface lsp0 external_ids:ovn-installed` = '"true"']) +done + +# Complete moving the binding to the new location +sleep_controller hv2 +check ovn-nbctl lsp-set-options lsp0 requested-chassis=hv1 + +wait_column "$hv1_uuid" Port_Binding chassis logical_port=lsp0 +wait_column "$hv1_uuid" Port_Binding requested_chassis logical_port=lsp0 +wait_column "" Port_Binding additional_chassis logical_port=lsp0 +wait_column "" Port_Binding requested_additional_chassis logical_port=lsp0 +wake_up_controller hv2 +# Check ovn-installed updated for main chassis and removed from additional chassis +wait_for_ports_up +OVS_WAIT_UNTIL([test `as hv1 ovs-vsctl get Interface lsp0 external_ids:ovn-installed` = '"true"']) +OVS_WAIT_UNTIL([test x`as hv2 ovs-vsctl get Interface lsp0 external_ids:ovn-installed` = x]) + OVN_CLEANUP([hv1],[hv2]) AT_CLEANUP From patchwork Mon Jul 17 15:06:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Simonart X-Patchwork-Id: 1808795 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=140.211.166.137; helo=smtp4.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=WisJle7D; dkim-atps=neutral Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (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 4R4QS904p5z20FK for ; Tue, 18 Jul 2023 01:07:52 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 33284415F4; Mon, 17 Jul 2023 15:07:51 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 33284415F4 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=WisJle7D X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id q8AP5Ummv7Al; Mon, 17 Jul 2023 15:07:49 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id D899C415FD; Mon, 17 Jul 2023 15:07:48 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org D899C415FD Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id A467FC0032; Mon, 17 Jul 2023 15:07:48 +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 2D002C0032 for ; Mon, 17 Jul 2023 15:07:48 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id A10F181ED3 for ; Mon, 17 Jul 2023 15:07:36 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org A10F181ED3 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=WisJle7D 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 AFH6nSL5W7QB for ; Mon, 17 Jul 2023 15:07:36 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org EBAD181E20 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 EBAD181E20 for ; Mon, 17 Jul 2023 15:07:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689606451; 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=xTBIzEy9hHPThu2dgVxoxDMtq4rQYrclJkLoirguB5w=; b=WisJle7D5wpm8mE729aSwC4fQLRRsZH2NL5I3vH79cho6UwbFgtpcbWuSMKfExumT/liFd 2ZIIoLyMK8VZ6lHcFFTO2VGx+tzerbdEizD7lvaUlgbc6xBqGPQMe2Bo2+aetgZy8yjw+/ dw7EgvZcDDSi0aw6Ckm0x5ichupPhYM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-453-Hx4uKN9-PFqQZk8J3lfyaw-1; Mon, 17 Jul 2023 11:06:45 -0400 X-MC-Unique: Hx4uKN9-PFqQZk8J3lfyaw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D62B186801C for ; Mon, 17 Jul 2023 15:06:42 +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 BE7934CD0C8; Mon, 17 Jul 2023 15:06:42 +0000 (UTC) From: Xavier Simonart To: xsimonar@redhat.com, dev@openvswitch.org Date: Mon, 17 Jul 2023 17:06:41 +0200 Message-Id: <20230717150641.2069008-4-xsimonar@redhat.com> In-Reply-To: <20230717150641.2069008-1-xsimonar@redhat.com> References: <20230717150641.2069008-1-xsimonar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 3/3] binding: fixed ovn-installed not properly removed (recomputes) 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, while a port was claimed, a recompute is triggered at the same time as the iface-id is removed, this was resulting in ovn-installed not being properly removed. Signed-off-by: Xavier Simonart --- controller/binding.c | 8 ++++++ tests/ovn-macros.at | 9 +++++++ tests/ovn.at | 64 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+) diff --git a/controller/binding.c b/controller/binding.c index 75319c4e7..66799fa4a 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -2037,6 +2037,14 @@ build_local_bindings(struct binding_ctx_in *b_ctx_in, update_local_lports(iface_id, b_ctx_out); smap_replace(b_ctx_out->local_iface_ids, iface_rec->name, iface_id); + } else if (smap_get_bool(&iface_rec->external_ids, + OVN_INSTALLED_EXT_ID, false)) { + /* Interface should not be claimed (ovn_installed). + * This can happen if iface-id was removed as we recompute. + */ + if_status_mgr_remove_ovn_installed(b_ctx_out->if_mgr, + iface_rec->name, + &iface_rec->header_.uuid); } } } diff --git a/tests/ovn-macros.at b/tests/ovn-macros.at index 4898b0bc8..13d5dc3d4 100644 --- a/tests/ovn-macros.at +++ b/tests/ovn-macros.at @@ -873,6 +873,15 @@ wake_up_ovs() { AT_CHECK([kill -CONT $(cat $hv/ovs-vswitchd.pid)]) } +sleep_ovsdb() { + echo OVSDB $1 going to sleep + AT_CHECK([kill -STOP $(cat $1/ovsdb-server.pid)]) +} +wake_up_ovsdb() { + echo OVSDB $1 waking up + AT_CHECK([kill -CONT $(cat $1/ovsdb-server.pid)]) +} + OVS_END_SHELL_HELPERS m4_define([OVN_POPULATE_ARP], [AT_CHECK(ovn_populate_arp__, [0], [ignore])]) diff --git a/tests/ovn.at b/tests/ovn.at index 11da1bd78..882a548db 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -36594,6 +36594,70 @@ wake_up_controller hv-1 # Make sure ovn-controller is still OK ovn-nbctl --wait=hv sync 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([ovn-install and recomputes]) +AT_KEYWORDS([ovn-install]) + +ovn_start +check ovn-nbctl ls-add ls1 +check ovn-nbctl --wait=sb add Logical-Switch ls1 other_config vlan-passthru=true +net_add n + +sim_add hv1 +as hv1 +ovs-vsctl add-br br-phys +ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys +ovn_attach n br-phys 192.168.0.1 + +check ovn-nbctl --wait=hv sync + +check ovn-nbctl lsp-add ls1 lsp1 +check ovn-nbctl lsp-add ls1 lsp2 +as hv1 ovs-vsctl --no-wait -- add-port br-int vif1 \ + -- set Interface vif1 external_ids:iface-id=lsp1 \ + -- set Interface vif1 type=internal +as hv1 ovs-vsctl --no-wait -- add-port br-int vif2 \ + -- set Interface vif2 external_ids:iface-id=lsp2 \ + -- set Interface vif2 type=internal +wait_for_ports_up +check ovn-nbctl --wait=hv sync + +sleep_ovsdb hv1 + +# Do following operations through one nbctl command +# Otherwise, they would probably result in multiple sb updates to ovn-controller +# As ovsdb is sleeping those multiple updates would resulti in requests to ovsdb being +# postponed as ovsdb becomes ro. +# Hence, patch port creation would be delayed after ovsdb becomes rw. +check ovn-nbctl --wait=hv lsp-add ls1 ln1 \ + -- lsp-set-addresses ln1 unknown \ + -- lsp-set-type ln1 localnet \ + -- lsp-set-options ln1 network_name=phys + +# Controller should now have created the patch port, but is not yet notified of the ofport of those interfaces +sleep_controller hv1 +wake_up_ovsdb hv1 +check as hv1 ovs-vsctl remove Interface vif1 external_ids iface-id + +# Now wake up controller. It should receive patch port ofport and iface vif1 removal notification +wake_up_controller hv1 +check as hv1 ovs-vsctl --no-wait -- del-port vif2 + +# Check ovn-install has been removed. +OVS_WAIT_UNTIL([test x`as hv1 ovs-vsctl get Interface vif2 external_ids:ovn-installed` = x]) +OVS_WAIT_UNTIL([test x`as hv1 ovs-vsctl get Interface vif1 external_ids:ovn-installed` = x]) + +# Check ports are down +OVS_WAIT_UNTIL([test `ovn-sbctl get Port_Binding lsp1 up` = 'false']) +OVS_WAIT_UNTIL([test `ovn-sbctl get Port_Binding lsp2 up` = 'false']) + +# Check ports are unbound +wait_column "" Port_Binding chassis logical_port=lsp1 +wait_column "" Port_Binding chassis logical_port=lsp2 +OVN_CLEANUP([hv1]) AT_CLEANUP ])