From patchwork Thu Dec 14 01:04:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 1875933 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=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (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 4SrDj005Dnz1ySd for ; Thu, 14 Dec 2023 12:07:16 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id A565483C5E; Thu, 14 Dec 2023 01:07:13 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org A565483C5E 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 tD97kBRG1r7u; Thu, 14 Dec 2023 01:07:11 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id 8470183C3E; Thu, 14 Dec 2023 01:07:10 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 8470183C3E Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 59A77C0072; Thu, 14 Dec 2023 01:07:10 +0000 (UTC) X-Original-To: ovs-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 279E8C0DCF for ; Thu, 14 Dec 2023 01:07:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id CB042812DE for ; Thu, 14 Dec 2023 01:05:37 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org CB042812DE 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 vHfhBkch79jg for ; Thu, 14 Dec 2023 01:05:37 +0000 (UTC) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by smtp1.osuosl.org (Postfix) with ESMTPS id E395A83518 for ; Thu, 14 Dec 2023 01:05:36 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org E395A83518 Received: by mail.gandi.net (Postfix) with ESMTPSA id CA7B4240004; Thu, 14 Dec 2023 01:05:34 +0000 (UTC) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Thu, 14 Dec 2023 02:04:21 +0100 Message-ID: <20231214010431.1664005-20-i.maximets@ovn.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231214010431.1664005-1-i.maximets@ovn.org> References: <20231214010431.1664005-1-i.maximets@ovn.org> MIME-Version: 1.0 X-GND-Sasl: i.maximets@ovn.org Cc: Vladislav Odintsov , Dumitru Ceara , Ilya Maximets Subject: [ovs-dev] [PATCH 19/22] 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 --- 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);