From patchwork Thu May 4 16:55:10 2023
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Vladislav Odintsov
X-Patchwork-Id: 1776982
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=2605:bc80:3010::133; helo=smtp2.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=jEyRLVTr;
dkim-atps=neutral
Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133])
(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 4QC0LN0Hrlz213v
for ; Fri, 5 May 2023 02:55:22 +1000 (AEST)
Received: from localhost (localhost [127.0.0.1])
by smtp2.osuosl.org (Postfix) with ESMTP id F010441030;
Thu, 4 May 2023 16:55:19 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org F010441030
Authentication-Results: smtp2.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=jEyRLVTr
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 Ee8YLZYhZtjO; Thu, 4 May 2023 16:55:18 +0000 (UTC)
Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56])
by smtp2.osuosl.org (Postfix) with ESMTPS id D6C034026F;
Thu, 4 May 2023 16:55:17 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org D6C034026F
Received: from lf-lists.osuosl.org (localhost [127.0.0.1])
by lists.linuxfoundation.org (Postfix) with ESMTP id B793FC0036;
Thu, 4 May 2023 16:55:17 +0000 (UTC)
X-Original-To: dev@openvswitch.org
Delivered-To: ovs-dev@lists.linuxfoundation.org
Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138])
by lists.linuxfoundation.org (Postfix) with ESMTP id 37767C002A
for ; Thu, 4 May 2023 16:55:16 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
by smtp1.osuosl.org (Postfix) with ESMTP id F2E7283C8F
for ; Thu, 4 May 2023 16:55:15 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org F2E7283C8F
Authentication-Results: smtp1.osuosl.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com
header.a=rsa-sha256 header.s=20221208 header.b=jEyRLVTr
X-Virus-Scanned: amavisd-new at osuosl.org
Received: from smtp1.osuosl.org ([127.0.0.1])
by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id 9uvmaGbT3-IG for ;
Thu, 4 May 2023 16:55:15 +0000 (UTC)
X-Greylist: whitelisted by SQLgrey-1.8.0
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org B6D2483C76
Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com
[IPv6:2a00:1450:4864:20::231])
by smtp1.osuosl.org (Postfix) with ESMTPS id B6D2483C76
for ; Thu, 4 May 2023 16:55:14 +0000 (UTC)
Received: by mail-lj1-x231.google.com with SMTP id
38308e7fff4ca-2ac733b813fso8616581fa.1
for ; Thu, 04 May 2023 09:55:14 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20221208; t=1683219312; x=1685811312;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=PBvpWhtmwvKevURJJPlCFVZe/0SXa1RkGQpgCDQFg48=;
b=jEyRLVTrQj6pJ9s9HgPghlszog6/oh83jZ9FZjl6wlhxv3L0RoYqqnLqWCdJQwiZvc
ohoG4fhRyVGtIMXH9nwJ+YffDm8aAdszWArAfZZnoe5GWRcv/VQHvXwquAy1PCPhztH6
bMNSRl0MOMTtm6XXikAKaOyOLUTseTf/ciNnux0YCnkIdg8UnO5Grf43Y51Xxpxm1sBz
bUOskPOrrAkptQ+wsG9kkPLkQDEPJdy+lAvr8kyIHbd3sWP6qtYsAHDgf3rm/KxSH9Nc
QZwGGQN9Sm2IuKMPCkmA1Ff+JsArMHyWlqoP5qe1HUDDAcpu7KFoNK7m9B7EJ73Rdi53
h5Ew==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20221208; t=1683219312; x=1685811312;
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=PBvpWhtmwvKevURJJPlCFVZe/0SXa1RkGQpgCDQFg48=;
b=U8FOjpD+waiDuqAScrjAVJT/ncjXEPv9fuhdrWoVbfvowUhX1CD3p0y1tl06bE/ejt
UsP+DhZBV/DQfGS6FTVfsvFicTOWi76yjKjli/Z3h8nn+y6eAfIyc+/HspM2EdZNOQlB
+lXHVw4AmXCPm6/ck5kZXlWPtWHRBTHoyzVeJSojKehN374g8Ee/fPQyZQhiIRBkxZ8N
OcOBoW8HQLoul07HbFCOLTL8joQvk/vDtzhq4+6QKrn+12BjX38r+jzKJIVo78t8tahC
3fI+9VNuzKDSAu14vPSzDVWBF4Qfpeu5/4Os3rILznwc6LmezYcMNxuOUlsZZ1qRYz5i
zNvg==
X-Gm-Message-State: AC+VfDzdZhZlSKvKA9VMug/EehjI4CKrYkp+9d3dkl2/eyH8l1hgQB9y
bby6g1BKO1+9me0evLmXv/sAEv3pvOmIig==
X-Google-Smtp-Source:
ACHHUZ5oJUocpvGMyZpTSmHh/jJywtKEBBObOvZjNpGU4GQw7HU9PCPaYX1S19Bwe89ZE+lnFw53aw==
X-Received: by 2002:a2e:6a17:0:b0:2a8:e7f9:c33f with SMTP id
f23-20020a2e6a17000000b002a8e7f9c33fmr1010567ljc.30.1683219312063;
Thu, 04 May 2023 09:55:12 -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
i3-20020a2e9403000000b002a8b5310642sm6691272ljh.5.2023.05.04.09.55.11
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 04 May 2023 09:55:11 -0700 (PDT)
From: Vladislav Odintsov
To: dev@openvswitch.org
Date: Thu, 4 May 2023 19:55:10 +0300
Message-Id: <20230504165510.4026066-1-odivlad@gmail.com>
X-Mailer: git-send-email 2.36.1
MIME-Version: 1.0
Cc: Vladislav Odintsov
Subject: [ovs-dev] [PATCH ovn v4] 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
Acked-by: Ales Musil
---
v3 -> v4:
- Rebased on a fresh main branch.
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 60467581a..54303f834 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,13 @@ Post v23.03.0
existing behaviour of flooding these arp requests to all attached Ports.
- Always allow IPv6 Router Discovery, Neighbor Discovery, and Multicast
Listener Discovery protocols, regardless of ACLs defined.
+ - 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 b58f11633..eca1e6068 100644
--- a/northd/northd.c
+++ b/northd/northd.c
@@ -16715,6 +16715,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 0552eff19..0c1954792 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 9399f9462..c2bdbf4a3 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 **);
@@ -7933,6 +7947,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,