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

124 Commits

Author SHA1 Message Date
Ben Pfaff
1611cf3f5a ovs-vsctl: Clarify that uuid_from_string() shouldn't fail in post_create().
Coverity #10701.
2011-02-23 15:14:42 -08:00
Ben Pfaff
4a433a0fc5 ovs-vsctl: Simplify parse_column_key_value().
Coverity pointed out some inconsistencies on tests for whether columnp and
keyp were nonnull.  These tests were, at best, confusing, but in fact every
caller always passed nonnull for both parameters, so this commit drops all
of those tests.

Coverity #10715, 10710.
2011-02-23 15:14:42 -08:00
Justin Pettit
cea0c39367 ovs-vsctl: Free "columns" in cmd_find().
Coverity #10730
2011-02-23 11:08:20 -08:00
Justin Pettit
a6c8e0d9e9 ovs-vsctl: Check "key" is valid before dereferencing in get_external_id().
Coverity #10716
2011-02-22 10:14:53 -08:00
Andrew Evans
289df16d29 ovsdb: Remove 'managers' column from 'Open vSwitch' table.
We had retained but deprecated the use of the older 'managers' column in the
'Open vSwitch' table for compatibility with applications that might still use
it, but that created more problems than it solved. This commit removes the
'managers' column from the schema, and removes all references to it from the
code, init scripts, documentation, and tests.
2011-02-18 11:09:29 -08:00
Ben Pfaff
ae9a3235bf ovs-vsctl: Improve documentation and --help output. 2011-02-15 12:24:28 -08:00
Ben Pfaff
e051b42c41 ovs-vsctl: Add formatting options for the "list" and "find" commands.
The default format is the same as before (which the testsuite verifies).
The most important use for the new formatting options is --bare, which
outputs a format that is easy to parse from a shell script.  An upcoming
patch will start using that.
2011-02-08 16:10:34 -08:00
Ben Pfaff
0a140468dd ovs-vsctl: Add new "find" command.
This allows listing records that match specified criteria, instead
of just records that have specific names.

This will be used in an upcoming patch, along with --columns, to
list all of the interfaces whose type is 'internal'.
2011-02-08 16:01:28 -08:00
Ben Pfaff
9591fefeea ovs-vsctl: Add --columns options to "list" command.
This allows the user to list just selected columns from a table,
for example just the "name" column.

This will become more useful as additional formatting options
are added in upcoming commits.
2011-02-08 16:01:28 -08:00
Ben Pfaff
f158c54a98 ovs-vsctl: Fix spelling of "satisfied" in function name.
Suggested-by: Ethan Jackson <ethan@nicira.com>
2011-02-08 16:01:28 -08:00
Andrew Evans
24b8b259bb ovs-vsctl: Add commands to get/delete/set manager connections. 2011-02-07 23:13:48 -08:00
Andrew Evans
87824b0bfa ovs-vsctl: Clear manager_options column and delete Manager rows on emer-reset. 2011-02-03 14:20:38 -08:00
Ben Pfaff
c56d226f8d shash: New "smap" functions for working with string-to-string maps.
An shash always has string keys and sometimes it hash string values as
well.  Usually the general-purpose shash functions are fine for working
with string-to-string maps, but this commit introduces a few more
specialized functions that only work with string-to-string maps.  It's not
clear yet to me whether this should actually be a new data structure, so
for now the new functions just work on shashes.

This commit also converts one user of shash_destroy() to use smap_destroy().
This is the only existing user of these functions that I spotted as a
trivial conversion candidate while grepping.

These new functions will see more use in the following commit.

