@@ -1306,6 +1306,16 @@ jsonrpc_session_set_max_backoff(struct jsonrpc_session *s, int max_backoff)
reconnect_set_backoff(s->reconnect, 0, max_backoff);
}
+/* Sets 'min_backoff and 'max_backoff' as the minimum and maximum time,
+ * in milliseconds, to wait after a connection attempt fails before attempting
+ * to connect again. */
+void
+jsonrpc_session_set_backoff(struct jsonrpc_session *s, int min_backoff,
+ int max_backoff)
+{
+ reconnect_set_backoff(s->reconnect, min_backoff, max_backoff);
+}
+
/* Sets the "probe interval" for 's' to 'probe_interval', in milliseconds. If
* this is zero, it disables the connection keepalive feature. Otherwise, if
* 's' is idle for 'probe_interval' milliseconds then 's' will send an echo
@@ -141,6 +141,8 @@ void jsonrpc_session_reset_backoff(struct jsonrpc_session *);
void jsonrpc_session_set_max_backoff(struct jsonrpc_session *,
int max_backoff);
+void jsonrpc_session_set_backoff(struct jsonrpc_session *,
+ int min_backoff, int max_backoff);
void jsonrpc_session_set_probe_interval(struct jsonrpc_session *,
int probe_interval);
void jsonrpc_session_set_dscp(struct jsonrpc_session *,
@@ -551,7 +551,8 @@ reconnect_deadline__(const struct reconnect *fsm)
return fsm->state_entered + fsm->backoff;
case S_CONNECTING:
- return fsm->state_entered + MAX(1000, fsm->backoff);
+ return fsm->state_entered + MAX(1000, MAX(fsm->min_backoff,
+ fsm->backoff));
case S_ACTIVE:
if (fsm->probe_interval) {
@@ -212,6 +212,7 @@ ovsdb_jsonrpc_default_options(const char *target)
{
struct ovsdb_jsonrpc_options *options = xzalloc(sizeof *options);
options->max_backoff = RECONNECT_DEFAULT_MAX_BACKOFF;
+ options->min_backoff = RECONNECT_DEFAULT_MIN_BACKOFF;
options->probe_interval = (stream_or_pstream_needs_probes(target)
? RECONNECT_DEFAULT_PROBE_INTERVAL
: 0);
@@ -577,7 +578,8 @@ static void
ovsdb_jsonrpc_session_set_options(struct ovsdb_jsonrpc_session *session,
const struct ovsdb_jsonrpc_options *options)
{
- jsonrpc_session_set_max_backoff(session->js, options->max_backoff);
+ jsonrpc_session_set_backoff(session->js, options->min_backoff,
+ options->max_backoff);
jsonrpc_session_set_probe_interval(session->js, options->probe_interval);
jsonrpc_session_set_dscp(session->js, options->dscp);
}
@@ -34,6 +34,7 @@ void ovsdb_jsonrpc_server_destroy(struct ovsdb_jsonrpc_server *);
/* Options for a remote. */
struct ovsdb_jsonrpc_options {
int max_backoff; /* Maximum reconnection backoff, in msec. */
+ int min_backoff; /* Minimum reconnection backoff, in msec. */
int probe_interval; /* Max idle time before probing, in msec. */
bool read_only; /* Only read-only transactions are allowed. */
int dscp; /* Dscp value for manager connections */
@@ -948,7 +948,7 @@ add_manager_options(struct shash *remotes, const struct ovsdb_row *row)
{
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
struct ovsdb_jsonrpc_options *options;
- long long int max_backoff, probe_interval;
+ long long int max_backoff, min_backoff, probe_interval;
bool read_only;
const char *target, *dscp_string, *role;
@@ -962,6 +962,9 @@ add_manager_options(struct shash *remotes, const struct ovsdb_row *row)
if (ovsdb_util_read_integer_column(row, "max_backoff", &max_backoff)) {
options->max_backoff = max_backoff;
}
+ if (ovsdb_util_read_integer_column(row, "min_backoff", &min_backoff)) {
+ options->min_backoff = min_backoff;
+ }
if (ovsdb_util_read_integer_column(row, "inactivity_probe",
&probe_interval)) {
options->probe_interval = probe_interval;
@@ -1,6 +1,6 @@
{"name": "Open_vSwitch",
- "version": "8.3.0",
- "cksum": "3781850481 26690",
+ "version": "8.4.0",
+ "cksum": "542313912 26846",
"tables": {
"Open_vSwitch": {
"columns": {
@@ -625,6 +625,10 @@
"type": {"key": {"type": "integer",
"minInteger": 1000},
"min": 0, "max": 1}},
+ "min_backoff": {
+ "type": {"key": {"type": "integer",
+ "minInteger": 1000},
+ "min": 0, "max": 1}},
"inactivity_probe": {
"type": {"key": "integer", "min": 0, "max": 1}},
"connection_mode": {
@@ -5668,6 +5668,11 @@ ovs-vsctl add-port br0 p0 -- set Interface p0 type=patch options:peer=p1 \
Default is implementation-specific.
</column>
+ <column name="min_backoff">
+ Minimum number of milliseconds to wait between connection attempts.
+ Default is implementation-specific.
+ </column>
+
<column name="inactivity_probe">
Maximum number of milliseconds of idle time on connection to the client
before sending an inactivity probe message. If Open vSwitch does not
To adjust the minimum number of connection attempts by ovsdb-server to the cloud controller (to avoid ddos when controller was down and then up) Was carefully tested within product's codestack Signed-off-by: Anton Pryima <apryim702@cable.comcast.com>