When database is added to the replication, it should no longer
accept transactions that can modify it.  When it's removed from
the replication, it should be writable again.  Add this logic
to the replication module itself, so it can be removed from the
main ovsdb-server later.

Signed-off-by: Ilya Maximets <i.maxim...@ovn.org>
---
 ovsdb/replication.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ovsdb/replication.c b/ovsdb/replication.c
index d0d48aad5..3c59d4039 100644
--- a/ovsdb/replication.c
+++ b/ovsdb/replication.c
@@ -150,6 +150,7 @@ replication_set_db(struct ovsdb *db, const char *sync_from,
     jsonrpc_session_set_probe_interval(rdb->session, probe_interval);
 
     rdb->state = RPL_S_INIT;
+    rdb->db->read_only = true;
 }
 
 void
@@ -743,6 +744,7 @@ replication_db_destroy(struct replication_db *rdb)
     }
 
     rdb->schema_version_higher = false;
+    rdb->db->read_only = false;
 }
 
 /* Return true if replication just started or is ongoing.
-- 
2.43.0

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to