From patchwork Thu May 4 15:42:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Odintsov X-Patchwork-Id: 1776975 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=b+PBzZkL; dkim-atps=neutral Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QByky3K0Yz213v for ; Fri, 5 May 2023 01:43:06 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 09AC042125; Thu, 4 May 2023 15:43:03 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 09AC042125 Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=b+PBzZkL X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Xh2NNaZcRSfC; Thu, 4 May 2023 15:43:01 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id 16000420A0; Thu, 4 May 2023 15:43:00 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 16000420A0 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id DF784C0037; Thu, 4 May 2023 15:42:59 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6CA85C002A for ; Thu, 4 May 2023 15:42:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 442ED40BD7 for ; Thu, 4 May 2023 15:42:58 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 442ED40BD7 Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=b+PBzZkL X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Cu7258TO156e for ; Thu, 4 May 2023 15:42:57 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 008EA401D5 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by smtp2.osuosl.org (Postfix) with ESMTPS id 008EA401D5 for ; Thu, 4 May 2023 15:42:56 +0000 (UTC) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-4f00d41df22so11018738e87.1 for ; Thu, 04 May 2023 08:42:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683214974; x=1685806974; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ckPAhML8CLPPvuulxmnGzgsz1hXLXiTGKaZt7ZndCoQ=; b=b+PBzZkLHkCyChXWMGN5BgtFiSdY5Js5nt1wZObuwuxH+jwaDAtsxrqUnw0ERwqFGb viHnqvvm4jz9q1rSzcVkTq2I035SPgDjmdlKjbh0EnLGh1q43dO7uA0mntnoRnfEPFt9 C9Zb3yTBwXbdhGODA6kcBa4e+SgCt0BBphQnH7fnphh92rPEXNuccH8RfUqg/LqKGGkj OmWiLT10ksivWRl8RpzDqs9mTNb8TQYTaN2pGM172itvZ9JJRTMbxYnqog7eLiAL0V/l WafXUPEQ8rKpcTRjFrRz4izaM4a7/OWIoohcUhe02gZl5fW00w0hjWtME3ElXE89ZDFd hBtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683214974; x=1685806974; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ckPAhML8CLPPvuulxmnGzgsz1hXLXiTGKaZt7ZndCoQ=; b=SXoroJVRivbFMoq51bYHCArSfRjEMjNT3bLGmGVjmfcKaMbBld6UL5Gg/ovQdALibx vOJUtL6XlvWPfEHkaXBDabdrCG7IHCxRRWScEg1zXjZl6UqFs1zSUYZUbDc2+UY3zq3H ba/auwJk/fsBNOHoG+IA31vjroGvUJI4hw8WE9d6wjJcIS9lFjjLeM+/TKRp/ulcD9UH hyoNtpU4jZnQQ5x1kmm13YEpI02c9HLScNI7Fe5xtKgP4i8GzV8MIszhkdjJcDDLA7zT 385J4GUkJVhzteAB7lu9t0czmEUlb9t/2LADe7JgkphlpYON15CgtcGoljo3uvb63yjU gpbw== X-Gm-Message-State: AC+VfDzYrSJwu9LSLxHKuSUngB1ME20iEr/zMEy54k0wWR/nEq0VrEhn S6LQr/ii9yUJz+FxWvRFob6A/L3kXKc= X-Google-Smtp-Source: ACHHUZ6nujLMGEzR4sgwRaCS0p1lzzGJutGkkHRznLMrBbB1f36RZZ4AmKEIlzL0U99SaJwfqwjYwg== X-Received: by 2002:a19:ac4b:0:b0:4ec:9310:ad4e with SMTP id r11-20020a19ac4b000000b004ec9310ad4emr1753869lfc.33.1683214974104; Thu, 04 May 2023 08:42:54 -0700 (PDT) Received: from ip-10-70-112-12.vpc-1e810be1.internal (c2-178-216-98-9.elastic.cloud.croc.ru. [178.216.98.9]) by smtp.gmail.com with ESMTPSA id y15-20020ac255af000000b004f00333804esm4451531lfg.176.2023.05.04.08.42.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 May 2023 08:42:53 -0700 (PDT) From: Vladislav Odintsov To: dev@openvswitch.org Date: Thu, 4 May 2023 18:42:50 +0300 Message-Id: <20230504154250.4023895-1-odivlad@gmail.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Cc: Vladislav Odintsov Subject: [ovs-dev] [PATCH ovn v3] utilities: increase OVSDB inactivity probe interval for ovn-*ctl 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" For large OVN_Southbound (or other) databases the default interval of 5000 ms could be not sufficient to run. This patch adds configuration of OVSDB inactivity probes for ovn-*ctl utilities. Initially, on the utility start the hardcoded value of 120000 ms is set. For daemon-mode it is possible to configure intervals in OVN Northbound and OVN Southbound databases for ovn-nbctl and ovn-sbctl utilities respectively. Use OVN_Northbound.NB_Global.options.nbctl_probe_interval for ovn-nbctl and OVN_Southbound.SB_Global.options.sbctl_probe_interval for ovn-sbctl utilities. If no DB configuration option was provided, the initial (120000 ms) interval is left. Signed-off-by: Vladislav Odintsov --- v2 -> v3: - Addressed Dumitru's and Mark's suggestion to split ovn-{n,s}bctl configuration option dbctl_probe_interval for nbctl_... and sbctl_... . - Added NEWS entry. - Fixes typos. - Added ovn-sb man entry for new option. - Moved constant from ovn-util.h to ovn-dbctl.h. --- NEWS | 7 +++++++ northd/northd.c | 9 +++++++++ ovn-nb.xml | 18 ++++++++++++++++++ ovn-sb.xml | 25 +++++++++++++++++++++++++ utilities/ovn-dbctl.c | 14 ++++++++++++++ utilities/ovn-dbctl.h | 3 +++ utilities/ovn-ic-nbctl.c | 5 +++++ utilities/ovn-ic-sbctl.c | 5 +++++ utilities/ovn-nbctl.c | 15 +++++++++++++++ utilities/ovn-sbctl.c | 15 +++++++++++++++ 10 files changed, 116 insertions(+) diff --git a/NEWS b/NEWS index fc1b68324..8ae32a81e 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,13 @@ Post v23.03.0 addresses and CIDRs. - Add support to configure OVSDB inactivity probe interval for ovn-ic and ovn-controller-vtep. + - Increased ovn-{ic-,}{n,s}bctl default OVSDB inactivity probe interval from + 5000 ms to 120000 ms to give the ability to connect to large databases + (mainly, OVN_Southbound). Also, for daemon mode it is possible to + configure inactivity probe interval via OVN_Northbound and OVN_Southbound + databases for ovn-nbctl and ovn-sbctl respectively. See man ovn-nb and + man ovn-sb for 'nbctl_probe_interval' and 'sbctl_probe_interval' + options for more details. OVN v23.03.0 - 03 Mar 2023 -------------------------- diff --git a/northd/northd.c b/northd/northd.c index 5f0b436c2..a22ca1c71 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -16259,6 +16259,15 @@ ovnnb_db_run(struct northd_input *input_data, } else { smap_remove(&options, "lb_hairpin_use_ct_mark"); } + + /* Hackaround SB_global.options overwrite by NB_Global.options for + * 'sbctl_probe_interval' option. + */ + const char *sip = smap_get(&sb->options, "sbctl_probe_interval"); + if (sip) { + smap_replace(&options, "sbctl_probe_interval", sip); + } + if (!smap_equal(&sb->options, &options)) { sbrec_sb_global_set_options(sb, &options); } diff --git a/ovn-nb.xml b/ovn-nb.xml index fd32070f2..ee0aa5372 100644 --- a/ovn-nb.xml +++ b/ovn-nb.xml @@ -215,6 +215,24 @@