Reviewed by Justin Pettit.
2011-01-27 09:26:06 -08:00
Ethan Jackson
f67e3b6637 ovs-vsctl: emer-reset should clear the fail_mode. 2011-01-18 14:57:08 -08:00
Ben Pfaff
4e3e7ff9fc ovs-vsctl: Fix controller command prerequisites.
The controller commands use the "target" column of the Controller table,
but they don't supply it as a prerequisite, which makes those commands
hang.  This commit fixes the problem.
2010-12-08 17:09:29 -08:00
Ben Pfaff
b43c6fe279 Make installation directories overridable at runtime.
This makes it possible to run tests that need access to installation
directories, such as the rundir, without having access to the actual
installation directories (/var/run is generally not world-writable), by
setting environment variables.  This is not a good way to do things in
general--usually it would be better to choose the correct directories
at configure time--so for now this is undocumented.
2010-11-29 16:29:11 -08:00
Ethan Jackson
b31bcf60cf ovs: Implement 802.1ag Connectivity Fault Management
This commit implements a subset of the 802.1ag specification for
Connectivity Fault Management (CFM) using Continuity Check Messages
(CCM).  When CFM is configured on an interface CCMs are broadcast
at regular intervals to detect missing or unexpected connectivity.
2010-11-29 14:47:15 -08:00
Ben Pfaff
fbd8715e4b ovs-vsctl: Fix br-set-external-id.
The wrong prerequisite function was being called for set-br-external-id, so
it didn't set up to monitor the right columns, so an assertion failed.
This fixes the problem.

