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

19894 Commits

Author SHA1 Message Date
Ben Pfaff
774b7defc4 xenserver: Remove vswitch dbcache file during RPM uninstall.
It's good to clean up.

CC: Keith Amidon <keith@nicira.com>
CC: Henrik Amren <henrik@nicira.com>
2009-09-16 16:03:55 -07:00
Ben Pfaff
7778bd15da secchan: Better tolerate failing controller admission control in fail-open.
When the switch is configured to connect to a controller that accepts
connections, waits a few seconds, and then disconnects without setting up
flows, currently this causes "fail-open" to flush the flow table and
stop setting up new flows during the connection duration.  This is OK if
it happens once, but it can easily happen every 8 seconds with typical
backoff settings, and that isn't so great.

This commit changes fail-open to only flush the flow table once the switch
appears to have been admitted by the controller, which prevents these
frequent network interruptions.

Thanks to Jesse Gross for especially valuable feedback.

QA notes: Behavior in fail-open and especially behavior with a controller
that rejects the switch after it connects needs to be re-tested.  The
ovs-controller --mute switch added by this commit is one simple way to
create such a controller.

CC: Peter Balland <peter@nicira.com>

Bug #1695.  Bug #2055.
2009-09-16 15:12:27 -07:00
Ben Pfaff
372179d4f4 Factor out code for composing OFPT_PACKET_IN messages.
Currently only ofproto.c ever composes OFPT_PACKET_IN messages, but some
upcoming code wants to do the same thing, so factor this out into a new
function to avoid code duplication.
2009-09-16 15:12:27 -07:00
Ben Pfaff
b9e8b45a39 Factor out code for composing benign packets.
The bonding code in vswitch sends out gratuitous learning packets that
are supposed to teach switches but not cause anything else to happen on
the network.  Some upcoming code wants to synthesize packets with similar
properties, so factor this code into a new function so that it can be
used in both places.
2009-09-16 15:12:27 -07:00
Ben Pfaff
72aa493e2f ovs-pki: Extend validity of generated CA certificates from 3 to 6 years.
Dan requested this change to make it less likely that a user encounter a
CA certificate expiring.

For the "citrix" branch instead of "master" in case a customer upgrades
(without generating new CA certificates) away from the beta.

CC: Dan Wendlandt <dan@nicira.com>
2009-09-16 14:09:29 -07:00
Jesse Gross
edaa959f6b netdev-linux: Set missing cache validity bit.
Whether a port is internal is cached to avoid requerying the kernel
every time stats are requested.  However, the cache vality bit was
never being set so the cache wasn't used.  This corrects that
oversight.

