ovsdb: Add replication support and refactor files in terms of replication.
[openvswitch] / ovsdb / ovsdb-server.c
index 17a9970ea9e1d17ac33b27b546a44eb844a3b33c..a91e77893db470b2d656163471819de2713600d3 100644 (file)
@@ -24,6 +24,7 @@
 #include "command-line.h"
 #include "daemon.h"
 #include "fault.h"
+#include "file.h"
 #include "json.h"
 #include "jsonrpc.h"
 #include "jsonrpc-server.h"
@@ -48,8 +49,6 @@ static void parse_options(int argc, char *argv[], char **file_namep,
                           struct svec *active, struct svec *passive);
 static void usage(void) NO_RETURN;
 
-static void ovsdb_transact(struct unixctl_conn *, const char *args, void *db);
-
 int
 main(int argc, char *argv[])
 {
@@ -70,7 +69,7 @@ main(int argc, char *argv[])
 
     parse_options(argc, argv, &file_name, &active, &passive);
 
-    error = ovsdb_open(file_name, false, &db);
+    error = ovsdb_file_open(file_name, false, &db);
     if (error) {
         ovs_fatal(0, "%s", ovsdb_error_to_string(error));
     }
@@ -90,8 +89,6 @@ main(int argc, char *argv[])
         ovs_fatal(retval, "could not listen for control connections");
     }
 
-    unixctl_command_register("ovsdb/transact", ovsdb_transact, db);
-
     for (;;) {
         ovsdb_jsonrpc_server_run(jsonrpc);
         unixctl_server_run(unixctl);
@@ -198,26 +195,3 @@ usage(void)
     leak_checker_usage();
     exit(EXIT_SUCCESS);
 }
-\f
-static void
-ovsdb_transact(struct unixctl_conn *conn, const char *args, void *db_)
-{
-    struct ovsdb *db = db_;
-    struct json *request, *reply;
-    char *reply_string;
-
-    /* Parse JSON. */
-    request = json_from_string(args);
-    if (request->type == JSON_STRING) {
-        unixctl_command_reply(conn, 501, request->u.string);
-        json_destroy(request);
-        return;
-    }
-
-    /* Execute command. */
-    reply = ovsdb_execute(db, request, 0, NULL);
-    reply_string = json_to_string(reply, 0);
-    unixctl_command_reply(conn, 200, reply_string);
-    free(reply_string);
-    json_destroy(reply);
-}