2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-29 05:18:13 +00:00

38 Commits

Author SHA1 Message Date
Ben Pfaff
ebc56baa41 util: New macro CONST_CAST.
Casts are sometimes necessary.  One common reason that they are necessary
is for discarding a "const" qualifier.  However, this can impede
maintenance: if the type of the expression being cast changes, then the
presence of the cast can hide a necessary change in the code that does the
cast.  Using CONST_CAST, instead of a bare cast, makes these changes
visible.

Inspired by my own work elsewhere:
http://git.savannah.gnu.org/cgit/pspp.git/tree/src/libpspp/cast.h#n80

Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-08-03 13:33:13 -07:00
Ben Pfaff
57c8677b51 system-stats: Use "smap" instead of "shash".
"smap" is now the appropriate data structure for a string-to-string map.

Also changes ovsdb_datum_from_shash() into ovsdb_datum_from_smap() since
system-stats related code was the only client.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-07-18 10:51:02 -07:00
Raju Subramanian
e0edde6fee Global replace of Nicira Networks.
Replaced all instances of Nicira Networks(, Inc) to Nicira, Inc.

Feature #10593
Signed-off-by: Raju Subramanian <rsubramanian@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-05-02 17:08:02 -07:00
Ben Pfaff
e49190c493 Fix minor memory leaks found by valgrind.
All of these leaks are in normally short-lived programs, so none of them
is very important.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-03-28 14:54:48 -07:00
Ben Pfaff
ca261b6535 ovsdb-data: Short-circuit ovsdb_datum_includes_all() in trivial case.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-01-11 09:56:11 -08:00
Ben Pfaff
6a6f8d1673 ovsdb-data: Simplify converting an OVSDB datum to JSON by reordering logic.
Putting the "map" case first avoids duplicate tests.

Suggested-by: Reid Price <reid@nicira.com>
2011-08-24 11:57:42 -07:00
Ben Pfaff
be44585c21 tests: Fix the two Python XFAIL tests.
OVS has two Python tests that have always failed, for reasons not
understood, since they were added to the tree.  This commit fixes them.

One problem was that Python was assuming that stdout was encoded in ASCII.
Apparently the only way to "fix" this at runtime is to set PYTHONIOENCODING
to utf_8 in the environment, so this change does that.

Second, it appears that Python really doesn't like to print invalid UTF-8,
so this avoids doing that in python/ovs/json.py, instead just printing
the hexadecimal values of the invalid bytes.  For consistency, it makes
the same change to the C version.

Third, the C version of test-ovsdb doesn't check UTF-8 for consistency, it
just sends it blindly to the OVSDB server, but Python does check it and so
it bails out earlier.  This commit changes the Python version of the
"no invalid UTF-8 sequences in strings" to allow for the slight difference
in output that occurs for that reason.

Finally, test-ovsdb.py needs to convert error messages to Unicode
explicitly before printing them in the "parse-atoms" function.  I don't
really understand why, but now it works.
2011-05-24 11:32:22 -07:00
Ben Pfaff
c5f341ab19 ovsdb: Implement garbage collection. 2011-03-10 11:24:00 -08:00
Ben Pfaff
0dc66db95b ovsdb-data: Expose guts of ovsdb_symbol_table() to clients.
ovs-vsctl will, in upcoming commits, want to more closely examine its
ovsdb_symbol_table structures.  This could be done by providing a more
complete API, but it doesn't seem worth it to me.  This commit instead goes
the other way, exposing the internals to clients.  This commit also
eliminates the ovsdb_symbol_table_find_uncreated() function, which
ovs-vsctl can now implement itself.
2011-03-10 11:24:00 -08:00
Ben Pfaff
e9387de4a2 ovsdb-data: Rename 'used' to 'created' in struct ovsdb_symbol.
The name 'created' better reflects the actual meaning of this member: in
both ovsdb and ovs-vsctl, it is true if a row has been created with the
symbol's UUID and false otherwise.
2011-03-10 11:24:00 -08:00
Ben Pfaff
d198c4beee ovsdb-data: Verify that named-uuid string is an <id>.
The "uuid-name" that creates symbols must be an <id> but we weren't
verifying the same constraint on the "named-uuid"s that refer to symbols,
which was a bit confusing in writing transactions by hand.  This commit
fixes the inconsistency and updates the SPECS file to clarify that a
named-uuid string has to be an <id>.
2011-03-10 11:23:59 -08:00
Justin Pettit
9466d7d4b9 ovsdb-data: Free string leaked in ovsdb_datum_from_string().
Coverity #10725
2011-02-22 09:36:57 -08:00
Ben Pfaff
c6a4125250 table: Add new "bare" output formatting options.
--format=list corresponds to the output format that "ovs-vsctl list" has
always used.