Thanks to Ben Pfaff for noticing.
2009-09-16 11:03:42 -07:00
Ian Campbell
3f2c96d605 create/remove /var/lock/subsys/vswitch on initscript start/stop
A lock file in /var/lock/subsys must be created with the same name as
the initscript in order for the stop action to be automatically called
on runlevel change. This is true at least on Red Hat derived systems
such as XenServer where /etc/rcS contains:
        # First, run the KILL scripts.
        for i in /etc/rc$runlevel.d/K* ; do
                check_runlevel "$i" || continue

                # Check if the subsystem is already up.
                subsys=${i#/etc/rc$runlevel.d/K??}
                [ -f /var/lock/subsys/$subsys -o -f /var/lock/subsys/$subsys.init ] \
                        || continue
                ...

(This could potentially expose bugs e.g. in the stop priority for the
script since I think it is likely that the stop action hasn't been
running to now. I haven't closely considered this case yet but vswitch
is currently scheduled at K91vswitch vs K90network which seems correct
at first glance)
2009-09-16 09:17:00 -07:00
Ben Pfaff
22d24ebf66 datapath: Fix mutual exclusion with bridge on Linux 2.6.27+.
Linux 2.6.27 introduces a new mechanism for sharing STP packets among
kernel modules, which means that the code in datapath.c to avoid loading
when the Linux bridging module is also loaded has false positives.  So
fall back on these newer kernels to a less reliable way of avoiding the
bridge module, but one that does not have false positives.

CC: Jean Tourrihles <jt@hpl.hp.com>
2009-09-15 15:51:01 -07:00
Ben Pfaff
f134604bdc xenserver: Fix detection of xs-network-uuids in interface-reconfigure.
Commit c798b21c6a "xenserver: Only consider the host we are running on in
interface-reconfigure" dropped the get_pifs_by_record function in favor
of get_pifs_by_device, but didn't adapt callers properly, so that the
XenServer network PIFs weren't properly found and thus the xs-network-uuids
keys weren't set correctly.

This fixes the caller.

Bug #2043.
2009-09-15 14:21:00 -07:00
Ian Campbell
9d6122026b ovs-vsctl: /var/run/ovs-vswitchd.*.ctl is a Unix domain socket
Currently ov-vsctl tries to treat /var/run/ovs-vswitchd.*.ctl as a
file/pipe when it is actually a Unix domain socket:

        # ovs-vsctl add-br TEST
        Traceback (most recent call last):
          File "/usr/bin/ovs-vsctl", line 498, in ?
            main()
          File "/usr/bin/ovs-vsctl", line 493, in main
            function(*args)
          File "/usr/bin/ovs-vsctl", line 345, in cmd_add_br
            cfg_save(cfg, VSWITCHD_CONF)
          File "/usr/bin/ovs-vsctl", line 142, in cfg_save
            cfg_reload()
          File "/usr/bin/ovs-vsctl", line 126, in cfg_reload
            f = open(target, "r+")
        IOError: [Errno 6] No such device or address: ' '
        # ls -l /var/run/ovs-vswitchd.4173.ctl
        srw------- 1 root root 0 Sep 14 12:25 /var/run/ovs-vswitchd.4173.ctl

From strace:
        open("/var/run/ovs-vswitchd.4173.ctl", O_RDWR|O_LARGEFILE) = -1 ENXIO (No such device or address)
2009-09-15 09:27:08 -07:00
Ben Pfaff
8e58fa9a79 ovs-vsctl: Add test suite, documentation for br-to-vlan, br-to-parent.
CC: Ian Campbell <Ian.Campbell@citrix.com>
2009-09-15 09:27:08 -07:00
Jesse Gross
fe6b0e03f6 netdev: Swap transmit and receive stats on internal ports.
Internal ports appear to have their transmit and receive stats swapped
because from the kernel's point of view these ports are acting like
the machine connected to the switch, not the switch itself.  This swaps
the stats for consistency with other ports.
2009-09-14 14:12:23 -07:00
Ben Pfaff
431d8ad2a0 secchan: Fix bad pointer dereference sending flow expirations. 2009-09-14 13:37:08 -07:00
Ben Pfaff
cb5087cadd datapath: Fix WARN_ON sending GSO packets to userspace in Linux 2.6.22+.
Until now, when dp_output_control() queued a GSO packet to userspace, it
would first compute the checksum for the whole GSO packet, then break the
packet into segments.  However this had two drawbacks:

    1. The checksum had to be recomputed for each segment, wasting time.
    2. Linux 2.6.22 and later would emit a warning in skb_gso_segment()
       because the checksum was precomputed.

This commit changes dp_output_control() to instead break the packet into
segments, then compute the checksum across each of the segments
individually.  This fixes both drawbacks.

This commit has seen light testing on Xen's 2.6.27.  It has been build
tested on a few different kernel versions.
2009-09-14 12:20:00 -07:00
Ben Pfaff
0d3b8a34d6 datapath: Fix comments. 2009-09-14 12:20:00 -07:00
Ian Campbell
2e44e26d10 ovs-vsctl: additional commands for querying VLAN fake bridges.
Our test automation needs to be able to validate that a VLAN bridge and
for this I needed two new operations in ovs-vsctl:
      * The ability to query the VLAN tag for a bridge.
      * The ability to query the 'parent' of a bridge. The parent is the
        non-VLAN/untagged bridge with the same physical devices and
        could be a bond.

So given xenbr0 (containing eth0) + xapi2 (VLAN 42 on eth0) and xapi1
(containing bond0 == eth2+eth3) + xapi3 (VLAN 23 on the bonded
interface):

[root@warlock ~]# ovs-vsctl br-to-vlan xapi2
42
[root@warlock ~]# ovs-vsctl br-to-vlan xapi3
23
[root@warlock ~]# ovs-vsctl br-to-parent xapi2
xenbr0
[root@warlock ~]# ovs-vsctl br-to-parent xapi3
xapi1
2009-09-14 11:27:42 -07:00
Ben Pfaff
3b135da329 New utility ovs-vsctl. 2009-09-14 10:05:13 -07:00
Justin Pettit
2e8873af89 vswitch: Correctly identify slave status in /proc compatibility layer
In the /proc compatibility layer, the bond member was reported as up
immediately after link recovery, regardless of the updelay.  I believe
the compatibility code was correct if the check had been done with carrier,
but since 'iface->enabled' already does that calculation, we can use it
directly.

Additinally, when a bond slave was enabled or disabled, the bond
compatibility code was not being told to update its state.  This commit
makes that call.

NIC-39
2009-09-14 09:42:21 -07:00
Ben Pfaff
30a2c8b162 Raise MAC learning table capacity from 1,024 to 2,048 entries per bridge.
Given a possible 1,024 ports on a bridge the previous limit of 2,048
entries seems low.

If we want to increase this further we should introduce dynamic allocation
of table entries to avoid wasting memory in the common case.

CC: Keith Amidon <keith@nicira.com>
2009-09-14 09:26:37 -07:00
Ben Pfaff
5eab9abcd3 datapath: Raise maximum ports per datapath from 256 to 1024.
This makes the datapath port limit the same as the Linux bridge module
port limit.

CC: Keith Amidon <keith@nicira.com>
2009-09-14 09:26:37 -07:00
Justin Pettit
43a0e3476d xenserver: Have xen-bugtool collect OVS logs
The original xen-bugtool did not collect any OVS logs.  Now that more
logging is moving from /var/log/messages to ovs-vswitchd's and
ovs-brcompatd's private log files, we should include them in the
information collected for bug reports.
2009-09-12 16:40:03 -07:00
Justin Pettit
39fb08818b Merge commit 'origin/citrix'
Conflicts:
	vswitchd/ovs-vswitchd.8.in
	vswitchd/ovs-vswitchd.conf.5.in
	xenserver/etc_init.d_vswitch
2009-09-12 00:49:30 -07:00
Justin Pettit
7646deb6ec Merge commit 'origin/ctrix' into k 2009-09-11 18:40:38 -07:00
Justin Pettit
e3951e76bc xenserver: Have ovs-brcompatd's log file rotated
Suggested by Ian Campbell.
2009-09-11 18:09:19 -07:00
Jean Tourrihles
dc6fe1d7ee vconn: Fix byte-swapping of message type when validating OpenFlow actions.
It seems really strange that this one slipped through.  Perhaps this
means that we have never tested with any action other than OFPAT_OUTPUT
(which has value 0 and thus is not affected by byte-swapping).
2009-09-11 15:19:15 -07:00
Ben Pfaff
6867bc3633 xenserver: Install kernel modules in proper system locations.
This gets rid of the last files in /root/vswitch.  With this change, the
Open vSwitch RPMs should now comply with FHS (http://www.pathname.com/fhs/).
2009-09-11 15:13:57 -07:00
Ben Pfaff
eaa3c7e88b xenserver: Install into /usr instead of /root/vswitch.
/usr is the standard location for installation, so use that instead of our
nonstandard location under /root.

This migrates everything except the kernel modules to /usr.  The kernel
modules will be migrated in an upcoming commit.

One possibly surprising change is that the manpages listed in the %files
section of vswitch-xen.spec not only moved but added .gz extensions.  This
seems to be because RPM automatically compresses manpages, but only if they
are installed in a standard system location.
2009-09-11 15:13:08 -07:00
Ben Pfaff
ac9634f0af xenserver: Make RPM install work again.
The RPM install was generating a database cache in Python pickle format in
/etc/ovs-vswitchd.conf, but interface-reconfigure was looking for it in
XML format in /var/lib/openvswitch/dbcache.  This fixes the problem, by
adding an init-dbcache command to interface-reconfigure and then using that
at RPM install time.

This moves the database cache creation from %pre to %post.  This is
necessary so that interface-reconfigure is available from the install
script.
2009-09-11 14:41:39 -07:00
Ben Pfaff
0d46ae039b xenserver: Remove dead store from interface-reconfigure.
No point in looking up pifrec if we're not going to use it.
2009-09-11 14:06:14 -07:00
Ben Pfaff
fcf78c4ff9 xenserver: Remove unmaintained comments in interface-reconfigure.
I added these comments a long time ago and have not kept them up-to-date,
so it is probably better to delete them than to confuse people.
2009-09-11 14:06:14 -07:00
Ben Pfaff
fe8b662b2d xenserver: Fix syntax error in vswitch-xen.spec %pre fragment. 2009-09-11 13:18:14 -07:00
Justin Pettit
d4016a58d2 xenserver: Set default file log level and fix brcompatd file
Set the default log level for file logging to INFO for ovs-vswitchd and
ovs-brcompatd.  This is done so that coverage messages are kept in the
log file, since we no longer log them through syslog due its synchronous
writing on Xen hosts.  The issue is described in detail in commit 6bc995e.

Fix test for whether file logging should be enabled for ovs-brcompatd.

Reported by Ian Campbell.
2009-09-11 10:54:39 -07:00
Justin Pettit
6bc995e46d logging: Lower logging level for coverage messages due to slow poll loops
By default, many OVS processes keep track of their time through a poll
loop.  If it takes an unusually long time (measured as some distance
from the mean), the processes will log stats it has been keeping about
coverage.  It was doing this at level WARN.

On Xen systems, syslog messages written at level INFO and higher are
written to /var/log/messages synchronously.  This would mean that there
would be dire messages that it took a few dozen milliseconds to go
through the loop, meanwhile, it would take up to 6(!) seconds writing
those.  Meanwhile, the process would do no other processing, which could
be quite serious in the case of a process such as ovs-vswitchd.
This problem was somewhat masked because the time used by this logging
was not used in the calculations for determining how long it was taking
to get through the loop.

This commit lowers the default log level for those coverage messages to
INFO.  On Xen systems, it raises the default level at which messages are
written to syslog to WARN.

Diagnosed and fixed with the help of Ian Campbell.
2009-09-11 10:49:27 -07:00
Ben Pfaff
b16fdafe57 Document ovs-vswitchd's ovs-appctl commands and some ovs-vswitchd internals.
CC: Justin Pettit <jpettit@nicira.com>
2009-09-09 11:16:55 -07:00
Ben Pfaff
c2abdb7ec6 Increase the default priority of vswitchd and brcompatd
Our hope is that this will resolve many of the issues we have seen
where temporary delays in the forwarding of packets have caused issues
of various types.

This is a crossport from master of commit 44cb492 by Ian Campbell.
2009-09-09 10:52:26 -07:00
Ben Pfaff
8850d6d2d1 Revert "xenserver: Renice netback process to priority 0 by default."
This reverts commit 641a0a4ed0a79d53a52d4e78ce1d90140a768798.

This is a crossport from master of commit b2cdfea by Ian Campbell, with
the following commit message:

Do not renice the netback thread.

We should increase the vswitchd daemon's priority instead.
2009-09-09 10:50:32 -07:00
Ian Campbell
44cb492f46 Increase the default priority of vswitchd and brcompatd
Our hope is that this will resolve many of the issues we have seen
where temporary delays in the forwarding of packets have caused issues
of various types.
2009-09-09 10:45:51 -07:00
Ian Campbell
b2cdfeae16 Do not renice the netback thread.
We should increase the vswitchd daemon's priority instead.

Reverts 641a0a4ed
2009-09-09 10:45:48 -07:00
Ian Campbell
5de7052b9b Only write Network.PIF elements for this host to dbcache. 2009-09-09 10:41:45 -07:00
Ian Campbell
b88907e798 Add PIF.currently_attached to the list of fields used by interface-reconfigure 2009-09-09 10:41:41 -07:00
Ian Campbell
e44d184463 Move vswitch state files to /var/lib.
I believe this is the correct location for files of this type.
2009-09-09 10:41:38 -07:00
Ben Pfaff
1cee7f2815 xenserver: Don't (try to) remove log files on RPM uninstall.
The RPM spec file was trying to remove Open vSwitch log files as part of
the RPM uninstall process.  It wasn't succeeding, however, since the glob
pattern was wrong.

Instead of fixing the glob pattern, just stop trying to remove the log
files.  Log files are, after all, important for trying to debug problems,
and if we delete them at uninstall time then that makes life harder.
2009-09-08 13:34:12 -07:00
Ben Pfaff
df9fd4a52e xenserver: Improve readability of /etc/init.d scripts.
Less redundancy makes code easier to read.
2009-09-08 13:34:07 -07:00
Ben Pfaff
3cbe3ea5a7 xenserver: Don't install at same time as XS 5.5.900 "openvswitch" package.
XenServer 5.5.900 installs an "openvswitch" package that this package
conflicts with, so add a "Conflicts: openvswitch" to the RPM packaging.
2009-09-08 13:20:35 -07:00
Ben Pfaff
a320b3413d xenserver: Avoid "rpm -i" warnings on XenServer 5.5.900.
Open vSwitch installs successfully on XenServer 5.5.900 but it prints some
worrying messages during the process.  This commit fixes them.
2009-09-08 13:18:13 -07:00
Ben Pfaff
7983f00289 vswitch: Document that fail-open is enabled by default.
The vswitchd.conf manpage said that fail-open is disabled by default.  This
is wrong: it is enabled by default.  This commit fixes the documentation.

CC: Sujatha Sumanth <ssumanth@nicira.com>
2009-09-08 13:13:35 -07:00
Ben Pfaff
b1040b1701 vswitchd: Fix typo in comment. 2009-09-08 12:54:24 -07:00
Justin Pettit
8398cf7efc Merge commit 'origin/citrix' 2009-09-04 22:23:29 -07:00
Justin Pettit
a393b897f2 datapath: Don't drop MTU-sized VLAN packets from userspace
Before transimitting a packet, the datapath checks that the packet
length is not greater than the MTU.  It determines the length based on
the 'protocol' field in the skb.  If 'protocol' is ETH_P_8021Q, it reduces
the packet length as stored in the 'len' field by four bytes, which
is the size of a VLAN tag header.  Unfortunately, packets that arrived
from userspace were not having the 'protocol' field set, which would
cause MTU-sized packets to be dropped.  This commit sets the 'protocol'
field appropriately.

Thanks to Ben Pfaff for the help diagnosing this issue.

NIC-17 and NIC-26
2009-09-04 22:19:15 -07:00
Ben Pfaff
692c92e092 xenserver: Install /etc/sysconfig/vswitch by default.
Until now, the vswitch RPM has installed /etc/sysconfig/vswitch.example
and made the system administrator copy it to /etc/sysconfig/vswitch if he
desires.  This is slightly inconvenient, since it is slightly easier for
the admin if he can just edit /etc/sysconfig/vswitch directly.  This commit
changes to the latter behavior.

Bug #1810.
2009-09-03 14:28:44 -07:00