diff mbox series

[ovs-dev] relay: allow setting probe interval

Message ID ZGeR3uUVtglgUsFU@SIT-SLAP8639.int.lidl.net
State Superseded
Headers show
Series [ovs-dev] relay: allow setting probe interval | 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

Felix Huettner May 19, 2023, 3:13 p.m. UTC
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-active-ovsdb-server-probe-interval` command.

The command `ovsdb-server/set-active-ovsdb-server-probe-interval` is
already used to set the probe interval for active-backup replication.
However this is mutally exclusive with being a relay and the case for
using the command is the same. Therefor we decided to reuse it instead
of adding a new one.

Signed-off-by: Felix Huettner <felix.huettner@mail.schwarz>
---
 NEWS                 |  4 ++++
 ovsdb/ovsdb-server.c |  4 +++-
 ovsdb/relay.c        | 15 ++++++++++++++-
 ovsdb/relay.h        |  4 +++-
 4 files changed, 24 insertions(+), 3 deletions(-)

--
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>.

Comments

Simon Horman May 24, 2023, 3:20 p.m. UTC | #1
On Fri, May 19, 2023 at 05:13:23PM +0200, Felix Huettner via dev wrote:
> 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-active-ovsdb-server-probe-interval` command.
> 
> The command `ovsdb-server/set-active-ovsdb-server-probe-interval` is
> already used to set the probe interval for active-backup replication.
> However this is mutally exclusive with being a relay and the case for
> using the command is the same. Therefor we decided to reuse it instead
> of adding a new one.
> 
> Signed-off-by: Felix Huettner <felix.huettner@mail.schwarz>

Reviewed-by: Simon Horman <simon.horman@corigine.com>
diff mbox series

Patch

diff --git a/NEWS b/NEWS
index cfd466663..719517c67 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,10 @@  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 default value of probe
+       interval is increased to 60 seconds for the connection to the
+       backing server. This value is configurable with the unixctl
+       command - ovsdb-server/set-active-ovsdb-server-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..d29dde417 100644
--- a/ovsdb/ovsdb-server.c
+++ b/ovsdb/ovsdb-server.c
@@ -797,7 +797,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->replication_probe_interval);
     }
     return NULL;
 }
@@ -1473,6 +1474,7 @@  ovsdb_server_set_active_ovsdb_server_probe_interval(struct unixctl_conn *conn,
         if (*config->is_backup) {
             replication_set_probe_interval(probe_interval);
         }
+        ovsdb_relay_set_probe_interval(probe_interval);
         unixctl_command_reply(conn, NULL);
     } else {
         unixctl_command_reply(
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..ccfaf3c93 100644
--- a/ovsdb/relay.h
+++ b/ovsdb/relay.h
@@ -33,11 +33,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 */