Skip to content

Commit

Permalink
ovsdb: relay: Allow setting all jsonrpc session options.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: 0-day Robot <[email protected]>
  • Loading branch information
igsilya authored and ovsrobot committed Dec 14, 2023
1 parent ed9bf86 commit d097ab9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ovsdb/ovsdb-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 4 additions & 2 deletions ovsdb/relay.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
}
Expand All @@ -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);
}
Expand Down
4 changes: 3 additions & 1 deletion ovsdb/relay.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "reconnect.h"

struct json;
struct jsonrpc_session_options;
struct ovsdb;
struct ovsdb_schema;
struct uuid;
Expand All @@ -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);
Expand Down

0 comments on commit d097ab9

Please sign in to comment.