We now use a time source that provides nanosecond granularity.
However, our test uses gettimeofday() for comparision, which has
microsecond granularity. In some cases this can lead to different
values depending on the rounding. This allows us to be off by one
to prevent intermittent test failures.
In certain cases we require the ability to provide stats that are
added to the values collected by the kernel (currently only used
by bond fake devices). Internal devices previously implemented
this directly but now that their stats are now handled by the vport
layer the functionality has been moved there. This removes the
userspace code to set the stats and replaces it with a mechanism
to access the equivalent functionality in the vport layer.
The vport layer has the ability to track stats using 64-bit counters,
even if the kernel is only 32-bit. This first attempts to collect
stats from these counters if they are available and otherwise falls
back to the normal Linux interfaces.
Internal devices currently keep track of stats themselves. However,
we now have stats tracking in the vport layer, so convert to use
that instead to avoid code duplication and take advantage of
additional features such as 64-bit counters.
Linux devices store stats in counters the size of a machine word,
which are rapidly overflowed on a 32-bit machine. In this
situation we now use the vport stats layer, which always uses 64-
bit stats. On 64-bit machines we continue to use the normal
Linux stats to avoid the extra overhead of counting twice.
Adds a method to set a group of stats to be added to the values
gathered normally. This is needed for the fake bond device to
show the stats of its underlying slaves. Also enables devices
that use the generic stats layer to define a get_stats() function
to provide additional error counts.
Since vport implementations have no header files they needed to be
declared as extern before being used. They are currently declared
in vport.c but this isn't safe because the compiler will silently
accept it if the type is incorrect. This moves those declarations
into vport.h, which is included by all implementations and will
cause errors about conflicting types if there is a mismatch.
The vport library can be accessed from both userspace and the
kernel using different sets of functions. These functions were
named similarly, so add _user to the userspace variants to
distinguish them.
Automake respects conditionals around EXTRA_DIST assignments. That is, if
COND is not true, then the following will not distribute 'myfile':
if COND
EXTRA_DIST += myfile
endif
See http://article.gmane.org/gmane.comp.sysutils.automake.general/10891
for more information.
This behavior is surprising, at least to me. But we can work around it:
anything that can ever *potentially* be assigned to noinst_HEADERS is
always distributed. So this commit eliminates the problem by adding
$(EXTRA_DIST) to noinst_HEADERS.
Most of the timekeeping needs of OVS are simply to measure intervals,
which means that it is sensitive to changes in the clock. This commit
replaces the existing clocks with monotonic timers. An additional set
of wall clock timers are added and used in locations that need absolute
time.
Bug #1858
Just silently don't start OVS daemons if /etc/xensource/network.conf
contains a value of "bridge". This allows the init script to be called
regardless of whether OVS or bridge is configured.
The OVS processes would start as long as "/etc/xensource/network.conf"
didn't contain "bridge". The other OVS scripts, however, would complain
(and not run) if it wasn't "vswitch" or "openvswitch". This commit will
only start the OVS processes if a value of "vswitch" or "openvswitch" is
present, so some consistency is provided.
(If "/etc/xensource/network.conf" is not "bridge", "vswitch", or
"openvswitch", then XAPI will refuse to run anyway, so not much is going
to happen on the system.)
This commit adds the datapath name to discovery and DHCP-related messages,
so that it is obvious to the user where discovery is taking place.
Previously, messages looked like:
Jun 04 13:41:29|00010|dhcp_client|INFO|sending DHCPDISCOVER
With this commit, they look like this:
Jun 04 13:41:29|00010|dhcp_client|INFO|br0: sending DHCPDISCOVER
I may be the only person in the world who regularly uses controller
discovery.
Until now, log messages about OpenFlow connections have named the target
of the connection, e.g. "tcp:1.2.3.4:5555", but they have not named the
datapath. Most often, every datapath has the same target, so this can
make it difficult to tell which connection is going wrong. Usually, that
isn't important, because all connections with the same target will have the
same problems, but it's probably better to be more informative.
This commit changes the log messages to include the datapath name, so that
"tcp:1.2.3.4:5555" becomes, e.g., "xenbr0<->tcp:1.2.3.4:5555".
Requested-by: Keith Amidon <keith@nicira.com>
The 'name' argument to these functions is actively unhelpful, because none
of the callers provided a better name than the one provided by
vconn_get_name(). So drop it.
Examining the XAPI source code shows that at startup it invokes a script
named /opt/xensource/libexec/xapi-startup-script, if one exists. Testing
shows that this was also true in XenServer 5.5.0. No such script is
installed by default. Searching for "xapi-startup-script" on Google (with
the quotes) has only one hit, which is documentation on XAPI startup. So
it seems that we're pretty safe in taking advantage of this hook ourselves.
This commit changes the RPM scripts to install refresh-network-uuids as
the XAPI startup hook on XenServer 5.5.0.
CC: Rob Hoes <rob.hoes@citrix.com>
Commit 823c5699 "interface-reconfigure: callout to datapath backend class
method on rewrite" changed "interface-reconfigure write" to do what
refresh-network-uuids does. We can't entirely get rid of
refresh-network-uuids, so this commit rewrites it as a trivial wrapper
around interface-reconfigure.
Use this mechanism to allow the vswitch backend to update the vswitch
configuration's mapping from datapath to XenAPI datamodel Network
UUIDs. The vswitch needs a mechanism to update these when they change
(i.e. on pool join and eject).
Refactor the DatapathFactory method to return the class which the
caller can instantiate or not as the require.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
network_uuid_refresh_run() needs to update pool_conf_mtime as soon as it
notices a change. Otherwise it thinks that the mtime has changed every
time it is called and therefore never actually runs the refresh script.
Bug #2097.
XAPI calls the "update" method of the vswitch-cfg-update plugin whenever it
starts or restarts. Thus, this is a good place to trigger updating network
UUIDs. This commit implements that behavior. This should fix the problem
of network UUIDs not being updated on pool join, since XAPI restarts when
it joins a pool.
When XenServer 5.5 support is no longer interesting, we should integrate
the refresh-network-uuids script into the XAPI plugin.
Lightly tested, works for me on 5.6.810-31078p.
See-also: http://openvswitch.org/pipermail/dev_openvswitch.org/2010-June/002216.html
Suggested-by: Rob Hoes <rob.hoes@citrix.com>
Bug #2097.
Normally we filter out packets received on a bond if we have
learned the source MAC as belonging to another port to avoid packets
sent on one slave and reflected back on another. The exception to
this is gratuitous ARPs because they indicate that the host
has moved to another port. However, this can result in an additional
problem on the switch that the host moved to if the gratuitous ARP is
reflected back on a bond slave. In this case, we incorrectly relearn
the slave as the source of the MAC address. To solve this, we lock the
learning entry for 5 seconds after receiving a gratuitous ARP against
further updates caused by gratuitous ARPs on bond slaves.
Bug #2516
Reported-by: Ian Campbell <ian.campbell@citrix.com>
In my testing with XenServer 5.6.810 without ovs-xenserverd the
vswitch bridge external-id network-uuid field was always kept up to
date over both pool join and pool eject. I believe this is because
xapi is restarted on both pool join and pool eject and on restart all
PIFs are plugged again. This causes the vswitch field to be updated,
either via a call to interface reconfigure or via an explicit
ovs-vsctl call in the case of internal networks.
I think the only reason this daemon would still be required with
XenServer 5.5 is that the explicit call to ovs-vsctl for internl
networks is not present there.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
The most recent revision of the netdev library added may_create
and may_open flags to explicitly state the intent of the caller as
to whether the device should already be in use. This was simply
a sanity check for users of the netdev library and the configuration.
At this point the netdev library and its users are well behaved and
should no longer need to be checked. Additional checks have also
been added for incorrect configuration that mean the netdev library
is no longer the primary line of defense.
These flags themselves create problems because it is not always
easy for a library to know what the state of devices should be.
This is particularly a problem for ovs-openflowd, which expects
ports to be added by ovs-dpctl. Fixing this either requires that
the checks are so permissive to be useless or ugly hacks to get
around them. Since they are no longer needed, just remove the
checks.
This commit restores the previous behavior of ovs-openflowd to
not require that ports be specified on the command line or
cleaned up after use.
Bug #2652
CC: Natasha Gude <natasha@nicira.com>
CC: Jean Tourrilhes <jt@hpl.hp.com>
CC: 蒲彦 <yan.p.bjtu@gmail.com>
Tap devices can have two FDs that allow transmit and receive from
different perspectives. We previously would always share one of
the FDs among all openers. However, this is confusing to some
users (primarily the DHCP client) which expect tap devices to behave
like any other device. Now we give the tap FD to the first opener,
which knows that it has opened a tap device, and a normal system FD
to everyone else for consistency.
For tap and internal devices we swap the transmit and receive stats
to appear consistent with other devices. However, the check whether
to store the stats in a temporary location before the swap did not
include tap devices, which lead to the use of uninitialized memory
when the swap occured.
The test to see if the current version is present in the Debian
changelog wasn't properly quoted so we would add a new entry every
time configure was run.
The behavior of __vlan_put_tag() has changed over time:
- In 2.6.26 and earlier, it adjusted both MAC and network header
pointers. (The latter didn't make any sense.)
- In 2.6.27 and 2.6.28, it did not adjust any header pointers at all.
- In 2.6.29 and later, it adjusts the MAC header pointer only.
The behavior in 2.6.26 and earlier, and in 2.2.29 and later, works OK for
Open vSwitch. The 2.6.27 and 2.6.28 behavior *almost* works OK, with a few
subtle problems. If an action that sets a VLAN tag is followed by an
action that strips a VLAN tag, the "strip" action silently fails. This is
because vlan_pull_tag() in datapath/actions.c sees the encapsulated
protocol, not the 802.1Q protocol, because the MAC header was not adjusted
and does not point to the 802.1Q header. If multiple set-VLAN actions
occur in a single flow, the second and later actions will fail for the same
reason.
This commit fixes the problem by ensuring that __vlan_put_tag() always
behaves as in 2.6.29 and later.
Reported-by: Reid Price <reid@nicira.com>
Bug #2867.
It's easy to add a file to the repository and forget to make sure that it
is distributed. This commit adds a hook target to the main Makefile that
causes "make dist" to fail if the tree is being built from a Git repository
and some files are not distributed.
In general, every file in the Git repository should be distributed, except
for files that are specific to Git, such as the .gitignore files. But we
had overlooked several of them. This commit makes sure that they get
distributed.
config-linux-2.6.23-rc9-kvm is an antique that I doubt anyone cares about.
I'd forgotten it was there.
ovsdbmonitor.py.in is an oversight. It isn't used. The file that is used,
which is also in the source tree, is ovsdbmonitor.in.
vswitchd has long used a gratuitous ARP reply as an indication that a VM
has migrated, because traditional xen.org Linux DomUs send such packets out
when they complete migration. Relatively recently, however, we realized
that upstream Linux does not do this. Ian Campbell tracked this down to
two separate issues:
1. A bug prevented gratuitous ARPs from being sent.
2. When this was fixed, the gratuitous ARPs that were sent were
requests, not replies, although kernel documentation sent that
replies were to be sent.
Ian submitted patches to fix both bugs. #1 is in process of revision for
acceptance. #2 was rejected: according to Dave Miller, the documentation
is wrong, not the implementation, because ARP replies would unnecessarily
fill up the ARP tables of devices on the network.
OVS has not until now treated gratuitous ARP requests specially, only
replies. Now that Linux will be using ARP requests to indicate migration,
OVS should also treat them as such.! This commit does so.
See http://marc.info/?l=linux-netdev&m=127367215620212&w=2 for Ian's
original patch and http://marc.info/?l=linux-netdev&m=127468303701361&w=2
for Dave Miller's response.
CC: Ian Campbell <Ian.Campbell@citrix.com>
NIC-74.
Invariably we forget to update the version number in debian/changelog as
we change OVS's own version number. This is embarrassing.
This commit introduces two different times to automatically update the
debian/changelog version number: whenever boot.sh runs and whenever
"make dist" runs. In the latter case, only the version number in the
distributed tarball is updated, but that seems OK.
Reported by Joan Cirer <joan@ev0.net> most recently, and by others over
the last year or so too.
in_band_create() can fail if something goes wrong with the network device
that represents the local port. In that case update_in_band_remotes()
should not call in_band_set_remotes(), but it did anyway. This commit fixes
it.
Reported-by: Tom Everman <teverman@google.com>