summaryrefslogtreecommitdiff
path: root/ovsdb
diff options
context:
space:
mode:
authorAndy Zhou <azhou@ovn.org>2016-07-28 11:35:01 -0700
committerAndy Zhou <azhou@ovn.org>2016-08-14 22:10:32 -0700
commitf53d75183f776453a544756fd4efb20f364174dc (patch)
treea5cba27ff0458d29c43007ccf69b903e02c0b01b /ovsdb
parent884d9bad71f56c4f3e4b5d7dd5e62d6fdb964ee1 (diff)
downloadopenvswitch-f53d75183f776453a544756fd4efb20f364174dc.tar.gz
ovsdb: Rename replication related variable names.
Current replication code refers the other ovsdb-sever instance as a 'remote'. which is overloaded in ovsdb. Switching to use active/backup instead to make it less confusing. Active is the server that should be servicing the client, backup server is the server that boots with the --sync-from option. 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.1.in18
-rw-r--r--ovsdb/ovsdb-server.c58
-rw-r--r--ovsdb/replication.c34
-rw-r--r--ovsdb/replication.h8
4 files changed, 59 insertions, 59 deletions
diff --git a/ovsdb/ovsdb-server.1.in b/ovsdb/ovsdb-server.1.in
index 1d932c0be..0667419d5 100644
--- a/ovsdb/ovsdb-server.1.in
+++ b/ovsdb/ovsdb-server.1.in
@@ -188,20 +188,20 @@ again (with \fBovsdb\-server/add\-db\fR).
Outputs a list of the currently configured databases added either through
the command line or through the \fBovsdb\-server/add\-db\fR command.
.
-.IP "\fBovsdb\-server/set\-remote\-ovsdb\-server \fIserver"
-Sets the remote \fIserver\fR from which \fBovsdb\-server\fR connects through
-\fBovsdb\-server/connect\-remote\-ovsdb\-server\fR.
+.IP "\fBovsdb\-server/set\-active\-ovsdb\-server \fIserver"
+Sets the active \fIserver\fR from which \fBovsdb\-server\fR connects through
+\fBovsdb\-server/connect\-active\-ovsdb\-server\fR.
.
-.IP "\fBovsdb\-server/get\-remote\-ovsdb\-server"
-Gets the remote server from which \fBovsdb\-server\fR is currently synchronizing
+.IP "\fBovsdb\-server/get\-active\-ovsdb\-server"
+Gets the active server from which \fBovsdb\-server\fR is currently synchronizing
its databases.
.
-.IP "\fBovsdb\-server/connect\-remote\-ovsdb\-server"
+.IP "\fBovsdb\-server/connect\-active\-ovsdb\-server"
Causes \fBovsdb\-server\fR to synchronize its databases with the server
-specified by \fBovsdb\-server/set\-remote\-ovsdb\-server\fR.
+specified by \fBovsdb\-server/set\-active\-ovsdb\-server\fR.
.
-.IP "\fBovsdb\-server/disconnect\-remote\-ovsdb\-server"
-Causes \fBovsdb\-server\fR to stop synchronizing its databases with a remote server.
+.IP "\fBovsdb\-server/disconnect\-active\-ovsdb\-server"
+Causes \fBovsdb\-server\fR to stop synchronizing its databases with a active server.
.
.IP "\fBovsdb\-server/set\-sync\-excluded\-tables \fIdb\fB:\fItable\fR[\fB,\fIdb\fB:\fItable\fR]..."
Sets the \fItable\fR whitin \fIdb\fR that will be excluded from synchronization.
diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c
index bb65637a5..937c36ed0 100644
--- a/ovsdb/ovsdb-server.c
+++ b/ovsdb/ovsdb-server.c
@@ -69,7 +69,7 @@ static char *ca_cert_file;
static bool bootstrap_ca_cert;
/* Replication configuration. */
-static bool connect_to_remote_server;
+static bool is_backup_server;
static unixctl_cb_func ovsdb_server_exit;
static unixctl_cb_func ovsdb_server_compact;
@@ -77,10 +77,10 @@ static unixctl_cb_func ovsdb_server_reconnect;
static unixctl_cb_func ovsdb_server_perf_counters_clear;
static unixctl_cb_func ovsdb_server_perf_counters_show;
static unixctl_cb_func ovsdb_server_disable_monitor_cond;
-static unixctl_cb_func ovsdb_server_set_remote_ovsdb_server;
-static unixctl_cb_func ovsdb_server_get_remote_ovsdb_server;
-static unixctl_cb_func ovsdb_server_connect_remote_ovsdb_server;
-static unixctl_cb_func ovsdb_server_disconnect_remote_ovsdb_server;
+static unixctl_cb_func ovsdb_server_set_active_ovsdb_server;
+static unixctl_cb_func ovsdb_server_get_active_ovsdb_server;
+static unixctl_cb_func ovsdb_server_connect_active_ovsdb_server;
+static unixctl_cb_func ovsdb_server_disconnect_active_ovsdb_server;
static unixctl_cb_func ovsdb_server_set_sync_excluded_tables;
static unixctl_cb_func ovsdb_server_get_sync_excluded_tables;
@@ -161,7 +161,7 @@ main_loop(struct ovsdb_jsonrpc_server *jsonrpc, struct shash *all_dbs,
report_error_if_changed(reconfigure_ssl(all_dbs), &ssl_error);
ovsdb_jsonrpc_server_run(jsonrpc);
- if (connect_to_remote_server) {
+ if (is_backup_server) {
replication_run(all_dbs);
}
@@ -202,7 +202,7 @@ main_loop(struct ovsdb_jsonrpc_server *jsonrpc, struct shash *all_dbs,
}
}
- disconnect_remote_server();
+ disconnect_active_server();
free(remotes_error);
}
@@ -341,14 +341,14 @@ main(int argc, char *argv[])
unixctl_command_register("ovsdb-server/perf-counters-clear", "", 0, 0,
ovsdb_server_perf_counters_clear, NULL);
- unixctl_command_register("ovsdb-server/set-remote-ovsdb-server", "", 0, 1,
- ovsdb_server_set_remote_ovsdb_server, NULL);
- unixctl_command_register("ovsdb-server/get-remote-ovsdb-server", "", 0, 0,
- ovsdb_server_get_remote_ovsdb_server, NULL);
- unixctl_command_register("ovsdb-server/connect-remote-ovsdb-server", "", 0, 0,
- ovsdb_server_connect_remote_ovsdb_server, NULL);
- unixctl_command_register("ovsdb-server/disconnect-remote-ovsdb-server", "", 0, 0,
- ovsdb_server_disconnect_remote_ovsdb_server, NULL);
+ unixctl_command_register("ovsdb-server/set-active-ovsdb-server", "", 0, 1,
+ ovsdb_server_set_active_ovsdb_server, NULL);
+ unixctl_command_register("ovsdb-server/get-active-ovsdb-server", "", 0, 0,
+ ovsdb_server_get_active_ovsdb_server, NULL);
+ unixctl_command_register("ovsdb-server/connect-active-ovsdb-server", "", 0, 0,
+ ovsdb_server_connect_active_ovsdb_server, NULL);
+ unixctl_command_register("ovsdb-server/disconnect-active-ovsdb-server", "", 0, 0,
+ ovsdb_server_disconnect_active_ovsdb_server, NULL);
unixctl_command_register("ovsdb-server/set-sync-excluded-tables", "", 0, 1,
ovsdb_server_set_sync_excluded_tables, NULL);
unixctl_command_register("ovsdb-server/get-sync-excluded-tables", "", 0, 0,
@@ -371,7 +371,7 @@ main(int argc, char *argv[])
sset_destroy(&remotes);
sset_destroy(&db_filenames);
unixctl_server_destroy(unixctl);
- destroy_remote_server();
+ destroy_active_server();
if (run_process && process_exited(run_process)) {
int status = process_status(run_process);
@@ -1039,17 +1039,17 @@ report_error_if_changed(char *error, char **last_errorp)
}
static void
-ovsdb_server_set_remote_ovsdb_server(struct unixctl_conn *conn,
+ovsdb_server_set_active_ovsdb_server(struct unixctl_conn *conn,
int argc OVS_UNUSED, const char *argv[],
void *arg_ OVS_UNUSED)
{
- set_remote_ovsdb_server(argv[1]);
- connect_to_remote_server = false;
+ set_active_ovsdb_server(argv[1]);
+ is_backup_server = true;
unixctl_command_reply(conn, NULL);
}
static void
-ovsdb_server_get_remote_ovsdb_server(struct unixctl_conn *conn,
+ovsdb_server_get_active_ovsdb_server(struct unixctl_conn *conn,
int argc OVS_UNUSED,
const char *argv[] OVS_UNUSED,
void *arg_ OVS_UNUSED)
@@ -1057,33 +1057,33 @@ ovsdb_server_get_remote_ovsdb_server(struct unixctl_conn *conn,
struct ds s;
ds_init(&s);
- ds_put_format(&s, "%s\n", get_remote_ovsdb_server());
+ ds_put_format(&s, "%s\n", get_active_ovsdb_server());
unixctl_command_reply(conn, ds_cstr(&s));
ds_destroy(&s);
}
static void
-ovsdb_server_connect_remote_ovsdb_server(struct unixctl_conn *conn,
+ovsdb_server_connect_active_ovsdb_server(struct unixctl_conn *conn,
int argc OVS_UNUSED,
const char *argv[] OVS_UNUSED,
void *arg_ OVS_UNUSED)
{
- if (!connect_to_remote_server) {
+ if (!is_backup_server) {
replication_init();
- connect_to_remote_server = true;
+ is_backup_server = true;
}
unixctl_command_reply(conn, NULL);
}
static void
-ovsdb_server_disconnect_remote_ovsdb_server(struct unixctl_conn *conn,
+ovsdb_server_disconnect_active_ovsdb_server(struct unixctl_conn *conn,
int argc OVS_UNUSED,
const char *argv[] OVS_UNUSED,
void *arg_ OVS_UNUSED)
{
- disconnect_remote_server();
- connect_to_remote_server = false;
+ disconnect_active_server();
+ is_backup_server = false;
unixctl_command_reply(conn, NULL);
}
@@ -1448,8 +1448,8 @@ parse_options(int *argcp, char **argvp[],
break;
case OPT_SYNC_FROM:
- set_remote_ovsdb_server(optarg);
- connect_to_remote_server = true;
+ set_active_ovsdb_server(optarg);
+ is_backup_server = true;
break;
case OPT_SYNC_EXCLUDE:
diff --git a/ovsdb/replication.c b/ovsdb/replication.c
index 099c52da8..f49bfe301 100644
--- a/ovsdb/replication.c
+++ b/ovsdb/replication.c
@@ -32,7 +32,7 @@
#include "table.h"
#include "transaction.h"
-static char *remote_ovsdb_server;
+static char *active_ovsdb_server;
static struct jsonrpc *rpc;
static struct sset monitored_tables = SSET_INITIALIZER(&monitored_tables);
static struct sset tables_blacklist = SSET_INITIALIZER(&tables_blacklist);
@@ -84,7 +84,7 @@ replication_init(void)
void
replication_run(struct shash *all_dbs)
{
- if (sset_is_empty(&monitored_tables) && remote_ovsdb_server) {
+ if (sset_is_empty(&monitored_tables) && active_ovsdb_server) {
/* Reset local databases. */
if (reset_dbs) {
struct ovsdb_error *error = reset_databases(all_dbs);
@@ -98,7 +98,7 @@ replication_run(struct shash *all_dbs)
/* Open JSON-RPC. */
jsonrpc_close(rpc);
- rpc = open_jsonrpc(remote_ovsdb_server);
+ rpc = open_jsonrpc(active_ovsdb_server);
if (!rpc) {
return;
}
@@ -112,15 +112,15 @@ replication_run(struct shash *all_dbs)
}
void
-set_remote_ovsdb_server(const char *remote_server)
+set_active_ovsdb_server(const char *active_server)
{
- remote_ovsdb_server = nullable_xstrdup(remote_server);
+ active_ovsdb_server = nullable_xstrdup(active_server);
}
const char *
-get_remote_ovsdb_server(void)
+get_active_ovsdb_server(void)
{
- return remote_ovsdb_server;
+ return active_ovsdb_server;
}
void
@@ -139,7 +139,7 @@ get_tables_blacklist(void)
}
void
-disconnect_remote_server(void)
+disconnect_active_server(void)
{
jsonrpc_close(rpc);
sset_clear(&monitored_tables);
@@ -147,15 +147,15 @@ disconnect_remote_server(void)
}
void
-destroy_remote_server(void)
+destroy_active_server(void)
{
jsonrpc_close(rpc);
sset_destroy(&monitored_tables);
sset_destroy(&tables_blacklist);
- if (remote_ovsdb_server) {
- free(remote_ovsdb_server);
- remote_ovsdb_server = NULL;
+ if (active_ovsdb_server) {
+ free(active_ovsdb_server);
+ active_ovsdb_server = NULL;
}
}
@@ -402,10 +402,10 @@ check_for_notifications(struct shash *all_dbs)
return;
} else if (error) {
jsonrpc_close(rpc);
- rpc = open_jsonrpc(remote_ovsdb_server);
+ rpc = open_jsonrpc(active_ovsdb_server);
if (!rpc) {
- /* Remote server went down. */
- disconnect_remote_server();
+ /* Active server went down. */
+ disconnect_active_server();
}
jsonrpc_msg_destroy(msg);
return;
@@ -466,7 +466,7 @@ process_notification(struct json *table_updates, struct ovsdb *database)
error:
if (error) {
ovsdb_error_assert(error);
- disconnect_remote_server();
+ disconnect_active_server();
}
}
@@ -650,7 +650,7 @@ replication_usage(void)
{
printf("\n\
Syncing options:\n\
- --sync-from=SERVER sync DATABASE from remote SERVER\n\
+ --sync-from=SERVER sync DATABASE from active SERVER\n\
--sync-exclude-tables=DB:TABLE,...\n\
exclude the TABLE in DB from syncing\n");
}
diff --git a/ovsdb/replication.h b/ovsdb/replication.h
index 1b2d3e4dc..32ea806b8 100644
--- a/ovsdb/replication.h
+++ b/ovsdb/replication.h
@@ -32,12 +32,12 @@ struct db {
void replication_init(void);
void replication_run(struct shash *dbs);
-void set_remote_ovsdb_server(const char *remote_server);
-const char *get_remote_ovsdb_server(void);
+void set_active_ovsdb_server(const char *remote_server);
+const char *get_active_ovsdb_server(void);
void set_tables_blacklist(const char *blacklist);
struct sset get_tables_blacklist(void);
-void disconnect_remote_server(void);
-void destroy_remote_server(void);
+void disconnect_active_server(void);
+void destroy_active_server(void);
const struct db *find_db(const struct shash *all_dbs, const char *db_name);
void replication_usage(void);