summaryrefslogtreecommitdiff
path: root/ovsdb
diff options
context:
space:
mode:
authorAndy Zhou <azhou@ovn.org>2016-07-28 15:48:28 -0700
committerAndy Zhou <azhou@ovn.org>2016-08-14 22:11:36 -0700
commit8c945cece4d4fc86e808e3b263c484be05f0e2f1 (patch)
tree2433aa97a46ed6ec32ece741eb0befb04a5d6f6e /ovsdb
parentf53d75183f776453a544756fd4efb20f364174dc (diff)
downloadopenvswitch-8c945cece4d4fc86e808e3b263c484be05f0e2f1.tar.gz
ovsdb: Add replication wait
Poll_block() requires the run() function to be paired with a wait() function. Add one for replication. Signed-off-by: Andy Zhou <azhou@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'ovsdb')
-rw-r--r--ovsdb/ovsdb-server.c3
-rw-r--r--ovsdb/replication.c8
-rw-r--r--ovsdb/replication.h1
3 files changed, 12 insertions, 0 deletions
diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c
index 937c36ed0..257740116 100644
--- a/ovsdb/ovsdb-server.c
+++ b/ovsdb/ovsdb-server.c
@@ -183,6 +183,9 @@ main_loop(struct ovsdb_jsonrpc_server *jsonrpc, struct shash *all_dbs,
}
memory_wait();
+ if (is_backup_server) {
+ replication_wait();
+ }
ovsdb_jsonrpc_server_wait(jsonrpc);
unixctl_server_wait(unixctl);
SHASH_FOR_EACH(node, all_dbs) {
diff --git a/ovsdb/replication.c b/ovsdb/replication.c
index f49bfe301..19626a5dc 100644
--- a/ovsdb/replication.c
+++ b/ovsdb/replication.c
@@ -112,6 +112,14 @@ replication_run(struct shash *all_dbs)
}
void
+replication_wait(void)
+{
+ if (rpc) {
+ jsonrpc_wait(rpc);
+ }
+}
+
+void
set_active_ovsdb_server(const char *active_server)
{
active_ovsdb_server = nullable_xstrdup(active_server);
diff --git a/ovsdb/replication.h b/ovsdb/replication.h
index 32ea806b8..d80afb2fa 100644
--- a/ovsdb/replication.h
+++ b/ovsdb/replication.h
@@ -32,6 +32,7 @@ struct db {
void replication_init(void);
void replication_run(struct shash *dbs);
+void replication_wait(void);
void set_active_ovsdb_server(const char *remote_server);
const char *get_active_ovsdb_server(void);
void set_tables_blacklist(const char *blacklist);