From patchwork Thu Feb 18 01:12:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1441472 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.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DgxXF5mxnz9sRN for ; Thu, 18 Feb 2021 12:12:43 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 26EAA86004; Thu, 18 Feb 2021 01:12:39 +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 07NIWuZRzJ5d; Thu, 18 Feb 2021 01:12:37 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 2B9A385F91; Thu, 18 Feb 2021 01:12:37 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0B58CC0010; Thu, 18 Feb 2021 01:12:37 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 9AEB5C000D for ; Thu, 18 Feb 2021 01:12:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 8EBED86FF9 for ; Thu, 18 Feb 2021 01:12:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PBf2E+9MZeOy for ; Thu, 18 Feb 2021 01:12:33 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by hemlock.osuosl.org (Postfix) with ESMTPS id 31D3A86F3F for ; Thu, 18 Feb 2021 01:12:32 +0000 (UTC) X-Originating-IP: 75.54.222.30 Received: from sigfpe.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id A2B4F4000F; Thu, 18 Feb 2021 01:12:29 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Wed, 17 Feb 2021 17:12:16 -0800 Message-Id: <20210218011221.1354839-2-blp@ovn.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210218011221.1354839-1-blp@ovn.org> References: <20210218011221.1354839-1-blp@ovn.org> MIME-Version: 1.0 Cc: Leonid Ryzhyk , Ben Pfaff , Dumitru Ceara Subject: [ovs-dev] [PATCH ovn v10 1/6] Export `VLOG_WARN` and `VLOG_ERR` from libovn for use in ddlog 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: Leonid Ryzhyk Export `ddlog_warn` and `ddlog_err` functions that are just wrappers around `VLOG_WARN` and `VLOG_ERR`. This is not ideal because the functions are exported by `ovn_util.c` and the resulting log messages use `ovn_util` as module name. More importantly, these functions do not do log rate limiting. Signed-off-by: Leonid Ryzhyk Signed-off-by: Ben Pfaff Acked-by: Dumitru Ceara --- TODO.rst | 6 ++++++ lib/ovn-util.c | 15 +++++++++++++++ lib/ovn-util.h | 5 +++++ 3 files changed, 26 insertions(+) diff --git a/TODO.rst b/TODO.rst index c15815539f4f..ecfe62870fb0 100644 --- a/TODO.rst +++ b/TODO.rst @@ -153,6 +153,12 @@ OVN To-do List hashtable lookup in parse_port_group() which can be avoided when we are sure that the Southbound DB uses the new format. +* ovn-northd-ddlog: Calls to warn() and err() from DDlog code would be + better refactored to use the Warning[] relation (and introduce an + Error[] relation once we want to issue some errors that way). This + would be easier with some improvements in DDlog to more easily + output to multiple relations from a single production. + * IP Multicast Relay * When connecting bridged logical switches (localnet) to logical routers diff --git a/lib/ovn-util.c b/lib/ovn-util.c index b6471063ef7e..a5e0ecd214b2 100644 --- a/lib/ovn-util.c +++ b/lib/ovn-util.c @@ -758,3 +758,18 @@ ovn_get_internal_version(void) sbrec_get_db_version(), N_OVNACTS, OVN_INTERNAL_MINOR_VER); } + +#ifdef DDLOG +/* Callbacks used by the ddlog northd code to print warnings and errors. */ +void +ddlog_warn(const char *msg) +{ + VLOG_WARN("%s", msg); +} + +void +ddlog_err(const char *msg) +{ + VLOG_ERR("%s", msg); +} +#endif diff --git a/lib/ovn-util.h b/lib/ovn-util.h index 08234611838a..55c7bf382a95 100644 --- a/lib/ovn-util.h +++ b/lib/ovn-util.h @@ -261,4 +261,9 @@ BUILD_ASSERT_DECL(SCTP_INIT_CHUNK_LEN == sizeof(struct sctp_init_chunk)); /* See RFC 4960 Sections 3.3.7 and 8.5.1 for information on this flag. */ #define SCTP_ABORT_CHUNK_FLAG_T (1 << 0) +#ifdef DDLOG +void ddlog_warn(const char *msg); +void ddlog_err(const char *msg); +#endif + #endif