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_monitor2;
struct server_config {
struct sset *remotes;
process_init();
parse_options(&argc, &argv, &remotes, &unixctl_path, &run_command);
+ daemon_become_new_user(false);
/* Create and initialize 'config_tmpfile' as a temporary file to hold
* ovsdb-server's most basic configuration, and then save our initial
save_config__(config_tmpfile, &remotes, &db_filenames);
- daemonize_start();
+ daemonize_start(false);
/* Load the saved config. */
load_config(config_tmpfile, &remotes, &db_filenames);
shash_init(&all_dbs);
server_config.all_dbs = &all_dbs;
server_config.jsonrpc = jsonrpc;
+
+ perf_counters_init();
+
SSET_FOR_EACH (db_filename, &db_filenames) {
error = open_db(&server_config, db_filename);
if (error) {
daemonize_complete();
- perf_counters_init();
-
if (!run_command) {
/* ovsdb-server is usually a long-running process, in which case it
* makes plenty of sense to log the version, but --run makes
unixctl_command_register("ovsdb-server/perf-counters-clear", "", 0, 0,
ovsdb_server_perf_counters_clear, NULL);
+ /* Simulate the behavior of OVS release prior to version 2.5 that
+ * does not support the monitor2 method. */
+ unixctl_command_register("ovsdb-server/disable-monitor2", "", 0, 0,
+ ovsdb_server_disable_monitor2, jsonrpc);
+
main_loop(jsonrpc, &all_dbs, unixctl, &remotes, run_process, &exiting);
ovsdb_jsonrpc_server_destroy(jsonrpc);
close_db(db);
shash_delete(&all_dbs, node);
}
+ shash_destroy(&all_dbs);
sset_destroy(&remotes);
sset_destroy(&db_filenames);
unixctl_server_destroy(unixctl);
unixctl_command_reply(conn, NULL);
}
+/* "ovsdb-server/disable-monitor2": makes ovsdb-server drop all of its
+ * JSON-RPC connections and reconnect. New sessions will not recognize
+ * the 'monitor2' method. */
+static void
+ovsdb_server_disable_monitor2(struct unixctl_conn *conn, int argc OVS_UNUSED,
+ const char *argv[] OVS_UNUSED, void *jsonrpc_)
+{
+ struct ovsdb_jsonrpc_server *jsonrpc = jsonrpc_;
+
+ ovsdb_jsonrpc_disable_monitor2();
+ ovsdb_jsonrpc_server_reconnect(jsonrpc);
+ unixctl_command_reply(conn, NULL);
+}
+
static void
ovsdb_server_compact(struct unixctl_conn *conn, int argc,
const char *argv[], void *dbs_)