From patchwork Thu Sep 12 15:45:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Conole X-Patchwork-Id: 1161667 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46Tjlv4tdXz9s00 for ; Fri, 13 Sep 2019 01:45:47 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 8A88FD90; Thu, 12 Sep 2019 15:45:45 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id B3ABAC84 for ; Thu, 12 Sep 2019 15:45:43 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 719D18A8 for ; Thu, 12 Sep 2019 15:45:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9FCC23082B41 for ; Thu, 12 Sep 2019 15:45:42 +0000 (UTC) Received: from dhcp-25.97.bos.redhat.com (unknown [10.18.25.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4953560C57; Thu, 12 Sep 2019 15:45:42 +0000 (UTC) From: Aaron Conole To: dev@openvswitch.org Date: Thu, 12 Sep 2019 11:45:41 -0400 Message-Id: <20190912154541.5171-1-aconole@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Thu, 12 Sep 2019 15:45:42 +0000 (UTC) X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Marcelo Leitner Subject: [ovs-dev] [PATCH] vswitch: ratelimit the device add log X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org It's possible that a port added to the system with certain kinds of invalid parameters will cause the 'could not add' log to be triggered. When this happens, the vswitch run loop can continually re-attempt adding the port. While the parameters remain invalid the vswitch run loop will re-trigger the warning, flooding the syslog. This patch adds a simple rate limit to the log. Signed-off-by: Aaron Conole Acked-by: William Tu --- vswitchd/bridge.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index d921c4ef8..49a6f6a37 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -1816,8 +1816,12 @@ iface_do_create(const struct bridge *br, *ofp_portp = iface_pick_ofport(iface_cfg); error = ofproto_port_add(br->ofproto, netdev, ofp_portp); if (error) { - VLOG_WARN_BUF(errp, "could not add network device %s to ofproto (%s)", - iface_cfg->name, ovs_strerror(error)); + static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); + if (!VLOG_DROP_WARN(&rl)) { + VLOG_WARN_BUF(errp, + "could not add network device %s to ofproto (%s)", + iface_cfg->name, ovs_strerror(error)); + } goto error; }