From patchwork Mon May 11 14:09:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ihar Hrachyshka X-Patchwork-Id: 1287820 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=silver.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: 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=VEZxEmXU; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49LNBQ39qbz9sSF for ; Tue, 12 May 2020 00:10:38 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 69BAF26046; Mon, 11 May 2020 14:10:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TaHv66A4-Nqy; Mon, 11 May 2020 14:10:32 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id A8AD025D6D; Mon, 11 May 2020 14:10:25 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8DDA3C0892; Mon, 11 May 2020 14:10:25 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 17A00C0176 for ; Mon, 11 May 2020 14:10:23 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 062DE86B23 for ; Mon, 11 May 2020 14:10:23 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Mb9xg3IC7w73 for ; Mon, 11 May 2020 14:10:20 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 4CAB486B5A for ; Mon, 11 May 2020 14:10:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589206215; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KuMGVlXjXUBo9APboj8V6Rka/V71vSD+4gtxOCskTpQ=; b=VEZxEmXUNxjMEB85N8XPVJeA+ntea37JhXT8ZONqpnYE2bb82vXSpjJaIX33jWg2Nv0Qu8 LkjlTIqgNhh6u9ar+2VXUACr8LPIE62bHP0v3uvUAYgYOAsgbPDmOwo8ENYznbU1Wa6olL VkdFYQXEhbVAc6pg1EiaGBbaA1Wsnoo= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-341-Bl-4TurOMQaAc0ZSSZMUyA-1; Mon, 11 May 2020 10:10:13 -0400 X-MC-Unique: Bl-4TurOMQaAc0ZSSZMUyA-1 Received: by mail-qt1-f200.google.com with SMTP id n22so10569396qtp.15 for ; Mon, 11 May 2020 07:10:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KuMGVlXjXUBo9APboj8V6Rka/V71vSD+4gtxOCskTpQ=; b=PxPL2n/wNcogdZlA2Q1kZXa2mFkSU/Mfw9UIsMNjQC6beCMHIZxPOqDcmnZAZLS7ta OUZE2Dp+XHOJIl7+IeXEmXKXeghRWiwJauaPsDyOvH6son4xa8n4Zn8la9ZLeLAbtPRM POJHbrryapTrNaACTfYTUMFZ0xUjrPbLuBA7Ps1W2H318RoQOslJTsAxk/qfLfl7fkJ+ w69K4AtzR8UaWkR/atz4TbMlVfhIM/pqy5GK6wbUf902BURJQY1g4A5HOZRQ6SPGITAL gT+t6yPpTS3fD0TFMLSdnBu0mB9nkavt1pMlHemq3mua+aqXcRWDVj8Ca7zIVo4C8U28 U0fg== X-Gm-Message-State: AGi0PuajzddKGEQ9L5cIs9kFuISa1CDK26wLHcn5ECrHJFa9ZElwz8bA wsI1iqim3DJZ44RkaWUX7QvoYECo/Chc8mE2xQTINes+zISEHlyxPNEYAIh1y7osDRH34qPwr/6 /uvXcMbWQCZW7 X-Received: by 2002:ae9:ebd2:: with SMTP id b201mr15874623qkg.80.1589206212724; Mon, 11 May 2020 07:10:12 -0700 (PDT) X-Google-Smtp-Source: APiQypKvDhiS1e2X58kYpMP5QHZi03aCuIu+ZKdNTpSpdMYvJJFvlgUscUESAAam0daFbeT1pUCkNA== X-Received: by 2002:ae9:ebd2:: with SMTP id b201mr15874595qkg.80.1589206212441; Mon, 11 May 2020 07:10:12 -0700 (PDT) Received: from localhost.localdomain.com (cpe-172-73-180-250.carolina.res.rr.com. [172.73.180.250]) by smtp.googlemail.com with ESMTPSA id i23sm8474661qke.65.2020.05.11.07.10.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 May 2020 07:10:11 -0700 (PDT) From: Ihar Hrachyshka To: dev@openvswitch.org Date: Mon, 11 May 2020 10:09:04 -0400 Message-Id: <20200511140904.209409-7-ihrachys@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200511140904.209409-1-ihrachys@redhat.com> References: <20200511140904.209409-1-ihrachys@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 6/6 v4] Log missing bridge per localnet port just once 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" Having some localnet ports missing a bridge device on a particular chassis is a supported configuration (e.g. used to implement "routed provider networks" for OpenStack) and should not flood logs with duplicate messages. Signed-off-by: Ihar Hrachyshka --- controller/patch.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/controller/patch.c b/controller/patch.c index 52255cc3a..2a757bb00 100644 --- a/controller/patch.c +++ b/controller/patch.c @@ -24,6 +24,7 @@ #include "openvswitch/hmap.h" #include "openvswitch/vlog.h" #include "ovn-controller.h" +#include "sset.h" VLOG_DEFINE_THIS_MODULE(patch); @@ -184,6 +185,8 @@ add_bridge_mappings(struct ovsdb_idl_txn *ovs_idl_txn, const struct sbrec_chassis *chassis, const struct hmap *local_datapaths) { + static struct sset missed_bridges = SSET_INITIALIZER(&missed_bridges); + /* Get ovn-bridge-mappings. */ struct shash bridge_mappings = SHASH_INITIALIZER(&bridge_mappings); @@ -220,20 +223,25 @@ add_bridge_mappings(struct ovsdb_idl_txn *ovs_idl_txn, binding->type, binding->logical_port); continue; } + char *msg_key = xasprintf("%s;%s", binding->logical_port, network); struct ovsrec_bridge *br_ln = shash_find_data(&bridge_mappings, network); if (!br_ln) { - static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1); if (!is_localnet) { + static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1); VLOG_ERR_RL(&rl, "bridge not found for %s port '%s' " "with network name '%s'", binding->type, binding->logical_port, network); } else { - VLOG_INFO_RL(&rl, "bridge not found for localnet port '%s' " - "with network name '%s'; skipping", - binding->logical_port, network); + if (!sset_contains(&missed_bridges, msg_key)) { + VLOG_INFO("bridge not found for localnet port '%s' with " + "network name '%s'; skipping", + binding->logical_port, network); + sset_add(&missed_bridges, msg_key); + } } continue; } + sset_find_and_delete(&missed_bridges, msg_key); const char *patch_port_id; if (is_localnet) {