diff options
author | Dumitru Ceara <dceara@redhat.com> | 2020-08-03 17:05:28 +0200 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2020-09-16 00:15:37 +0200 |
commit | 7024ddf3202646095adfbb1998904abd7b21f6e3 (patch) | |
tree | f16082d2ba8a35843792209f45c10638009ac4c4 /ovsdb/storage.c | |
parent | 27dc7adf66b1af88f238da46c6430e3d2eaa4da3 (diff) | |
download | openvswitch-7024ddf3202646095adfbb1998904abd7b21f6e3.tar.gz |
ovsdb: Add unixctl command to show storage status.
If a database enters an error state, e.g., in case of RAFT when reading
the DB file contents if applying the RAFT records triggers constraint
violations, there's no way to determine this unless a client generates a
write transaction. Such write transactions would fail with "ovsdb-error:
inconsistent data".
This commit adds a new command to show the status of the storage that's
backing a database.
Example, on an inconsistent database:
$ ovs-appctl -t /tmp/test.ctl ovsdb-server/get-db-storage-status DB
status: ovsdb error: inconsistent data
Example, on a consistent database:
$ ovs-appctl -t /tmp/test.ctl ovsdb-server/get-db-storage-status DB
status: ok
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Acked-by: Han Zhou <hzhou@ovn.org>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'ovsdb/storage.c')
-rw-r--r-- | ovsdb/storage.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ovsdb/storage.c b/ovsdb/storage.c index 7b4ad16f6..f662e9056 100644 --- a/ovsdb/storage.c +++ b/ovsdb/storage.c @@ -198,6 +198,16 @@ ovsdb_storage_get_memory_usage(const struct ovsdb_storage *storage, } } +char * +ovsdb_storage_get_error(const struct ovsdb_storage *storage) +{ + if (storage->error) { + return ovsdb_error_to_string(storage->error); + } + + return NULL; +} + void ovsdb_storage_run(struct ovsdb_storage *storage) { |