From patchwork Tue Jan 9 22:49:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 1884683 X-Patchwork-Delegate: i.maximets@samsung.com 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.133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T8mS16267z1yPh for ; Wed, 10 Jan 2024 09:53:21 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 119A343C25; Tue, 9 Jan 2024 22:53:20 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 119A343C25 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 Z3RxVZtD3tvy; Tue, 9 Jan 2024 22:53:19 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id CB3B043C07; Tue, 9 Jan 2024 22:53:17 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org CB3B043C07 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 86D20C007C; Tue, 9 Jan 2024 22:53:17 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0EA16C007C for ; Tue, 9 Jan 2024 22:53:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id C2A646FA2A for ; Tue, 9 Jan 2024 22:52:29 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org C2A646FA2A X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WkDTI-vSxDeV for ; Tue, 9 Jan 2024 22:52:29 +0000 (UTC) Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::223]) by smtp3.osuosl.org (Postfix) with ESMTPS id B16EA6FBD2 for ; Tue, 9 Jan 2024 22:52:28 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org B16EA6FBD2 Received: by mail.gandi.net (Postfix) with ESMTPSA id 3359F60002; Tue, 9 Jan 2024 22:52:26 +0000 (UTC) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Tue, 9 Jan 2024 23:49:14 +0100 Message-ID: <20240109225142.1987981-15-i.maximets@ovn.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240109225142.1987981-1-i.maximets@ovn.org> References: <20240109225142.1987981-1-i.maximets@ovn.org> MIME-Version: 1.0 X-GND-Sasl: i.maximets@ovn.org Cc: Dumitru Ceara , Ilya Maximets , Vladislav Odintsov Subject: [ovs-dev] [PATCH v2 14/17] ovsdb: relay: Allow setting all jsonrpc session options. 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" Allow setting all the JSON-RPC session options at once. While at it, allow updating options the same way the source can be updated while calling 'ovsdb_relay_add_db()' if the relay is already configured. Signed-off-by: Ilya Maximets Acked-by: Dumitru Ceara --- ovsdb/ovsdb-server.c | 2 +- ovsdb/relay.c | 6 ++++-- ovsdb/relay.h | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c index 6eced3896..9726a8d72 100644 --- a/ovsdb/ovsdb-server.c +++ b/ovsdb/ovsdb-server.c @@ -1017,7 +1017,7 @@ open_db(struct server_config *server_config, if (model == SM_RELAY) { ovsdb_relay_add_db(db->db, conf->source, update_schema, server_config, - conf->options->rpc.probe_interval); + &conf->options->rpc); } if (model == SM_ACTIVE_BACKUP && conf->ab.backup) { const struct uuid *server_uuid; diff --git a/ovsdb/relay.c b/ovsdb/relay.c index 27ff196b7..71a5b8e1c 100644 --- a/ovsdb/relay.c +++ b/ovsdb/relay.c @@ -127,7 +127,8 @@ static struct ovsdb_cs_ops relay_cs_ops = { void ovsdb_relay_add_db(struct ovsdb *db, const char *remote, schema_change_callback schema_change_cb, - void *schema_change_aux, int probe_interval) + void *schema_change_aux, + const struct jsonrpc_session_options *options) { struct relay_ctx *ctx; @@ -138,6 +139,7 @@ ovsdb_relay_add_db(struct ovsdb *db, const char *remote, ctx = shash_find_data(&relay_dbs, db->name); if (ctx) { ovsdb_cs_set_remote(ctx->cs, remote, true); + ovsdb_cs_set_jsonrpc_options(ctx->cs, options); VLOG_DBG("%s: relay source set to '%s'", db->name, remote); return; } @@ -152,7 +154,7 @@ ovsdb_relay_add_db(struct ovsdb *db, const char *remote, shash_add(&relay_dbs, db->name, ctx); ovsdb_cs_set_leader_only(ctx->cs, false); ovsdb_cs_set_remote(ctx->cs, remote, true); - ovsdb_cs_set_probe_interval(ctx->cs, probe_interval); + ovsdb_cs_set_jsonrpc_options(ctx->cs, options); VLOG_DBG("added database: %s, %s", db->name, remote); } diff --git a/ovsdb/relay.h b/ovsdb/relay.h index 218caad65..19cd3ef60 100644 --- a/ovsdb/relay.h +++ b/ovsdb/relay.h @@ -22,6 +22,7 @@ #include "reconnect.h" struct json; +struct jsonrpc_session_options; struct ovsdb; struct ovsdb_schema; struct uuid; @@ -37,7 +38,8 @@ typedef struct ovsdb_error *(*schema_change_callback)( void ovsdb_relay_add_db(struct ovsdb *, const char *remote, schema_change_callback schema_change_cb, - void *schema_change_aux, int probe_interval); + void *schema_change_aux, + const struct jsonrpc_session_options *); void ovsdb_relay_del_db(struct ovsdb *); void ovsdb_relay_run(void); void ovsdb_relay_wait(void);