diff mbox series

[ovs-dev,19/22] ovsdb: relay: Allow setting all jsonrpc session options.

Message ID 20231214010431.1664005-20-i.maximets@ovn.org
State Superseded
Delegated to: Ilya Maximets
Headers show
Series [ovs-dev,01/22] ovsdb-server.at: Enbale debug logs in active-backup tests. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Ilya Maximets Dec. 14, 2023, 1:04 a.m. UTC
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 <i.maximets@ovn.org>
---
 ovsdb/ovsdb-server.c | 2 +-
 ovsdb/relay.c        | 6 ++++--
 ovsdb/relay.h        | 4 +++-
 3 files changed, 8 insertions(+), 4 deletions(-)
diff mbox series

Patch

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);