previously it was not possible to set the probe interval for the connection from a relay to the backing ovsdb-server. With this change it is now possible using the `ovsdb-server/set-relay-source-probe-interval` command.
Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Felix Huettner <[email protected]> --- v3: - use a separate command - stay with the default of 5sec NEWS | 3 +++ ovsdb/ovsdb-server.c | 30 +++++++++++++++++++++++++++++- ovsdb/relay.c | 15 ++++++++++++++- ovsdb/relay.h | 6 +++++- 4 files changed, 51 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index bda41ad4c..3e90c879b 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,9 @@ Post-v3.1.0 conversion operation is present. For the cluster service model follow upgrade instructions in 'Upgrading from version 3.1 and earlier to 3.2 and later' section of ovsdb(7). + * When ovsdb-server is running in relay mode, the probe interval is + configurable via + `ovs-appctl ovsdb-server/set-relay-source-probe-interval`. - IPFIX template and statistics intervals can now be configured through two new options in the IPFIX table: 'template_interval' and 'stats_interval'. - Linux kernel datapath: diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c index 9bad0c8dd..cef12ca38 100644 --- a/ovsdb/ovsdb-server.c +++ b/ovsdb/ovsdb-server.c @@ -94,6 +94,7 @@ static unixctl_cb_func ovsdb_server_get_active_ovsdb_server; static unixctl_cb_func ovsdb_server_connect_active_ovsdb_server; static unixctl_cb_func ovsdb_server_disconnect_active_ovsdb_server; static unixctl_cb_func ovsdb_server_set_active_ovsdb_server_probe_interval; +static unixctl_cb_func ovsdb_server_set_relay_source_interval; static unixctl_cb_func ovsdb_server_set_sync_exclude_tables; static unixctl_cb_func ovsdb_server_get_sync_exclude_tables; static unixctl_cb_func ovsdb_server_get_sync_status; @@ -107,6 +108,7 @@ struct server_config { char **sync_exclude; bool *is_backup; int *replication_probe_interval; + int *relay_source_probe_interval; struct ovsdb_jsonrpc_server *jsonrpc; }; static unixctl_cb_func ovsdb_server_add_remote; @@ -328,6 +330,7 @@ main(int argc, char *argv[]) struct shash all_dbs; struct shash_node *node; int replication_probe_interval = REPLICATION_DEFAULT_PROBE_INTERVAL; + int relay_source_probe_interval = RELAY_SOURCE_DEFAULT_PROBE_INTERVAL; ovs_cmdl_proctitle_init(argc, argv); set_program_name(argv[0]); @@ -377,6 +380,7 @@ main(int argc, char *argv[]) server_config.sync_exclude = &sync_exclude; server_config.is_backup = &is_backup; server_config.replication_probe_interval = &replication_probe_interval; + server_config.relay_source_probe_interval = &relay_source_probe_interval; perf_counters_init(); @@ -472,6 +476,9 @@ main(int argc, char *argv[]) unixctl_command_register( "ovsdb-server/set-active-ovsdb-server-probe-interval", "", 1, 1, ovsdb_server_set_active_ovsdb_server_probe_interval, &server_config); + unixctl_command_register( + "ovsdb-server/set-relay-source-probe-interval", "", 1, 1, + ovsdb_server_set_relay_source_interval, &server_config); unixctl_command_register("ovsdb-server/set-sync-exclude-tables", "", 0, 1, ovsdb_server_set_sync_exclude_tables, &server_config); @@ -797,7 +804,8 @@ open_db(struct server_config *config, const char *filename) add_db(config, db); if (is_relay) { - ovsdb_relay_add_db(db->db, relay_remotes, update_schema, config); + ovsdb_relay_add_db(db->db, relay_remotes, update_schema, config, + *config->relay_source_probe_interval); } return NULL; } @@ -1480,6 +1488,26 @@ ovsdb_server_set_active_ovsdb_server_probe_interval(struct unixctl_conn *conn, } } +static void +ovsdb_server_set_relay_source_interval(struct unixctl_conn *conn, + int argc OVS_UNUSED, + const char *argv[], + void *config_) +{ + struct server_config *config = config_; + + int probe_interval; + if (str_to_int(argv[1], 10, &probe_interval)) { + *config->relay_source_probe_interval = probe_interval; + save_config(config); + ovsdb_relay_set_probe_interval(probe_interval); + unixctl_command_reply(conn, NULL); + } else { + unixctl_command_reply( + conn, "Invalid probe interval, integer value expected"); + } +} + static void ovsdb_server_set_sync_exclude_tables(struct unixctl_conn *conn, int argc OVS_UNUSED, diff --git a/ovsdb/relay.c b/ovsdb/relay.c index 377f3285f..21720f62f 100644 --- a/ovsdb/relay.c +++ b/ovsdb/relay.c @@ -127,7 +127,7 @@ 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) + void *schema_change_aux, int probe_interval) { struct relay_ctx *ctx; @@ -152,10 +152,23 @@ 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); VLOG_DBG("added database: %s, %s", db->name, remote); } +/* Updates the probe interval for all relay connections to the specified + * value*/ +void +ovsdb_relay_set_probe_interval(int probe_interval) +{ + struct shash_node *node; + SHASH_FOR_EACH (node, &relay_dbs) { + struct relay_ctx *ctx = node->data; + ovsdb_cs_set_probe_interval(ctx->cs, probe_interval); + } +} + void ovsdb_relay_del_db(struct ovsdb *db) { diff --git a/ovsdb/relay.h b/ovsdb/relay.h index f841554ca..0e7fa1fb8 100644 --- a/ovsdb/relay.h +++ b/ovsdb/relay.h @@ -24,6 +24,8 @@ struct ovsdb; struct ovsdb_schema; struct uuid; +#define RELAY_SOURCE_DEFAULT_PROBE_INTERVAL 5000 + typedef struct ovsdb_error *(*schema_change_callback)( struct ovsdb *, const struct ovsdb_schema *, @@ -33,11 +35,13 @@ 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); + void *schema_change_aux, int probe_interval); void ovsdb_relay_del_db(struct ovsdb *); void ovsdb_relay_run(void); void ovsdb_relay_wait(void); +void ovsdb_relay_set_probe_interval(int); + bool ovsdb_relay_is_connected(struct ovsdb *); #endif /* OVSDB_RELAY_H */ -- 2.40.0 Diese E Mail enthält möglicherweise vertrauliche Inhalte und ist nur für die Verwertung durch den vorgesehenen Empfänger bestimmt. Sollten Sie nicht der vorgesehene Empfänger sein, setzen Sie den Absender bitte unverzüglich in Kenntnis und löschen diese E Mail. Hinweise zum Datenschutz finden Sie hier<https://www.datenschutz.schwarz>. This e-mail may contain confidential content and is intended only for the specified recipient/s. If you are not the intended recipient, please inform the sender immediately and delete this e-mail. Information on data protection can be found here<https://www.datenschutz.schwarz>. _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
