2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00
Commit Graph

15 Commits

Author SHA1 Message Date
Ben Pfaff
5a0e4aec1a treewide: Convert leading tabs to spaces.
It's always been OVS coding style to use spaces rather than tabs for
indentation, but some tabs have snuck in over time.  This commit converts
them to spaces.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
2018-06-11 15:32:00 -07:00
Ben Pfaff
fed2775975 log: Support multiple magic.
Some OVSDB tools will want to open files that might be standalone or
clustered databases, and so it's better if ovsdb_log_open() can accept more
than one valid "magic".  This commit makes that possible.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
2017-12-24 16:19:24 -08:00
Ben Pfaff
421fc8a135 log: New functions for replacing a log's contents.
These functions will acquire users in future commits.

This new functionality made the internal state machine of the log hard
enough to understand that I thought that it was best to make it explicit
with a 'state' variable, so this commit introduces one.

This commit duplicates code and logic from ovsdb_rename() and
ovsdb_compact() in ovsdb/file.c.  A future commit removes this duplication.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
2017-12-24 11:56:42 -08:00
Ben Pfaff
1e0b7e94ec log: Add new open mode OVSDB_LOG_CREATE_EXCL.
Until now, OVSDB_LOG_CREATE implied EXCL, but this commit breaks them
apart.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
2017-12-24 11:47:33 -08:00
Ben Pfaff
4407aa48cd log: Require log entries to be JSON objects.
The current and upcoming users of the OVSDB logging module only use
JSON objects as records.  This commit simplifies the users slightly
by allowing them to always assume that the records are JSON objects.

Unfortunately this resulted in a large number of updates to tests,
which didn't always use JSON objects.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
2017-12-24 11:46:45 -08:00
Ben Pfaff
19b276cb44 log: Allow client to specify magic.
Until now, the logging code in ovsdb has only supported a single file
format, for OVSDB standalone database files.  Upcoming commits will add
support for another, incompatible format, which uses a different magic
string for identification.  This commit allows the logging code to
support both formats.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
2017-12-24 11:43:59 -08:00
Ben Pfaff
a6be657b29 ovsdb: Improve error message from ovsdb_log_open() open failure.
Previously, error messages ended up looking like:
    ovsdb-tool: I/O error: create: $DBFILE failed (File exists)
which is hard to understand.  This commit changes them to:
    ovsdb-tool: I/O error: $DBFILE: create failed (File exists)
which makes more sense.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
2016-03-30 22:38:49 -07:00
Ben Pfaff
c640c04f64 json: Correct position tracking in JSON parser implementations.
When json_lex_input() returns false, the parser does not consume the byte
passed in.  That byte will get processed again in the next iteration of
the json_parser_feed() loop.  Therefore, until now, this code has
double-counted bytes that cause a false return from json_lex_input().

This fixes the problem.  Every input byte is now counted only once.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-04-26 09:48:28 -07:00
Ben Pfaff
bc9dcfb371 lockfile: Don't warn if successful lock takes a little time.
This code issues a warning if obtaining a lock takes even 1 millisecond.
That's far too aggressive.  There's no need to warn if we have to wait
a few milliseconds.  This function already warns elsewhere if locking takes
more than 1 second, which is much more reasonable.

This change allows us to test ovsdb-server stderr output more carefully.
Before now, the tests had to ignore what ovsdb-server writes to stderr
because sometimes it would log a warning that locking took 1 ms (or so).

Reviewed-by: Simon Horman <horms@verge.net.au>
2011-05-13 14:43:44 -07:00
Ben Pfaff
fe1e967e3b Add a few more users for ovs_retval_to_string(). 2011-04-04 10:58:54 -07:00
Ben Pfaff
7446f1480b ovsdb: Allow ovsdb_log_open()'s caller to choose whether to lock.
The current callers of ovsdb_log_open() always want to lock the file if
they are accessing it for read/write access.  An upcoming commit will add
a new caller that does not fit this model (it wants to lock the file
across a wider region) and so the caller should be able to choose whether
to do locking.  This commit adds that ability.

Also, get rid of the use of <fcntl.h> flags to choose the open mode, which
has always seemed somewhat crude and which this change would make even
cruder.
2010-02-15 11:31:32 -08:00
Ben Pfaff
28447a186b tests: Fix timing dependency in ovsdb-log test.
The "lockfile" module logs a message if locking takes a measurable amount
of time.  Running the tests under valgrind tends to make this message
appear, so we need to disable it to make the output comparison come out
cleanly.
2010-02-02 15:21:09 -08:00
Ben Pfaff
7c126fbb8a Rework and simplify the "lcov" support for the testsuite. 2010-02-02 15:21:09 -08:00
Ben Pfaff
0bdf342a8c json: Improve error reporting. 2009-12-03 16:08:34 -08:00
Ben Pfaff
41709cccb8 ovsdb: Rename ovsdb_file to ovsdb_log.
This prepares for introducing a new, higher-level ovsdb_file that
encapsulates ovsdb storage in a file.
2009-11-16 10:55:27 -08:00