From patchwork Mon Feb 22 09:00:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Huang X-Patchwork-Id: 586077 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (archives.nicira.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 9E4B5140A68 for ; Mon, 22 Feb 2016 20:00:52 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ebay.com header.i=@ebay.com header.b=lwySjZIf; dkim-atps=neutral Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id AE56B10656; Mon, 22 Feb 2016 01:00:51 -0800 (PST) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v3.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 9647110654 for ; Mon, 22 Feb 2016 01:00:50 -0800 (PST) Received: from bar6.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id D05DC16120D for ; Mon, 22 Feb 2016 02:00:49 -0700 (MST) X-ASG-Debug-ID: 1456131648-0b32372f7315830001-byXFYA Received: from mx1-pf2.cudamail.com ([192.168.24.2]) by bar6.cudamail.com with ESMTP id USwbT3qtaHJOZIZS (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 22 Feb 2016 02:00:48 -0700 (MST) X-Barracuda-Envelope-From: lhuang8@ebay.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.2 Received: from unknown (HELO phx-mipot-002.corp.ebay.com) (216.113.172.65) by mx1-pf2.cudamail.com with ESMTPS (RC4-SHA encrypted); 22 Feb 2016 09:00:47 -0000 Received-SPF: pass (mx1-pf2.cudamail.com: SPF record at c._spf.ebay.com designates 216.113.172.65 as permitted sender) X-Barracuda-Apparent-Source-IP: 216.113.172.65 X-Barracuda-RBL-IP: 216.113.172.65 DomainKey-Signature: s=ebaycorp; d=ebay.com; c=nofws; q=dns; h=X-EBay-Corp:X-IronPort-AV:Received:Received:From:To:CC: Subject:Thread-Topic:Thread-Index:Date:Message-ID: References:In-Reply-To:Accept-Language:Content-Language: X-MS-Has-Attach:X-MS-TNEF-Correlator:x-originating-ip: Content-Type:MIME-Version:X-CFilter; b=Agdwv2vnMgh8vMGQmiCP2q5EUgUBK+oNQ6ShONnBBD4OZ4ohNslZfEYO K9Oskw2i7VlGX1bv+4BnXi1s/cTmWJakuYBHGpaTyVtmAH2SP0RsklPBZ Q9mR3xeFpC/lGrF6CF25prvhULBQUQRfT8PX3SzfbXg7qYFYGRCwUjU2Y U=; DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=ebay.com; i=@ebay.com; q=dns/txt; s=ebaycorp; t=1456131648; x=1487667648; h=from:to:cc:subject:date:message-id:references: in-reply-to:mime-version; bh=qkQYdriWsYUVWqbs42H1ecLp0cSDceVBSrmwba0X+SU=; b=lwySjZIfp6SS8hR/P6BYf1Y0688JlVGNTC4+/iYOdMF6aHUw7kZ5R12y hsFvSf7eMhQ3vNgfUscYtvZcPGr4CuC6l7xVpcVtlWTX2QlA84cejj0QE goDdOVpgfwPwr4rGmUgYUFueDmuylnl+w8LM1L1E+gZQ+UtuuRu7kGFxd c=; X-EBay-Corp: Yes X-IronPort-AV: E=Sophos;i="5.22,483,1449558000"; d="scan'208,217";a="313135082" Received: from phx-vteml-003.corp.ebay.com (HELO PHX-EXMHT-003.corp.ebay.com) ([10.58.40.102]) by phx-mipot-002.corp.ebay.com with ESMTP; 22 Feb 2016 02:00:46 -0700 Received: from PHX-EXRDA-S82.corp.ebay.com ([169.254.6.122]) by PHX-EXMHT-003.corp.ebay.com ([10.58.12.74]) with mapi id 14.03.0266.001; Mon, 22 Feb 2016 02:00:44 -0700 X-CudaMail-Envelope-Sender: lhuang8@ebay.com From: "Huang, Lei" To: Andy Zhou , Huang Lei <148012453@qq.com> X-CudaMail-MID: CM-E2-221002206 X-CudaMail-DTE: 022216 X-CudaMail-Originating-IP: 216.113.172.65 Thread-Topic: [ovs-dev] [PATCH] ovn-controller: Add external-ids:ovn-remote-probe-interval X-ASG-Orig-Subj: [##CM-E2-221002206##]Re: [ovs-dev] [PATCH] ovn-controller: Add external-ids:ovn-remote-probe-interval Thread-Index: AQHRbO6m43VM+jmoc0mhSl0ZVt5HtZ83nVgAgAEjPAA= Date: Mon, 22 Feb 2016 09:00:44 +0000 Message-ID: <734B69CF-CBA0-4BFB-AC63-8EE6FB0F167B@ebay.com> References: <1456090006-61013-1-git-send-email-148012453@qq.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [115.199.195.229] MIME-Version: 1.0 X-CFilter: Scanned X-GBUdb-Analysis: 0, 216.113.172.65, Ugly c=0 p=0 Source New X-MessageSniffer-Rules: 0-0-0-29480-c X-Barracuda-Connect: UNKNOWN[192.168.24.2] X-Barracuda-Start-Time: 1456131648 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 3.10 X-Barracuda-Spam-Status: No, SCORE=3.10 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=4.0 tests=BSF_SC0_MISMATCH_TO, BSF_SC0_MV0244, DKIM_SIGNED, HTML_MESSAGE, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.27233 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.00 BSF_SC0_MISMATCH_TO Envelope rcpt doesn't match header 0.00 DKIM_SIGNED Domain Keys Identified Mail: message has a signature 0.00 HTML_MESSAGE BODY: HTML included in message 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS 3.00 BSF_SC0_MV0244 Custom rule MV0244 X-Content-Filtered-By: Mailman/MimeDel 2.1.16 Cc: "" Subject: Re: [ovs-dev] [PATCH] ovn-controller: Add external-ids:ovn-remote-probe-interval X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@openvswitch.org Sender: "dev" Thanks for your review. BR Huang Lei From: Andy Zhou > Date: Monday, February 22, 2016 at 7:38 AM To: Huang Lei <148012453@qq.com> Cc: "dev@openvswitch.org" >, "Huang, Lei" > Subject: Re: [ovs-dev] [PATCH] ovn-controller: Add external-ids:ovn-remote-probe-interval On Sun, Feb 21, 2016 at 1:26 PM, Huang Lei <148012453@qq.com> wrote: From: Huang Lei > For setting the inactivity probe interval of the json session to the OVN southbound database. Signed-off-by: Huang Lei > Thanks for contributing!. Please see comments in line. --- lib/ovsdb-idl.c | 10 ++++++++++ lib/ovsdb-idl.h | 3 +++ ovn/controller/ovn-controller.8.xml | 14 ++++++++++++++ ovn/controller/ovn-controller.c | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+) skip the call to ovsdb_set_probe_interval(). This way, we don't have to provide the default from here. + int main(int argc, char *argv[]) { @@ -260,6 +290,9 @@ main(int argc, char *argv[]) ovsdb_idl_create(ovnsb_remote, &sbrec_idl_class, true, true)); ovsdb_idl_get_initial_snapshot(ovnsb_idl_loop.idl); + int probe_interval = get_ovnsb_remote_probe_interval(ovs_idl_loop.idl); + ovsdb_set_probe_interval(ovnsb_idl_loop.idl, probe_interval); + Currently, connection made over unix domain socket will not enable probe, since probing is not necessary. It seems this patch would enable probing for unix domain socket, did I read the patch wrong? /* Initialize connection tracking zones. */ struct simap ct_zones = SIMAP_INITIALIZER(&ct_zones); unsigned long ct_zone_bitmap[BITMAP_N_LONGS(MAX_CT_ZONES)]; -- 2.5.4 (Apple Git-61) _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c index 7e84138..844d5b1 100644 --- a/lib/ovsdb-idl.c +++ b/lib/ovsdb-idl.c @@ -557,6 +557,16 @@ ovsdb_idl_get_last_error(const struct ovsdb_idl *idl) { return jsonrpc_session_get_last_error(idl->session); } + +/* Sets the "probe interval" for 'idl->session' to 'probe_interval', in + * milliseconds. + */ +void +ovsdb_set_probe_interval(const struct ovsdb_idl *idl, int probe_interval) +{ + jsonrpc_session_set_probe_interval(idl->session, probe_interval); +} + Should this function be called ovsdb_idl_set_probe_interval()? static unsigned char * ovsdb_idl_get_mode(struct ovsdb_idl *idl, diff --git a/lib/ovsdb-idl.h b/lib/ovsdb-idl.h index 136c38c..224914f 100644 --- a/lib/ovsdb-idl.h +++ b/lib/ovsdb-idl.h @@ -68,6 +68,9 @@ void ovsdb_idl_verify_write_only(struct ovsdb_idl *); bool ovsdb_idl_is_alive(const struct ovsdb_idl *); int ovsdb_idl_get_last_error(const struct ovsdb_idl *); + +void ovsdb_set_probe_interval(const struct ovsdb_idl *, int probe_interval); + /* Choosing columns and tables to replicate. */ diff --git a/ovn/controller/ovn-controller.8.xml b/ovn/controller/ovn-controller.8.xml index 6dcc579..4202b59 100644 --- a/ovn/controller/ovn-controller.8.xml +++ b/ovn/controller/ovn-controller.8.xml @@ -100,6 +100,20 @@

+
external_ids:ovn-remote-probe-interval
+
+

+ The inactivity probe interval of the connection to the OVN database, + in milliseconds. + If the value is zero, it disables the connection keepalive feature. +

+ +

+ If 'probe_interval' is nonzero, then it will be forced to a value of + at least 1000 ms +

+
+
external_ids:ovn-encap-type

diff --git a/ovn/controller/ovn-controller.c b/ovn/controller/ovn-controller.c index 02ecb3e..427d121 100644 --- a/ovn/controller/ovn-controller.c +++ b/ovn/controller/ovn-controller.c @@ -33,7 +33,10 @@ #include "ovn/lib/ovn-sb-idl.h" #include "poll-loop.h" #include "fatal-signal.h" +#include "lib/ovsdb-idl.h" #include "lib/vswitch-idl.h" +#include "lib/util.h" +#include "lib/reconnect.h" #include "smap.h" #include "stream.h" #include "stream-ssl.h" @@ -197,6 +200,33 @@ get_ovnsb_remote(struct ovsdb_idl *ovs_idl) } } +/* Retrieves the OVN Southbound remote's json session probe interval from the + * "external-ids:ovn-remote-probe-interval" key in 'ovs_idl' and returns it. + * + * This function Must be called after get_ovnsb_remote(). + * + */ s /Must/must +static int +get_ovnsb_remote_probe_interval(struct ovsdb_idl *ovs_idl) +{ + const struct ovsrec_open_vswitch *cfg = ovsrec_open_vswitch_first(ovs_idl); + if (cfg) { + const char * probe_interval = + smap_get(&cfg->external_ids, "ovn-remote-probe-interval"); + if (probe_interval) { + int ret = 0; + if (str_to_int(probe_interval, 10, & ret)) + { + VLOG_INFO("OVN OVSDB remote probe interval is %d ms", ret); + return ret; + } + } + } + + return RECONNECT_DEFAULT_PROBE_INTERVAL; +} + I think I will be slightly better if get_ovnsb_remote_probe_interval() returns whether the field is set in OVSDB. if it is not set, or can not be read correctly. In those case, we can simply