2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-04 00:05:15 +00:00
Commit Graph

19894 Commits

Author SHA1 Message Date
Ben Pfaff
95440284bd daemon: Allow daemon child process to report success or failure to parent.
There are conflicting pressures in startup of a daemon process:

    * The parent process should exit with an error code if the daemon
      cannot start up successfully.

    * Some startup actions must be performed in the child process, not in
      the parent.  The most obvious of these are file locking, since
      child processes do not inherit locks, and anything that requires
      knowing the child process's PID (e.g. unixctl sockets).

Until now, this conflict has usually been handled by giving up part of the
first property, i.e. in some cases the parent process would exit
successfully and the child immediately afterward exit with a failure code.

This commit introduces a better approach, by allowing daemons to perform
startup work in the child and only then signal the parent that they have
successfully started.  If the child instead exits without signaling
success, the parent passes this exit code along to its own parent.

This commit also modifies the daemons that can usefully take advantage of
this new feature to do so.
2009-12-18 13:37:44 -08:00
Ben Pfaff
058fd2a274 ovs-brcompatd: Simplify logic and make more robust.
The ovs-brcompatd code was trying hard to make sure that an Open_vSwitch
record would exist in the database before it would look for one.  It is
easier to just check for a record and use it if it is there, and it is
also more robust against databases that have not been initialized.
2009-12-18 12:33:34 -08:00
Ben Pfaff
39b78711a0 ovs-brcompatd: Handle TXN_UNCHANGED status.
This status was introduced several commits ago but not added to the switch
statement here.

Also, change the "status" variable to type enum ovsdb_idl_txn_status so
that GCC will warn about future additions.
2009-12-18 10:21:48 -08:00
Ben Pfaff
3a2eca8dc0 debian: Distribute some files that were forgotten.
This is important for successfully building Debian packages from a tarball
made with "make dist".
2009-12-17 16:56:25 -08:00
Ben Pfaff
8943a2084e debian: Tolerate varying locations of vswitch-idl.ovsschema.
The Debian packaging as well as the testsuite was picky about where
the ovsschema file appeared.  This should fix the problem.
2009-12-17 16:42:03 -08:00
Ben Pfaff
175106cbf6 ovs-vsctl: Fix segfault with fake bridges.
A fake bridge has no br_cfg, so we can't dereference it.

