diff options
author | Ilya Maximets <i.maximets@ovn.org> | 2021-05-27 15:29:02 +0200 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2021-06-07 21:03:16 +0200 |
commit | 182a0b8ad0f226a5463f72aa402b36eec5c2a2d6 (patch) | |
tree | 3dd8d2fae567e33db8ba9a40fe8a5b12a98cc6df | |
parent | 07a07d06a8a14aee238cfd39e5bc530cc4daaa38 (diff) | |
download | openvswitch-182a0b8ad0f226a5463f72aa402b36eec5c2a2d6.tar.gz |
ovsdb-server: Integrate stream replay engine.
This change adds support of stream record/replay functionality to
ovsdb-server.
Since current replay engine doesn't work well with time-based
events generated locally, it will work only with standalone databases
for now (raft heavily depends on time).
To use this functionality run:
Recording:
# create a directory for replay files.
mkdir replay_dir
# copy current db for later use by replay
cp my_db ./replay_dir/my_db
ovsdb-server --record=./replay_dir <OVSDB_ARGS> my_db
# connect some clients and run some ovsdb transactions
ovs-appctl -t ovsdb-server exit
Replay:
# restore db from the copy
cp ./replay_dir/my_db my_db.for_replay
ovsdb-server --replay=./replay_dir <OVSDB_ARGS> my_db.for_replay
At this point ovsdb-server should execute all the same commands
and transactions. Since the last command was 'exit' via unixctl,
ovsdb-server will exit in the end.
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Acked-by: Dumitru Ceara <dceara@redhat.com>
-rw-r--r-- | ovsdb/ovsdb-server.1.in | 2 | ||||
-rw-r--r-- | ovsdb/ovsdb-server.c | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/ovsdb/ovsdb-server.1.in b/ovsdb/ovsdb-server.1.in index 5a7f3ba13..fdd52e8f6 100644 --- a/ovsdb/ovsdb-server.1.in +++ b/ovsdb/ovsdb-server.1.in @@ -24,6 +24,7 @@ ovsdb\-server \- Open vSwitch database server .so lib/ssl-peer-ca-cert-syn.man .so lib/ssl-connect-syn.man .so lib/unixctl-syn.man +.so lib/ovs-replay-syn.man .so lib/common-syn.man . .SH DESCRIPTION @@ -188,6 +189,7 @@ one row in \fItable\fR.) .so lib/ssl-connect.man .SS "Other Options" .so lib/unixctl.man +.so lib/ovs-replay.man .so lib/common.man .SH "RUNTIME MANAGEMENT COMMANDS" \fBovs\-appctl\fR(8) can send commands to a running diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c index 29a2bace8..564085e77 100644 --- a/ovsdb/ovsdb-server.c +++ b/ovsdb/ovsdb-server.c @@ -36,6 +36,7 @@ #include "openvswitch/list.h" #include "memory.h" #include "monitor.h" +#include "ovs-replay.h" #include "ovsdb.h" #include "ovsdb-data.h" #include "ovsdb-types.h" @@ -1797,6 +1798,7 @@ parse_options(int argc, char *argv[], VLOG_OPTION_ENUMS, DAEMON_OPTION_ENUMS, SSL_OPTION_ENUMS, + OVS_REPLAY_OPTION_ENUMS, }; static const struct option long_options[] = { @@ -1812,6 +1814,7 @@ parse_options(int argc, char *argv[], {"bootstrap-ca-cert", required_argument, NULL, OPT_BOOTSTRAP_CA_CERT}, {"peer-ca-cert", required_argument, NULL, OPT_PEER_CA_CERT}, STREAM_SSL_LONG_OPTIONS, + OVS_REPLAY_LONG_OPTIONS, {"sync-from", required_argument, NULL, OPT_SYNC_FROM}, {"sync-exclude-tables", required_argument, NULL, OPT_SYNC_EXCLUDE}, {"active", no_argument, NULL, OPT_ACTIVE}, @@ -1887,6 +1890,8 @@ parse_options(int argc, char *argv[], stream_ssl_set_peer_ca_cert_file(optarg); break; + OVS_REPLAY_OPTION_HANDLERS + case OPT_SYNC_FROM: *sync_from = xstrdup(optarg); break; @@ -1945,6 +1950,7 @@ usage(void) daemon_usage(); vlog_usage(); replication_usage(); + ovs_replay_usage(); printf("\nOther options:\n" " --run COMMAND run COMMAND as subprocess then exit\n" " --unixctl=SOCKET override default control socket name\n" |