Also, change the test for external IDs so that it will find the regression.
(Running all of the ovs-vsctl commands together caused the column to be
monitored due to another command's intervention.)

Reported-by: Mikael Doverhag <mdoverhag@nicira.com>
Bug #4095.
2010-11-18 14:36:53 -08:00
Ben Pfaff
b8fa71021e ovs-vsctl: Make waiting for ovs-vswitchd to reload work again.
Bug introduced in commit e5e12280e "ovs-vsctl: Replicate only tables and
columns that are actually needed."

Reported-by: Paul Ingram <paul@nicira.com>
2010-11-16 12:23:12 -08:00
Ben Pfaff
e5e12280e1 ovs-vsctl: Replicate only tables and columns that are actually needed.
Until now, ovs-vsctl has always fetched a complete replica of the Open
vSwitch database at startup time.  This is a little expensive, but that is
not normally a problem because the database is small.   However, it can
cause problems when Open vSwitch is partially upgraded: if ovs-vsctl is
upgraded before the database, and new columns or tables were added to the
database schema in the newer version of Open vSwitch, then ovs-vsctl will
report an error and fail to work, because it cannot monitor the new
columns.  The same problem occurs if the database is upgraded before
ovs-vsctl and columns or tables were removed in the new version of Open
vSwitch.

This commit fixes the problem in the most common case, by making ovs-vsctl
only replicate the columns and tables in the database that it will actually
use during a given execution.  This will still fail if the database has
changed in major ways, but only if the changes would actually cause
problems for what ovs-vsctl is trying to do anyhow.

Bug #3388.
2010-11-16 09:15:40 -08:00
Ben Pfaff
ef73f86cd4 ovsdb-idl: Make selecting tables and columns to replicate more flexible.
Until now, by default the IDL replicated all tables and all columns in the
database, and a few functions made it possible to avoid replicating
selected columns.  This commit adds a mode in which nothing is replicated
by default and the client code is responsible for specifying each column
and table that it is interested in.  The following commit adds a user for
this mode.
2010-11-16 09:14:52 -08:00
Ben Pfaff
94db54073e Add "Manager" and "manager_options" to allow options for OVSDB connections.
I'm retaining the "managers" column in the Open_vSwitch table for now, but
I hope that applications transition to using "manager_options" eventually
so that we could drop it.

CC: Andrew Lambeth <wal@nicira.com>
CC: Jeremy Stribling <strib@nicira.com>
2010-11-05 10:22:18 -07:00
Ben Pfaff
9106d88c5b ovs-vsctl: Create bridge interface as type "internal".
The bridge device is always an internal interface, so it seems best to
actually mark it as one.  Jesse would like to eventually make the "type"
column mandatory for Interface records, so here's a step in the right
direction.
2010-11-04 13:47:26 -07:00
Ben Pfaff
d98e600755 vlog: Make client supply semicolon for VLOG_DEFINE_THIS_MODULE.
It's kind of odd for VLOG_DEFINE_THIS_MODULE to supply its own semicolon,
so this commit switches to the more common form.
2010-10-29 09:48:47 -07:00
Justin Pettit
b7b6e2c44e ovs-vsctl: Prevent double-free when retrying a transaction 2010-10-22 17:25:02 -07:00
Ben Pfaff
f74055e705 ovs-vsctl: Check for dirty reads within transactions.
OVSDB is transactional but it does not implement any form of locking.  This
means that read-modify-write operations must verify that the values that
they read are still in place before writing.  This commit adds such
checking.

Bug #2387.
Bug #3856.
Bug #3906.
2010-10-22 14:48:09 -07:00
Ben Pfaff
1588bb8d91 ovs-vsctl: Add context pointer to struct vsctl_info.
This will be needed in upcoming commits.
2010-10-22 14:48:09 -07:00
Ben Pfaff
0c18b5a065 ovs-vsctl: Reduce log level for "Called as..." for read-only invocations.
When ovs-vsctl is not actually going to modify the database, it is less
interesting in the log, so we might as well only log it at "debug" level.

Suggested-by: Neil McKee <neil.mckee@inmon.com>
2010-10-01 10:22:03 -07:00
Ben Pfaff
1998cd4d3e ovs-vsctl: Factor out and optimize searching for a command by name.
The following commit will introduce a new function that wants to do this
a lot, so we might as well do it efficiently.
2010-10-01 10:18:51 -07:00
Ben Pfaff
aed133bf9b ovs-vsctl: Allow "get" commands to create @names also.
This is useful for adding records that refer to other records by UUID, e.g.
   ovs-vsctl \
     -- set bridge br0 mirrors=@m \
     -- --id=@eth0 get port eth0 \
     -- --id=@eth0 get port eth1 \
     -- --id=@m create mirror name=mymirror select-dst-port=@eth0 \
                              select-src-port=@eth0 output-port=@eth1
2010-09-21 14:28:02 -07:00
Ben Pfaff
2a022368f4 Avoid shadowing local variable names.
All of these changes avoid using the same name for two local variables
within a same function.  None of them are actual bugs as far as I can tell,
but any of them could be confusing to the casual reader.

The one in lib/ovsdb-idl.c is particularly brilliant: inner and outer
loops both using (different) variables named 'i'.

Found with GCC -Wshadow.
2010-09-20 09:39:54 -07:00
Ben Pfaff
6b7b9d34c0 ovs-vsctl: Remove default timeout.
On overloaded XenServers the current default timeout of 5 seconds can
occasionally be reached, which causes VM startup to fail.  This commit
fixes the problem by removing the default timeout and changing each
invocation of ovs-vsctl within the tree to specify its own timeout,
if appropriate.

Bug #3573.
2010-09-17 14:37:51 -07:00
Ben Pfaff
a2a9d2d9df ovs-vsctl: Fix parsing of short SSL options.
The short versions of the SSL options (e.g. -p, -c, -C) did not work,
because they were not in the string passed to getopt_long().  This commit
fixes the problem and should avoid its recurrence with any other short
options that we add in the future.
2010-08-19 09:42:13 -07:00
Justin Pettit
31681a5d62 vswitchd: Move fail-mode config to Bridge table
Configuration of the fail-mode was an attribute of the Controller table.
However, it makes more sense as an attribute of the Bridge table, since
the behavior defines what a bridge should do if it can't connect to
*any* controller.  This commit makes the move.
2010-07-30 21:26:54 -07:00
Justin Pettit
1a048029a0 vswitchd: Remove default controller config from Open_vSwitch table
An OpenFlow controller is normally associated with a bridge.  It was
possible to define a default controller in the Open_vSwitch table that
would be used if one was not associated with a bridge.  This was seldom
used and mostly just caused confusion.  This commit removes that
support, so an OpenFlow controller must always be associated with a
bridge.
2010-07-30 21:26:54 -07:00
Ben Pfaff
480ce8abca vlog: Make the vlog module catalog program-specific.
Until now, the collection of vlog modules supported by a given OVS program
was not specific to that program.  That means that, for example, even
though ovs-dpctl does not have anything to do with jsonrpc, it still has
a vlog module for it.  This is confusing, at best.

This commit fixes the problem on some systems, in particular on ones that
use GCC and the GNU linker.  It uses the feature of the GNU linker
described in its manual as:

    If an orphaned section's name is representable as a C identifier then
    the linker will automatically see PROVIDE two symbols: __start_SECNAME
    and __end_SECNAME, where SECNAME is the name of the section.  These
    indicate the start address and end address of the orphaned section
    respectively.

Systems that don't support these features retain the earlier behavior.

This commit also fixes the annoyance that modifying lib/vlog-modules.def
causes all sources files that #include "vlog.h" to recompile.
2010-07-21 15:47:09 -07:00
Ben Pfaff
5136ce492c vlog: Introduce VLOG_DEFINE_THIS_MODULE for declaring vlog module in use.
Adding a macro to define the vlog module in use adds a level of
indirection, which makes it easier to change how the vlog module must be
defined.  A followup commit needs to do that, so getting these widespread
changes out of the way first should make that commit easier to review.
2010-07-21 15:47:09 -07:00
Ben Pfaff
9200fb9ef9 vlog: Remove explicit calls to vlog_init().
This is no longer necessary.
2010-07-21 15:47:09 -07:00
Ben Pfaff
ff8bb7e76b timeval: Make time_init() static and remove calls to it.
Since the timeval module now initializes itself on-demand, there is no
longer any need to initialize it explicitly, or to provide an interface to
do so.
2010-07-21 15:47:09 -07:00
Jesse Gross
af9af3e21d ovs-vsctl: Fix unitialized variables.
The compiler pointed out two variables that it thought were used
without being initialized.  The first was just a spurious warning
but the second could result in an unitialized pointer being freed.
This fixes both of those issues.
2010-07-16 10:32:13 -07:00
Ben Pfaff
e111e681e3 ovs-vsctl: Do not allow record names to be abbreviated.
It's pretty risky to allow record names to be abbreviated.  If eth1 through
eth20 all exist, and then someone deletes eth1, then until now an ovs-vsctl
command that mentioned eth1 would actually use eth10.  This is too much of
a caveat to let loose on unsuspecting scripts, so this commit removes that
functionality.
2010-07-16 09:32:11 -07:00
Ben Pfaff
4f1361e857 ovs-vsctl: Make --help capitalization and spelling more consistent.
Reported-by: Reid Price <reid@nicira.com>
Bug #3175.
2010-07-14 17:07:28 -07:00
Ben Pfaff
8c3c2f3000 ovsdb-idl: Transition to better interfaces for reading table columns.
The existing ovsdb_idl_txn_read() was somewhat difficult and expensive to
use, because it always made a copy of the data in the column.  This was
necessary at the time it was introduced, because there was no way for it
to return a "default" value for columns that had not yet been populated
without allocating data and hence requiring the caller to free it.

Now that ovsdb_datum_default() exists, this is no longer required.  This
commit introduces a pair of new functions, ovsdb_idl_read() and
ovsdb_idl_get(), that return a pointer to existing data and do not do any
copying.  It also transitions all of ovsdb_idl_txn_read()'s callers to
the new interfaces.
2010-07-12 10:13:53 -07:00
Ben Pfaff
7db03f7c0e ovs-vsctl: Add "wait-until" command.
The "wait-until" command causes ovs-vsctl to wait until a specified
condition becomes true.

Requested-by: Sajjad Lateef <slateef@nicira.com>
2010-06-29 09:54:10 -07:00
Ben Pfaff
53de028597 ovs-vsctl: Make partial matches on record names optional.
The wait-until command to be added to ovs-vsctl in an upcoming commit
doesn't really want to wait for partial matches: if I'm waiting for br1
to be created I really don't want to be fooled by br10.  So this commit
adds infrastructure to avoid such partial matches.
2010-06-29 09:33:13 -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
87b23a01ed ovs-vsctl: Allow commands to tell ovs-vsctl to try again later.
The "wait-until" command to be introduced in an upcoming commit needs to
be able to tell the ovs-vsctl main loop to try again later, since the
condition that it is looking for has not yet been satisfied.  This commit
adds the infrastructure for this.  (It's being broken out into a separate
commit because it modifies scattered code in ovs-vsctl.c and thus might
be easier to review this way.)
2010-06-29 09:33:13 -07:00
Ben Pfaff
f40a9b61e2 ovs-vsctl: Make "ovs-vsctl get <table> <record> _uuid" work.
Requested-by: Sean Brady <sbrady@gtfservices.com>
2010-06-24 17:12:57 -07:00
Ben Pfaff
4ea21243f5 ovsdb-idl: Simplify usage of ovsdb_idl_run().
It makes client code simpler if ovsdb_idl_run() simply lets the caller
know whether anything changed.
2010-06-23 12:43:02 -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