--bare is easier for scripts to parse.
2011-02-08 16:10:05 -08:00
Ethan Jackson
829d41bdc8 ovsdb-data: Fix warnings.
This commit fixes "may be used uninitialized" warnings in
ovsdb-data.c
2011-01-13 10:48:22 -08:00
Ben Pfaff
e4af561537 ovsdb-data: New function ovsdb_datum_from_shash(). 2010-09-23 11:45:35 -07:00
Ben Pfaff
d931cde4d7 ovsdb: Remove unused ovsdb_datum_from_json_unique().
This function was not used outside of the test-ovsdb program.  It seems
like we might as well remove it.
2010-08-25 14:55:47 -07:00
Ben Pfaff
2b66469b96 ovsdb: New functions ovsdb_datum_sort_unique(), ovsdb_datum_from_json_unique().
These new functions are more forgiving than the corresponding functions
without "_unique".  The goal is to be more tolerant of data provided by
IDL clients, which will happen in a followup patch.
2010-07-12 10:07:36 -07:00
Ben Pfaff
958ac03a3f ovsdb: New functions ovsdb_atom_default(), ovsdb_datum_default().
Having access to const copies of default atoms and data will allow OVSDB
code to avoid memory allocations and reduce copying in upcoming commits.
2010-07-12 10:05:16 -07:00
Ben Pfaff
5413de95be ovsdb: Document some ovsdb-data.[ch] functions. 2010-07-12 10:03:33 -07:00
Ben Pfaff
e89e5374be ovs-vsctl: Prepare for more flexible database argument parsing.
The wait-until command to be added in an upcoming commit needs to support
!=, <, >, <=, and >= operators in addition to =, so this commit adds that
infrastructure.
2010-06-29 09:33:13 -07:00
Ben Pfaff
506051fcb5 Use shash_destroy_free_data() to simplify a few scattered pieces of code. 2010-06-23 12:43:02 -07:00
Ben Pfaff
ce5a3e38da ovs-vsctl: Support references among records at creation time.
This makes it easy to create a bunch of records that are all related to
each other in a single ovs-vsctl invocation.  It adds an example to the
ovs-vsctl manpage.
2010-06-17 10:30:18 -07:00
Ben Pfaff
bfc96d9b50 ovsdb: Add support for "enum" constraints.
Some of the uses for the formerly supported regular expression constraints
were simply to limit values to those in a set of allowed values.
This commit adds support for that kind of simple enumeration constraint.
2010-02-25 14:59:41 -08:00
Ben Pfaff
89521e3f79 ovsdb: Drop regular expression constraints.
Regular expression constraints have caused nothing but trouble due to the
lack of a ubiquitous regular expression library.  PCRE is *almost*
everywhere, but it has different versions, and different features, and
different bugs, in different places.  It is more trouble than it is worth.
So this commit drops support.
2010-02-25 14:59:16 -08:00
Ben Pfaff
ae8f13e290 ovsdb: Make scalars and 1-element sets interchangeable.
It is natural to write "abc" in place of ["set",["abc"]] and vice versa.
I cannot think of a reason not to support this, and it can make reading
and writing OVSDB files and transactions easier, so support it.
2010-02-08 16:37:49 -08:00
Ben Pfaff
fbf925e45d ovsdb: Get rid of "declare" operation.
It's more elegant, and just as easy to implement, if we allow a
"named-uuid" to be a forward reference to a "uuid-name" in a later
"insert" operation.
2010-02-08 16:03:21 -08:00
Ben Pfaff
0d0f05b909 ovsdb: Add support for referential integrity in the database itself. 2010-02-08 14:16:19 -08:00
Ben Pfaff
bd76d25d8b ovsdb: Add simple constraints. 2010-02-08 14:16:19 -08:00
Ben Pfaff
9397a13f60 ovsdb-data: Allow spaces around '=' in key-value pairs.
This allows a = b, a= b, a =b, etc. whereas before only a=b was accepted.
2010-01-28 14:22:40 -08:00
Ben Pfaff
cb4562170b ovsdb-data: Allow arbitrary white space as string data delimiters. 2010-01-28 14:22:40 -08:00
Ben Pfaff
54a687fd7b ovsdb-data: Make string parsing of negative 0 match JSON parsing. 2010-01-28 14:22:39 -08:00
Ben Pfaff
1bc6ff2918 ovs-vsctl: Make parsing functions return error instead of aborting.
The upcoming "remove" command for ovs-vsctl wants to try parsing an
argument two different ways.  This doesn't work if a parse error always
aborts immediately.  This commit fixes the problem, by making a parsing
failure pass up an error for higher layers to deal with instead of aborting
immediately.

This commit should have no user-visible effect.
2010-01-27 13:51:52 -08:00
Ben Pfaff
0194f33a6c ovsdb-datum: Add functions for parsing and formatting atoms, data.
These functions provide an alternative to JSON parsing and formatting that
is more human-friendly (and shorter).

These will be used in an upcoming commit to enhance ovs-vsctl.
2010-01-26 09:49:30 -08:00
Ben Pfaff
2f47998bae ovsdb-data: Add some more functions for dealing with "struct ovsdb_datum".
This commit refactors the functions for working with "struct ovsdb_datum",
adding and exposing some more operations for ovs-vsctl to use in an
upcoming commit.
2010-01-26 09:49:30 -08:00
Ben Pfaff
c532bf9dd4 ovsdb: Save some space in the log for newly inserted records.
When a new record is inserted into a database, ovsdb logs the values of all
of the fields in the record.  However, often new records have many columns
that contain default values.  There is no need to log those values, so this
commit causes them to be omitted.

As a side effect, this also makes "ovsdb-tool show-log --more --more"
output easier to read, because record insertions print less noise.  (Adding
--more --more to this command makes it print changes to database records.
The --more option will be introduced in an upcoming commit.)
2010-01-11 13:14:54 -08:00
Ben Pfaff
e9f8f9367e ovsdb: Add new "mutation" operation to transactions. 2009-12-16 10:56:04 -08:00
Ben Pfaff
2d2d6d4a71 ovsdb: Implement new "declare" operation. 2009-12-07 17:10:28 -08:00
Ben Pfaff
f85f8ebbfa Initial implementation of OVSDB. 2009-11-04 17:12:10 -08:00