+ +

+ The inactivity probe interval of the connection to the OVN Northbound + database from ovn-nbctl utility, in milliseconds. + If the value is zero, it disables the connection keepalive feature. +

+ +

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

+ +

+ If the value is less than zero, then the default inactivity probe + interval for ovn-nbctl would be left intact (120000 ms). +

+
+

When used, this configuration value specifies the time, in diff --git a/ovn-sb.xml b/ovn-sb.xml index a77f8f4ef..aa78383d9 100644 --- a/ovn-sb.xml +++ b/ovn-sb.xml @@ -248,6 +248,31 @@ + +

+ These options apply when ovn-sbctl connects to + OVN Southbound database. +

+ + +

+ The inactivity probe interval of the connection to the OVN + Southbound database from ovn-sbctl utility, in + milliseconds. If the value is zero, it disables the connection + keepalive feature. +

+ +

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

+ +

+ If the value is less than zero, then the default inactivity probe + interval for ovn-sbctl would be left intact (120000 ms). +

+
+ diff --git a/utilities/ovn-dbctl.c b/utilities/ovn-dbctl.c index 369a6a663..1d41157df 100644 --- a/utilities/ovn-dbctl.c +++ b/utilities/ovn-dbctl.c @@ -205,6 +205,9 @@ ovn_dbctl_main(int argc, char *argv[], ovsdb_idl_set_remote(idl, db, daemon_mode); ovsdb_idl_set_leader_only(idl, leader_only); + /* Set reasonable high probe interval. */ + set_idl_probe_interval(idl, db, DEFAULT_UTILS_PROBE_INTERVAL_MSEC); + if (daemon_mode) { server_loop(dbctl_options, idl, argc, argv_); } else { @@ -1094,6 +1097,13 @@ out: free(argv); } +static void +update_inactivity_probe(struct server_cmd_run_ctx *ctx) +{ + set_idl_probe_interval(ctx->idl, db, + ctx->dbctl_options->get_inactivity_probe(ctx->idl)); +} + static void server_loop(const struct ovn_dbctl_options *dbctl_options, struct ovsdb_idl *idl, int argc, char *argv[]) @@ -1125,6 +1135,10 @@ server_loop(const struct ovn_dbctl_options *dbctl_options, for (;;) { update_ssl_config(); + + /* Configure inactivity probe from connected DB. */ + update_inactivity_probe(&server_cmd_run_ctx); + memory_run(); if (memory_should_report()) { struct simap usage = SIMAP_INITIALIZER(&usage); diff --git a/utilities/ovn-dbctl.h b/utilities/ovn-dbctl.h index a1fbede6b..5cfc355e7 100644 --- a/utilities/ovn-dbctl.h +++ b/utilities/ovn-dbctl.h @@ -20,6 +20,8 @@ #include #include "ovsdb-idl.h" +#define DEFAULT_UTILS_PROBE_INTERVAL_MSEC 120000 + struct timer; enum nbctl_wait_type { @@ -52,6 +54,7 @@ struct ovn_dbctl_options { const struct timer *wait_timeout, long long int start_time, bool print_wait_time); + int (*get_inactivity_probe)(struct ovsdb_idl *); struct ctl_context *(*ctx_create)(void); void (*ctx_destroy)(struct ctl_context *); }; diff --git a/utilities/ovn-ic-nbctl.c b/utilities/ovn-ic-nbctl.c index f3d8039a8..721dc4586 100644 --- a/utilities/ovn-ic-nbctl.c +++ b/utilities/ovn-ic-nbctl.c @@ -25,6 +25,7 @@ #include "command-line.h" #include "compiler.h" #include "db-ctl-base.h" +#include "ovn-dbctl.h" #include "dirs.h" #include "fatal-signal.h" #include "openvswitch/dynamic-string.h" @@ -116,6 +117,10 @@ main(int argc, char *argv[]) ovsdb_idl_set_remote(idl, db, false); ovsdb_idl_set_db_change_aware(idl, false); ovsdb_idl_set_leader_only(idl, leader_only); + + /* Set reasonable high probe interval. */ + set_idl_probe_interval(idl, db, DEFAULT_UTILS_PROBE_INTERVAL_MSEC); + run_prerequisites(commands, n_commands, idl); /* Execute the commands. diff --git a/utilities/ovn-ic-sbctl.c b/utilities/ovn-ic-sbctl.c index 3060b48b9..f9b1954d6 100644 --- a/utilities/ovn-ic-sbctl.c +++ b/utilities/ovn-ic-sbctl.c @@ -25,6 +25,7 @@ #include "command-line.h" #include "compiler.h" #include "db-ctl-base.h" +#include "ovn-dbctl.h" #include "dirs.h" #include "fatal-signal.h" #include "openvswitch/dynamic-string.h" @@ -115,6 +116,10 @@ main(int argc, char *argv[]) ovsdb_idl_set_remote(idl, db, false); ovsdb_idl_set_db_change_aware(idl, false); ovsdb_idl_set_leader_only(idl, leader_only); + + /* Set reasonable high probe interval. */ + set_idl_probe_interval(idl, db, DEFAULT_UTILS_PROBE_INTERVAL_MSEC); + run_prerequisites(commands, n_commands, idl); /* Execute the commands. diff --git a/utilities/ovn-nbctl.c b/utilities/ovn-nbctl.c index 45572fd30..b620f7e2e 100644 --- a/utilities/ovn-nbctl.c +++ b/utilities/ovn-nbctl.c @@ -153,6 +153,20 @@ nbctl_post_execute(struct ovsdb_idl *idl, struct ovsdb_idl_txn *txn, } } +static int +get_inactivity_probe(struct ovsdb_idl *idl) +{ + const struct nbrec_nb_global *nb = nbrec_nb_global_first(idl); + int interval = DEFAULT_UTILS_PROBE_INTERVAL_MSEC; + + if (nb) { + interval = smap_get_int(&nb->options, "nbctl_probe_interval", + interval); + } + + return interval; +} + static char * OVS_WARN_UNUSED_RESULT dhcp_options_get( struct ctl_context *ctx, const char *id, bool must_exist, const struct nbrec_dhcp_options **); @@ -7935,6 +7949,7 @@ main(int argc, char *argv[]) .add_base_prerequisites = nbctl_add_base_prerequisites, .pre_execute = nbctl_pre_execute, .post_execute = nbctl_post_execute, + .get_inactivity_probe = get_inactivity_probe, .ctx_create = nbctl_ctx_create, .ctx_destroy = nbctl_ctx_destroy, diff --git a/utilities/ovn-sbctl.c b/utilities/ovn-sbctl.c index 542ab9ffa..3948cae3f 100644 --- a/utilities/ovn-sbctl.c +++ b/utilities/ovn-sbctl.c @@ -150,6 +150,20 @@ Other options:\n\ * gracefully. */ #define ctl_fatal dont_use_ctl_fatal_use_ctl_error_and_return +static int +get_inactivity_probe(struct ovsdb_idl *idl) +{ + const struct sbrec_sb_global *sb = sbrec_sb_global_first(idl); + int interval = DEFAULT_UTILS_PROBE_INTERVAL_MSEC; + + if (sb) { + interval = smap_get_int(&sb->options, "sbctl_probe_interval", + interval); + } + + return interval; +} + /* ovs-sbctl specific context. Inherits the 'struct ctl_context' as base. */ struct sbctl_context { struct ctl_context base; @@ -1590,6 +1604,7 @@ main(int argc, char *argv[]) .add_base_prerequisites = sbctl_add_base_prerequisites, .pre_execute = sbctl_pre_execute, .post_execute = NULL, + .get_inactivity_probe = get_inactivity_probe, .ctx_create = sbctl_ctx_create, .ctx_destroy = sbctl_ctx_destroy,