From patchwork Tue May 2 00:31:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Han Zhou X-Patchwork-Id: 757361 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3wH2Ks2Hgzz9sD9 for ; Tue, 2 May 2017 10:32:01 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="lHP6O/Ei"; dkim-atps=neutral Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 00A7BB66; Tue, 2 May 2017 00:31:58 +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 04FE1898 for ; Tue, 2 May 2017 00:31:58 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-ua0-f196.google.com (mail-ua0-f196.google.com [209.85.217.196]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 06A38142 for ; Tue, 2 May 2017 00:31:55 +0000 (UTC) Received: by mail-ua0-f196.google.com with SMTP id j59so10318464uad.2 for ; Mon, 01 May 2017 17:31:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=yqNY8L3WMTeXEIQmDO5B/9OMasxCmzBBYi/o9sFDg10=; b=lHP6O/EivmJs4bb+d7mBQeH1XPHDnMLU2vFTxHm8DntU7wUh82Gj9Sa7sIVL3byWfy 0rQC/srpTaVNug1LLxYDRNCfM2C7WnsMuPytkNQlf5c2UtdtgzsrbdBXgDhgG72P+X2D DzsyIHaTYaIfYkC/vsdq4S7me4XTbko86JAb60x27NxrwBdTj1iY6ANBn3w6Lx/bnsTG o+TdQIpBf8yB3csMJLLuLrjpnv7tl23Lj5QHdSmsKPHpkKOzOFXn43eF0HNbL7ucfr4y YAAOqZRovjxf5VQyOvvByo6CKC3B7araYi7lcMW0PRa9C44pRQ9LxmbWDfs6GI2DvbwD 8ATQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=yqNY8L3WMTeXEIQmDO5B/9OMasxCmzBBYi/o9sFDg10=; b=PjF79cXcu2MmljDoe4EzlRgLHRekMtEIBlnVv6C/OjKAmxyO2rHpORVt722kM8q31j uYo/0PiD8Mn02dkBFiDodZPtz/XOOnrFGnrovUSp2zYhKO/3hMA17qEXXyvR6VBLPO7S 6ek/HmCw1v6y5kiWb4/YOzvz4qdw5tk4pV7/3TK5PCRVkMF71o609HDN9wuWzYqk5wxR TBpoNv93DTn2NTcfdMc7proe+b9TI3QBZ1vK8V+4NeJtd6ftUOAbIYnGmbkanxvKZm9a EUqMtxaOOO2qBb+J1/iF341FM3WX/nHqN/lMFwlsGSPEPwPbY3xg4DVANZC8xKFOCg7b nNWg== X-Gm-Message-State: AN3rC/4LG793bUQ56j7pteWSQLXGVtU8kZQvzrncuCSuRT8BKFW7Dfnw KtPpbf5EARxoIMKT6dW4p7X03Cohqo4E X-Received: by 10.176.9.196 with SMTP id e4mr14588541uah.34.1493685115129; Mon, 01 May 2017 17:31:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.144.76 with HTTP; Mon, 1 May 2017 17:31:54 -0700 (PDT) In-Reply-To: <20170501181958.GZ10949@ovn.org> References: <1492539134-43788-1-git-send-email-zhouhan@gmail.com> <20170501181958.GZ10949@ovn.org> From: Han Zhou Date: Mon, 1 May 2017 17:31:54 -0700 Message-ID: To: Ben Pfaff X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org X-Content-Filtered-By: Mailman/MimeDel 2.1.12 Cc: "dev@openvswitch.org" Subject: Re: [ovs-dev] [PATCH v2] Avoid update probe interval to non-zero for unix socket. 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 On Mon, May 1, 2017 at 11:19 AM, Ben Pfaff wrote: > > On Tue, Apr 18, 2017 at 11:12:14AM -0700, Han Zhou wrote: > > In commit c1bfdd9d it disables probe when not needed, but commit > > 715038b6 updates ovn-controller probe interval for OVNSB DB > > periodically according to ovn-remote-probe-interval config, and sets > > it to DEFAULT_PROBE_INTERVAL_MSEC if not configured, even if the > > connection type is unix socket which doesn't need probe. > > > > This fix avoids probe interval update if not needed (always set to 0). > > > > Signed-off-by: Han Zhou > > --- > > > > Notes: > > v1->v2: fix commit id mentioned in commit message. > > Thanks for reporting and fixing this bug. I agree there's a bug here, > but I'd rather honor the user's explicit request to set a nonzero probe > interval, if there is such a request in ovsdb. > > How about this? I have not tested it, beyond verifying that it > compiles. > > Thanks, > > Ben. > Yes, this idea is better. But the code has a problem. > @@ -933,6 +934,8 @@ update_probe_interval(struct controller_ctx *ctx) > ? smap_get_int(&cfg->external_ids, > "ovn-remote-probe-interval", > DEFAULT_PROBE_INTERVAL_MSEC) > - : DEFAULT_PROBE_INTERVAL_MSEC); > + : stream_or_pstream_needs_probes(ovnsb_remote) > + ? DEFAULT_PROBE_INTERVAL_MSEC > + : 0); Here is the fix (tested): --8<--------------------------cut here-------------------------->8-- ovsdb_idl_set_probe_interval(ctx->ovnsb_idl, interval); } diff --git a/ovn/controller/ovn-controller.c b/ovn/controller/ovn-controller.c index e00f57a..d7423ab 100644 --- a/ovn/controller/ovn-controller.c +++ b/ovn/controller/ovn-controller.c @@ -64,7 +64,8 @@ static unixctl_cb_func inject_pkt; #define DEFAULT_BRIDGE_NAME "br-int" #define DEFAULT_PROBE_INTERVAL_MSEC 5000 -static void update_probe_interval(struct controller_ctx *); +static void update_probe_interval(struct controller_ctx *, + const char *ovnsb_remote); static void parse_options(int argc, char *argv[]); OVS_NO_RETURN static void usage(void); @@ -594,7 +595,7 @@ main(int argc, char *argv[]) .ovnsb_idl_txn = ovsdb_idl_loop_run(&ovnsb_idl_loop), }; - update_probe_interval(&ctx); + update_probe_interval(&ctx, ovnsb_remote); update_ssl_config(ctx.ovs_idl); @@ -925,14 +926,21 @@ inject_pkt(struct unixctl_conn *conn, int argc OVS_UNUSED, /* Get the desired SB probe timer from the OVS database and configure it into * the SB database. */ static void -update_probe_interval(struct controller_ctx *ctx) +update_probe_interval(struct controller_ctx *ctx, const char *ovnsb_remote) { const struct ovsrec_open_vswitch *cfg = ovsrec_open_vswitch_first(ctx->ovs_idl); - int interval = (cfg - ? smap_get_int(&cfg->external_ids, - "ovn-remote-probe-interval", - DEFAULT_PROBE_INTERVAL_MSEC) - : DEFAULT_PROBE_INTERVAL_MSEC); + int interval = -1; + if (cfg) { + interval = smap_get_int(&cfg->external_ids, + "ovn-remote-probe-interval", + -1); + } + if (interval == -1) { + interval = stream_or_pstream_needs_probes(ovnsb_remote) + ? DEFAULT_PROBE_INTERVAL_MSEC + : 0; + } +