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