mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 14:25:26 +00:00
ovsdb: Make clients aware of relay service model.
Clients needs to re-connect from the relay that has no connection with the database source. Also, relay acts similarly to the follower from a clustered model from the consistency point of view, so it's not suitable for leader-only connections. Acked-by: Mark D. Gray <mark.d.gray@redhat.com> Acked-by: Dumitru Ceara <dceara@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
@@ -1914,8 +1914,8 @@ ovsdb_cs_check_server_db__(struct ovsdb_cs *cs)
|
||||
bool ok = false;
|
||||
const char *model = server_column_get_string(db_row, COL_MODEL, "");
|
||||
const char *schema = server_column_get_string(db_row, COL_SCHEMA, NULL);
|
||||
bool connected = server_column_get_bool(db_row, COL_CONNECTED, false);
|
||||
if (!strcmp(model, "clustered")) {
|
||||
bool connected = server_column_get_bool(db_row, COL_CONNECTED, false);
|
||||
bool leader = server_column_get_bool(db_row, COL_LEADER, false);
|
||||
uint64_t index = server_column_get_int(db_row, COL_INDEX, 0);
|
||||
|
||||
@@ -1935,6 +1935,19 @@ ovsdb_cs_check_server_db__(struct ovsdb_cs *cs)
|
||||
cs->min_index = index;
|
||||
ok = true;
|
||||
}
|
||||
} else if (!strcmp(model, "relay")) {
|
||||
if (!schema) {
|
||||
VLOG_INFO("%s: relay database server has not yet connected to the "
|
||||
"relay source; trying another server", server_name);
|
||||
} else if (!connected) {
|
||||
VLOG_INFO("%s: relay database server is disconnected from the "
|
||||
"relay source; trying another server", server_name);
|
||||
} else if (cs->leader_only) {
|
||||
VLOG_INFO("%s: relay database server cannot be a leader; "
|
||||
"trying another server", server_name);
|
||||
} else {
|
||||
ok = true;
|
||||
}
|
||||
} else {
|
||||
if (!schema) {
|
||||
VLOG_INFO("%s: missing database schema", server_name);
|
||||
|
Reference in New Issue
Block a user