From patchwork Wed May 3 00:55:31 2023
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Vladislav Odintsov
X-Patchwork-Id: 1776082
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.138; helo=smtp1.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=nNe5QvUF;
dkim-atps=neutral
Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138])
(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 4Q9z5j0mZ4z1ydX
for ; Wed, 3 May 2023 10:55:51 +1000 (AEST)
Received: from localhost (localhost [127.0.0.1])
by smtp1.osuosl.org (Postfix) with ESMTP id 7931481C58;
Wed, 3 May 2023 00:55:47 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 7931481C58
Authentication-Results: smtp1.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=nNe5QvUF
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 V6bTgu2MNJ0p; Wed, 3 May 2023 00:55:46 +0000 (UTC)
Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56])
by smtp1.osuosl.org (Postfix) with ESMTPS id 60D5881772;
Wed, 3 May 2023 00:55:45 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 60D5881772
Received: from lf-lists.osuosl.org (localhost [127.0.0.1])
by lists.linuxfoundation.org (Postfix) with ESMTP id 3D5CDC0036;
Wed, 3 May 2023 00:55:45 +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 08C19C002A
for ; Wed, 3 May 2023 00:55:44 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
by smtp2.osuosl.org (Postfix) with ESMTP id C3615400D0
for ; Wed, 3 May 2023 00:55:43 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org C3615400D0
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=nNe5QvUF
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 ST2JiNemV0le for ;
Wed, 3 May 2023 00:55:43 +0000 (UTC)
X-Greylist: whitelisted by SQLgrey-1.8.0
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 97BCE400AB
Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com
[IPv6:2a00:1450:4864:20::232])
by smtp2.osuosl.org (Postfix) with ESMTPS id 97BCE400AB
for ; Wed, 3 May 2023 00:55:42 +0000 (UTC)
Received: by mail-lj1-x232.google.com with SMTP id
38308e7fff4ca-2a8ba5f1d6bso44173611fa.2
for ; Tue, 02 May 2023 17:55:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20221208; t=1683075340; x=1685667340;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=c3fAdDxTks0AHSfyZEIJMADCtABnJccLF88EL4Wf/tM=;
b=nNe5QvUFCJo2mS4F22WF7iPrMgADDxiKWF0qbz2yPV5bww+rUdlJcMTiA7LWuPeqfJ
oMk9c6NL2VGKoyd0aeL+EVPpN6WyExkoNiuHbnlHSEchUhuTISsZ7sCFy42NlK5DIjdP
IWy7okh5lYTj5l/VH2Ezw72i5wEjs+EszTByjr2zXhwLQSBwNSWwUfMxnCw2r8hkcBzD
4GqK6l4xDl7z48JwXFI1s+UB8nMqePbrn3ZyOVfIRqo9z++ap0bqjmujNoJXexIOXqnA
rkue6EMnCF+htLkpbfCFM2YNuwUsKAQpOYnBaw1Irn+UBX7n/s1sTxQpoUn/66kNp8d4
axgA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20221208; t=1683075340; x=1685667340;
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=c3fAdDxTks0AHSfyZEIJMADCtABnJccLF88EL4Wf/tM=;
b=CbuTdf6EmFVL4MKfMgIyCc1SHPlDH0y1NeWYMz/fl/qCzZVBCBvMKd7jF6RZCetRcD
BKuIBypceC73PvWCufzO8cyyKYiNsGwEnN/6Rm5FwfAPJyZnX7DHe57mtjDvXm1NdhIE
LWXghkWOvpLAwxE4+NpfdTZfl7Vg3+IEDnDRbCoqYvPgYQQdmC/QWyVezSkOn3TyaDFR
Dn9obiYYY49RKs7uVuuheCS7Rivt5PGXXt9Zdxc17WusplxdPrNOGOaiJ7p1bKm/lcYy
q3hO1/6mf1vkG/o1/pobZwq16bH0IDF414WvVjVWArLSPAg9vVzfL/hn68O3OI6Smocw
Z3IQ==
X-Gm-Message-State: AC+VfDzk0cplGSu3nkSH9ZJ178dFoTWa8Kn7JRVnr4lXnNbMFuVDny1s
kADO7IEt1MEQE7t5ZMaCfoiwycH71LOh6A==
X-Google-Smtp-Source:
ACHHUZ5TL6AAoNWtURXCdstlemqkGdu5iMGHCMbDJpSxzeTNsqCmp/aYd2CMHwUnJU0FpordlHmWrg==
X-Received: by 2002:a2e:8053:0:b0:2a9:f7a8:d986 with SMTP id
p19-20020a2e8053000000b002a9f7a8d986mr5423574ljg.3.1683075339829;
Tue, 02 May 2023 17:55:39 -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
k26-20020ac2457a000000b004f11eb32f20sm1417092lfm.13.2023.05.02.17.55.39
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Tue, 02 May 2023 17:55:39 -0700 (PDT)
From: Vladislav Odintsov
To: dev@openvswitch.org
Date: Wed, 3 May 2023 03:55:31 +0300
Message-Id: <20230503005531.4005891-1-odivlad@gmail.com>
X-Mailer: git-send-email 2.36.1
MIME-Version: 1.0
Cc: Vladislav Odintsov
Subject: [ovs-dev] [PATCH ovn v2] 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
database:
OVN_Northbound.NB_Global.options.dbctl_inactivity_probe for ovn-nbctl and
ovn-sbctl utilities.
If no DB configuration option was provided, the initial (120000 ms) interval
is left.
Signed-off-by: Vladislav Odintsov
Acked-by: Dumitru Ceara
---
lib/ovn-util.h | 2 ++
ovn-nb.xml | 20 ++++++++++++++++++++
utilities/ovn-dbctl.c | 18 ++++++++++++++++++
utilities/ovn-dbctl.h | 1 +
utilities/ovn-ic-nbctl.c | 4 ++++
utilities/ovn-ic-sbctl.c | 4 ++++
utilities/ovn-nbctl.c | 15 +++++++++++++++
utilities/ovn-sbctl.c | 15 +++++++++++++++
8 files changed, 79 insertions(+)
diff --git a/lib/ovn-util.h b/lib/ovn-util.h
index 7cf861dbc..47e53ca74 100644
--- a/lib/ovn-util.h
+++ b/lib/ovn-util.h
@@ -154,6 +154,8 @@ void set_idl_probe_interval(struct ovsdb_idl *idl, const char *remote,
#define OVN_MAX_DP_VXLAN_KEY ((1u << 12) - 1)
#define OVN_MAX_DP_VXLAN_KEY_LOCAL (OVN_MAX_DP_KEY - OVN_MAX_DP_GLOBAL_NUM)
+#define DEFAULT_UTILS_PROBE_INTERVAL_MSEC 120000
+
struct hmap;
void ovn_destroy_tnlids(struct hmap *tnlids);
bool ovn_add_tnlid(struct hmap *set, uint32_t tnlid);
diff --git a/ovn-nb.xml b/ovn-nb.xml
index fd32070f2..a82f31a92 100644
--- a/ovn-nb.xml
+++ b/ovn-nb.xml
@@ -215,6 +215,26 @@
+
+
+ The inactivity probe interval of the connection to the OVN Northbound
+ and Southbound databases from ovn-nbctl
and
+ ovn-sbctl
utilities respectively, 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 less then zero, then the default inactivity probe
+ interval for ovn-nbctl
and ovn-sbctl
would
+ be left intact (120000 ms).
+
+
+
When used, this configuration value specifies the time, in
diff --git a/utilities/ovn-dbctl.c b/utilities/ovn-dbctl.c
index 369a6a663..c6aebcbbb 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,17 @@ out:
free(argv);
}
+static void
+update_inactivity_probe(struct server_cmd_run_ctx *ctx)
+{
+ int inactivity_probe = ctx->dbctl_options->get_inactivity_probe(ctx->idl);
+ if (inactivity_probe < 0) {
+ inactivity_probe = DEFAULT_UTILS_PROBE_INTERVAL_MSEC;
+ }
+
+ set_idl_probe_interval(ctx->idl, db, inactivity_probe);
+}
+
static void
server_loop(const struct ovn_dbctl_options *dbctl_options,
struct ovsdb_idl *idl, int argc, char *argv[])
@@ -1125,6 +1139,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..54c232dd6 100644
--- a/utilities/ovn-dbctl.h
+++ b/utilities/ovn-dbctl.h
@@ -52,6 +52,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..19d8b054f 100644
--- a/utilities/ovn-ic-nbctl.c
+++ b/utilities/ovn-ic-nbctl.c
@@ -116,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-ic-sbctl.c b/utilities/ovn-ic-sbctl.c
index 3060b48b9..215d09d30 100644
--- a/utilities/ovn-ic-sbctl.c
+++ b/utilities/ovn-ic-sbctl.c
@@ -115,6 +115,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..49c5b294a 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 = -1;
+
+ if (nb) {
+ interval = smap_get_int(&nb->options, "dbctl_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..76465fe7e 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 = -1;
+
+ if (sb) {
+ interval = smap_get_int(&sb->options, "dbctl_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,