There is a similar problem in cmd_set_controller() and
cmd_del_controller() but this commit does not fix it.
2009-12-17 15:53:43 -08:00
Ben Pfaff
8419883d69 testsuite: Look for .ovsschema files in source dir as well as build dir.
When a distribution is built with "make dist", the .ovsschema files are
included as part of it, so that the builder does not have to have Python
installed.  However in that case the distributed .ovsschema files are in
the source dir instead of the build dir.  The testsuite always expected
them in the latter directory.  This commit makes it look for them in both
places.
2009-12-17 15:50:01 -08:00
Ben Pfaff
5562d6f55e test-json: Avoid use of /dev/stdin to fix builds in limited chroots.
The chroots in which we often build Open vSwitch don't have /proc and
thus cannot support /dev/stdin, because on Linux that is a symlink to
/proc/self/fd/0.  So avoid using /dev/stdin in the testsuite.
2009-12-17 15:50:01 -08:00
Ben Pfaff
57972e2ed7 ovsdb-server: Remove write-only struct member. 2009-12-17 13:48:09 -08:00
Justin Pettit
5aa0063548 ovs-vsctl: Add commands for modifying controller settings
Adds the ability to configure the controller and fail-mode.
2009-12-17 13:28:26 -08:00
Ben Pfaff
e4bfff8f0d initscript: pass complete path to pidfile to status command
Older versions of RHEL/CentOS used pifof in preference to the pidfile
and hence we got away with passing just the basename instead of
including the full path. Using pidof first doesn't make much sense and
this was fixed in RHEL 5 update 4 (see https://bugzilla.redhat.com/show_bug.cgi?id=440658)

This means that on RHEL 5.4 "service vswitch status" always returned
"ovs-vswitchd is stopped" even if it was running. Fix this issue by
passing in the correct pidfile name.

Cross-port of Ian Campbell's commit d1c8c9e4 on xs5.7 branch.
2009-12-17 10:00:36 -08:00
Ben Pfaff
b54e22e91e Make ovs-vswitchd report when it is done configuring; make ovs-vsctl wait.
Until now the ovsdb-based vswitch has provided no way to know when it has
finished applying the configuration from the database.  This commit
introduces a way:

  * The client who wants to wait increments the "next_cfg" column of the
    Open_vSwitch record.

  * When ovs-vswitchd finishes reconfiguring, it sets the value of the
    "cur_cfg" column to that of the "next_cfg" column.

  * The client waits until the "cur_cfg" column is at least as great as
    the value it set into "next_cfg".

This allows us to drop the 5-second sleep in interface-reconfigure.
2009-12-16 16:26:17 -08:00
Ben Pfaff
722f63016f ovsdb-tool: Add "show-log" command for use in debugging. 2009-12-16 13:58:33 -08:00
Ben Pfaff
6c1b89ed0e debian: Don't unload kernel modules in init script on "stop" or "restart".
Unloading kernel modules will destroy all of the datapaths, which is a
drastic action.  So we are probably better off doing that only if the
user requests it explicitly.
2009-12-16 13:40:55 -08:00
Ben Pfaff
d171b5846f ovsdb: Add "comment" feature to transactions and make ovs-vsctl use them.
The idea here is that transaction comments get copied to the ovsdb-server's
transaction log, which can then make it clear later why a particular change
was made to the database, to ease debugging.
2009-12-16 13:30:53 -08:00
Ben Pfaff
5f98eed4eb dynamic-string: New function ds_cstr_ro(). 2009-12-16 11:28:13 -08:00
Ben Pfaff
ffed42ab73 Fix typos in ovsdb specification. 2009-12-16 11:27:58 -08:00
Ben Pfaff
e9f8f9367e ovsdb: Add new "mutation" operation to transactions. 2009-12-16 10:56:04 -08:00
Ben Pfaff
a105c27b4e json: Accurately parse very large real numbers.
The test for whether a real number was outside the valid range was
imprecise and failed at the edge of the real range.  This commit changes
the code to use the C library's strtod(), which presumably does better.
2009-12-16 10:56:04 -08:00
Ben Pfaff
b3a4316574 debian: Change openvswitch-switch deb to use ovsdb-server and ovs-vswitchd.
This appears to work in that it creates the database on installation,
starts and stops the programs and loads and unloads the kernel modules at
the right times, but it has not been tested beyond that.
2009-12-15 13:12:00 -08:00
Ben Pfaff
77ce847d0b debian: Move openvswitch-dbg to "debug" section.
Noticed by lintian.
2009-12-15 13:12:00 -08:00
Ben Pfaff
3254fef577 debian: Update changelog. 2009-12-15 13:11:59 -08:00
Ben Pfaff
0de90890ab debian: Make all binary packages depend on ${misc:Depends}.
According to lintian:

> The source package uses debhelper but it does not use ${misc:Depends} in
> the given binary package's debian/control entry. This is required so the
> dependencies are set correctly in case the result of a call to any of
> the dh_ commands cause the package to depend on another package.

Fixed by adding ${misc:Depends} as a dependency to all binary packages that
didn't already have it.
2009-12-15 13:11:59 -08:00
Ben Pfaff
3ece329482 debian: Make binary NMUs possible.
According to lintian:

> The package is not safely binNMUable because an arch:any package depends
> on another arch:any package with a (= ${source:Version}) relationship.
> Please use (= ${binary:Version}) instead.

Fixed according to lintian's advice (above).
2009-12-15 13:11:59 -08:00
Ben Pfaff
a84edf5408 debian: Break rules for datapath module out of debian/rules.
debian/rules included makefiles from /usr/share/modass/include.
Unfortunately these makefiles set some environment variables to values that
we do not want in the general Debian build, e.g. on this machine they set
CC to gcc-4.1.  It appears that it is generally good practice to break
out the kernel module rules from the general-purpose rules anyhow, so this
commit does so.
2009-12-15 13:11:59 -08:00
Ben Pfaff
cf3a5d915f ovsdb-server: Improve error message when database file argument is missing. 2009-12-15 13:11:57 -08:00
Justin Pettit
18b9283b98 Clean-up compiler warnings about ignoring return values
Some systems complain when certain functions' return values are not
checked.  This commit fixes those warnings.

Creating ignore() function suggested by Ben Pfaff.
2009-12-15 00:14:32 -08:00
Ben Pfaff
c100e025e2 netdev-linux: Fix aliasing error.
The latest version of GCC flags a common socket convention as breaking
strict-aliasing rules.  This commit removes the aliasing and gets rid of
the scary warning.
2009-12-14 22:59:55 -08:00
Justin Pettit
c39c2868e0 xenserver: Actually destroy VIFs by using ovs-vsctl
When VIFs were destroyed, they were not actually being deleted in the
config database.  This commit makes the appropriate ovs-vsctl commands
in the 'vif' script to accomplish that.
2009-12-14 17:44:17 -08:00
Justin Pettit
a39a859a30 ovs-vsctl: Set timeout to a default value of five seconds
In general, we don't want ovs-vsctl to wait forever to connect to the
database, as ovs-vsctl is used extensively in init scripts and the
system will not boot.  Use a default value of five seconds as a
stop-gap.  Eventually, we'll switch to a model of connection attempts,
since using time-based approach is kind of a hack.
2009-12-14 14:51:17 -08:00
Justin Pettit
310fae4bbe xenserver: Cleanup xs-network-uuids and xs-network-names usage
Switch xs-network-uuids delimiter to a semicolon to match the one used
by xs-network-uuids.  Also, fix pluralization of xs-network-uuids in
vswitch IDL description of the "Bridge" table.

Add description of xs-network-names to vswitch IDL description.
2009-12-14 13:43:25 -08:00
Justin Pettit
29003139ff Have git ignore "vswitch-idl.txt" 2009-12-14 13:42:06 -08:00
Ben Pfaff
141f49423d vswitchd: Do not choose generated MAC address for local port.
ovs-vswitchd needs to choose a sensible MAC address for the local port of
a bridge.  Until now, the algorithm has ignored certain interfaces, in
particular internal interfaces and those with the MAC addresses that
indicate that they are probably Xen VIFs.  The goal is to choose a physical
interface's MAC address because this is more stable and more likely to
be meaningful to the outside world.  Stability, in turn, is important
because the MAC address of the local port is used as the default datapath
ID for OpenFlow connections.

This existing algorithm was too specialized to work well with the new
kinds of ports that we have been introducing in OVS.  In particular,
GRE ports could be chosen as the MAC address.  This commit changes the
algorithm for choosing the local port MAC address.  Now it ignores any
interface that has the "local" bit set in its MAC address, which
catches GRE ports.  The new rule also catches the VIF and internal
port cases, so this commit also deletes those special cases.

This commit deleted the only user of eth_addr_is_vif(), so it deletes
that function also.

Jesse Gross suggested this revised heuristic.

CC: Jeremy Stribling <strib@nicira.com>
2009-12-14 13:09:47 -08:00
Ben Pfaff
342045e177 ovs-vsctl: Add -t or --timeout option to limit runtime. 2009-12-14 10:13:49 -08:00
Justin Pettit
9a77b2bce0 xenserver: Add xs-network-names to "external_ids" column in config db 2009-12-12 14:54:27 -08:00
Justin Pettit
2cb0c515ea xenserver: Cleanup vswitch-xapi-update init script
Remove unused variables and correct typo in usage string.
2009-12-11 17:09:09 -08:00
Justin Pettit
ef5e2fe54d xenserver: Suppress output when creating initial config DB 2009-12-11 17:09:08 -08:00
Ben Pfaff
093e47f487 vswitch: Set datapath_id and ofport in ovsdb.
Now ovs-vswitchd fills in the Interface ofport and Bridge datapath_id
fields when it reconfigures.

The existing Bridge datapath_id and hwaddr columns, which had surprising
meanings, have been banished to a new other_config column.
2009-12-11 17:03:35 -08:00
Ben Pfaff
e6e6bdad78 Remove redundant calls to set_nonblocking().
These set_nonblocking() calls are on a fd returned by make_unix_socket(),
which has already set the fd nonblocking.
2009-12-11 17:00:28 -08:00
Ben Pfaff
21a60ea97b socket-util: Clarify EAGAIN error code for make_unix_socket().
make_unix_socket() can return EAGAIN in rare circumstances, e.g. when the
server's socket listen queue is full.  A lot of OVS callers interpret
EAGAIN as a "try again" error code, but in this case it means that the
attempt to create the socket failed.  So munge EAGAIN into another error
code to prevent that misinterpretation.
2009-12-11 16:59:44 -08:00
Ben Pfaff
fbd8fd40a3 ovsdb-idl: Prevent segfault destroying an incomplete transaction. 2009-12-11 16:58:16 -08:00
Ben Pfaff
99b2042d3b ovsdb: Fix segfault when a column set contains an invalid column name. 2009-12-11 16:37:29 -08:00
Ben Pfaff
45a7de56bb vswitch: Generate text file documenting the vswitch schema.
Now you can read vswitchd/vswitch-idl.txt for some textual documentation
of the OVS schema.
2009-12-11 14:12:50 -08:00
Ben Pfaff
1ebeed630c ovsdb-idl: Fix deletion of modified row.
If the transaction modified a row and then deleted it, the IDL would
instead mistakenly leave the row entirely untouched.

This commit fixes this bug.  It needs a regression test, but this commit
does not add one.
2009-12-11 13:26:08 -08:00
Ben Pfaff
ee9e92d81a ovsdb: Cleanly abort delete operations. 2009-12-11 13:26:08 -08:00
Ben Pfaff
577aebdfec ovs-vsctl: Add --dry-run option. 2009-12-11 13:26:08 -08:00
Ben Pfaff
b87fde85d0 ovsdb-client: Add support for pretty-printing JSON in output. 2009-12-11 13:26:08 -08:00
Ben Pfaff
f0f54cb4dd ovsdb-idl: Fix row insertion and deletion behavior.
When the IDL was used to insert a row, but all of the new row's columns
were left at the default values, then the IDL would not insert the row at
all.

When the IDL was used to delete one or more rows, and the transaction did
not include any update or insertion operations, the transaction was dropped
entirely.

This commit fixes these two bugs.  It needs a regression test, but this
commit does not add one.
2009-12-11 13:26:08 -08:00
Ben Pfaff
524555d18b ovs-vsctl: Initialize the database automatically. 2009-12-11 13:26:05 -08:00
Justin Pettit
347401f756 vconn: Have check_action() perform all validation
The function check_action() returned before it could finish its
validation.  The only checks that were missed were length checks, which
were verified earlier.

Thanks to Jean Tourrilhes for pointing out the issue.
2009-12-10 21:15:16 -08:00