From patchwork Sat Aug 21 04:58:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Numan Siddique X-Patchwork-Id: 1519226 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Gs5rh4dp2z9sW8 for ; Sat, 21 Aug 2021 14:59:14 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 70C73605EB; Sat, 21 Aug 2021 04:59:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pZvi_K0AblcH; Sat, 21 Aug 2021 04:59:08 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id DBB8360602; Sat, 21 Aug 2021 04:59:07 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id AE8D5C0010; Sat, 21 Aug 2021 04:59:07 +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 6817EC000E for ; Sat, 21 Aug 2021 04:59:06 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 5678B42567 for ; Sat, 21 Aug 2021 04:59:06 +0000 (UTC) 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 Tu9FriJh08e2 for ; Sat, 21 Aug 2021 04:59:02 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by smtp4.osuosl.org (Postfix) with ESMTPS id D4BB042564 for ; Sat, 21 Aug 2021 04:59:01 +0000 (UTC) Received: (Authenticated sender: numans@ovn.org) by relay11.mail.gandi.net (Postfix) with ESMTPSA id CBBCE100002; Sat, 21 Aug 2021 04:58:57 +0000 (UTC) From: numans@ovn.org To: dev@openvswitch.org Date: Sat, 21 Aug 2021 00:58:46 -0400 Message-Id: <20210821045846.2740435-1-numans@ovn.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Cc: Vladislav Odintsov Subject: [ovs-dev] [PATCH ovn] controller: Don't allocate zone ids for non-VIF port bindings. 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" From: Numan Siddique The commit 6fb87aad8c3("controller: Improve ct zone handling.") caused a regression. After this commit ovn-controller is allocating zone id for non VIF port bindings and this is causing unexpected behavior. This patch fixes this issue. Also added a test case to cover this scenario. Fixes: 6fb87aad8c3("controller: Improve ct zone handling.") Reported-by: Vladislav Odintsov Signed-off-by: Numan Siddique Tested-by: Vladislav Odintsov --- controller/ovn-controller.c | 5 +++ tests/ovn.at | 69 +++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index 678419ab3..739048cf8 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -1919,6 +1919,11 @@ ct_zones_runtime_data_handler(struct engine_node *node, void *data) struct shash_node *shash_node; SHASH_FOR_EACH (shash_node, &tdp->lports) { struct tracked_lport *t_lport = shash_node->data; + if (strcmp(t_lport->pb->type, "")) { + /* We allocate zone-id's only to VIF lports. */ + continue; + } + if (t_lport->tracked_type == TRACKED_RESOURCE_NEW) { if (!simap_contains(&ct_zones_data->current, t_lport->pb->logical_port)) { diff --git a/tests/ovn.at b/tests/ovn.at index f1ebb088b..9329dd828 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -28041,3 +28041,72 @@ primary lport : [[sw0-port2]] OVN_CLEANUP([hv1]) AT_CLEANUP ]) + +OVN_FOR_EACH_NORTHD([ +AT_SETUP([ovn-controller ct zone I-P handling]) +ovn_start + +net_add n1 + +sim_add hv1 +as hv1 +ovs-vsctl add-br br-phys +ovn_attach n1 br-phys 192.168.0.1 + +check as hv1 ovs-vsctl add-port br-int vif11 \ + -- set interface vif11 external_ids:iface-id=sw0-port1 + +ovn-nbctl ls-add sw0 +ovn-nbctl lsp-add sw0 sw0-port1 +ovn-nbctl lsp-set-addresses sw0-port1 "50:54:00:00:00:01 10.0.0.3" + +ovn-nbctl lr-add lr0 +ovn-nbctl lrp-add lr0 lr0-sw0 00:00:00:00:ff:01 10.0.0.1/24 +ovn-nbctl lsp-add sw0 sw0-lr0 +ovn-nbctl lsp-set-type sw0-lr0 router +ovn-nbctl lsp-set-addresses sw0-lr0 00:00:00:00:ff:01 +ovn-nbctl lsp-set-options sw0-lr0 router-port=lr0-sw0 + +wait_for_ports_up sw0-port1 + +AT_CHECK([as hv1 ovn-appctl -t ovn-controller ct-zone-list | \ +grep sw0-port1 -c], [0], [1 +]) + +# There should be no ct-zone id allocated for sw0-lr0 and lr0-sw0 +AT_CHECK([as hv1 ovn-appctl -t ovn-controller ct-zone-list | \ +grep sw0-lr0], [1], []) + +AT_CHECK([as hv1 ovn-appctl -t ovn-controller ct-zone-list | \ +grep lr0-sw0], [1], []) + +check as hv1 ovs-vsctl add-port br-int vif12 \ + -- set interface vif12 external_ids:iface-id=sw1-port1 + +ovn-nbctl ls-add sw1 +ovn-nbctl lsp-add sw1 sw1-port1 + +wait_for_ports_up sw1-port1 +AT_CHECK([as hv1 ovn-appctl -t ovn-controller ct-zone-list | \ +grep sw1-port1 -c], [0], [1 +]) + +# Attach sw1 to lr0 +ovn-nbctl lsp-add sw1 sw1-lr0 +ovn-nbctl lsp-set-type sw1-lr0 router +ovn-nbctl lsp-set-addresses sw1-lr0 00:00:00:00:ff:02 +ovn-nbctl lsp-set-options sw1-lr0 router-port=lr0-sw1 + +# There should be no ct-zone id allocated for sw1-lr0 +AT_CHECK([as hv1 ovn-appctl -t ovn-controller ct-zone-list | \ +grep sw1-lr0], [1], []) + +ovn-nbctl lrp-add lr0 lr0-sw1 00:00:00:00:ff:02 20.0.0.1/24 + +# There should be no ct-zone id allocated for lr0-sw1 +AT_CHECK([as hv1 ovn-appctl -t ovn-controller ct-zone-list | \ +grep lr0-sw1], [1], []) + +OVN_CLEANUP([hv1]) +AT_CLEANUP +])