2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

ovsdb-idl.c: Allows retry even when using a single remote.

When clustered mode is used, the client needs to retry connecting
to new servers when certain failures happen. Today it is allowed to
retry new connection only if multiple remotes are used, which prevents
using LB VIP with clustered nodes. This patch makes sure the retry
logic works when using LB VIP: although same IP is used for retrying,
the LB can actually redirect the connection to a new node.

Signed-off-by: Han Zhou <hzhou8@ebay.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
Han Zhou
2019-08-19 09:29:57 -07:00
committed by Ben Pfaff
parent f4bef8b39a
commit ca367fa5f8
3 changed files with 61 additions and 8 deletions

View File

@@ -657,12 +657,8 @@ ovsdb_idl_state_to_string(enum ovsdb_idl_state state)
static void
ovsdb_idl_retry_at(struct ovsdb_idl *idl, const char *where)
{
if (idl->session && jsonrpc_session_get_n_remotes(idl->session) > 1) {
ovsdb_idl_force_reconnect(idl);
ovsdb_idl_transition_at(idl, IDL_S_RETRY, where);
} else {
ovsdb_idl_transition_at(idl, IDL_S_ERROR, where);
}
ovsdb_idl_force_reconnect(idl);
ovsdb_idl_transition_at(idl, IDL_S_RETRY, where);
}
static void
@@ -1895,8 +1891,7 @@ ovsdb_idl_check_server_db(struct ovsdb_idl *idl)
if (!database) {
VLOG_INFO_RL(&rl, "%s: server does not have %s database",
server_name, idl->data.class_->database);
} else if (!strcmp(database->model, "clustered")
&& jsonrpc_session_get_n_remotes(idl->session) > 1) {
} else if (!strcmp(database->model, "clustered")) {
uint64_t index = database->n_index ? *database->index : 0;
if (!database->schema) {