2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 05:47:55 +00:00

17132 Commits

Author SHA1 Message Date
Nitin Katiyar
5bf8428248 Adding support for PMD auto load balancing
Port rx queues that have not been statically assigned to PMDs are currently
assigned based on periodically sampled load measurements.
The assignment is performed at specific instances – port addition, port
deletion, upon reassignment request via CLI etc.

Due to change in traffic pattern over time it can cause uneven load among
the PMDs and thus resulting in lower overall throughout.

This patch enables the support of auto load balancing of PMDs based on
measured load of RX queues. Each PMD measures the processing load for each
of its associated queues every 10 seconds. If the aggregated PMD load reaches
95% for 6 consecutive intervals then PMD considers itself to be overloaded.

If any PMD is overloaded, a dry-run of the PMD assignment algorithm is
performed by OVS main thread. The dry-run does NOT change the existing
queue to PMD assignments.

If the resultant mapping of dry-run indicates an improved distribution
of the load then the actual reassignment will be performed.

The automatic rebalancing will be disabled by default and has to be
enabled via configuration option. The interval (in minutes) between
two consecutive rebalancing can also be configured via CLI, default
is 1 min.

Following example commands can be used to set the auto-lb params:
ovs-vsctl set open_vswitch . other_config:pmd-auto-lb="true"
ovs-vsctl set open_vswitch . other_config:pmd-auto-lb-rebalance-intvl="5"

Co-authored-by: Rohith Basavaraja <rohith.basavaraja@gmail.com>
Co-authored-by: Venkatesan Pradeep <venkatesan.pradeep@ericsson.com>
Signed-off-by: Rohith Basavaraja <rohith.basavaraja@gmail.com>
Signed-off-by: Venkatesan Pradeep <venkatesan.pradeep@ericsson.com>
Signed-off-by: Nitin Katiyar <nitin.katiyar@ericsson.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Tested-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
2019-01-16 10:53:17 +00:00
Ben Pfaff
af3c51aee4 ofproto: Handle flow monitor requests with multiple parts.
Acked-by: Justin Pettit <jpettit@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-15 16:59:37 -08:00
Ben Pfaff
4e413ac88d ovs-vswitchd: Implement OFPT_TABLE_FEATURES table modification request.
This allows a controller to change the name of OpenFlow flow tables in the
OVS software switch.

CC: Brad Cowie <brad@cowie.nz>
Acked-by: Justin Pettit <jpettit@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-15 16:59:37 -08:00
Ben Pfaff
d1a227ecef ofp-table: Fix interpretation of when table features include properties.
The fixed-size header can't really be considered properties but this
function did so anyway.

Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-15 16:59:37 -08:00
Terry Wilson
35551b56cb Correct documentation for getting DB's cid
Acked-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Terry Wilson <twilson@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-15 11:18:49 -08:00
Terry Wilson
75ff71168a Un-revert Work around Python/C JSON unicode differences
This fix was reverted because it depended on a small bit of code
in a patch that was reverted that changed some python/ovs testing
and build. The fix is still necessary.

The OVS C-based JSON parser operates on bytes, so the parser_feed
function returns the number of bytes that are processed. The pure
Python JSON parser currently operates on unicode, so it expects
that Parser.feed() returns a number of characters. This difference
leads to parsing errors when unicode characters are passed to the
C JSON parser from Python.

Acked-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
Signed-off-by: Terry Wilson <twilson@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-15 11:16:30 -08:00
Timothy Redaelli
96edaf5f58 rhel: Add ovs-actions manpage to rhel and Fedora spec files
Fixes: be51cd417343 ("ovs-actions: New document describing OVS actions in detail.")
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-15 09:52:36 -08:00
Timothy Redaelli
3aed830751 lib: Add ovs-actions.7 to .gitignore
Fixes: be51cd417343 ("ovs-actions: New document describing OVS actions in detail.")
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-15 09:52:33 -08:00
Ilya Maximets
862b9cce15 checkpatch: Check style of FOREACH loops.
Current checkpatch rules matches only OVS 'FOR_EACH' loops.
This change will apply same style checks for DPDK iterators
like 'RTE_ETH_FOREACH_MATCHING_DEV () {}'.

Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-15 09:18:06 -08:00
Ilya Maximets
a5b6b6f3a9 python: Escape backslashes while formatting logs.
Since python version 3.7 (and some 3.6+ versions) regexp engine
changed to treat the wrong escape sequences as errors. Previously,
if the replace string had something like '\u0000', '\u' was
qualified as a bad escape sequence and treated just as a sequence
of characters '\' and 'u'. But know this triggers an error:

  Traceback (most recent call last):
    File "/usr/lib/python3.7/sre_parse.py", line 1021, in parse_template
      this = chr(ESCAPES[this][1])
  KeyError: '\\u'

From the documentation [1]:

  Unknown escapes consisting of '\' and an ASCII letter in replacement
  templates for re.sub() were deprecated in Python 3.5, and will now
  cause an error.

[1] https://docs.python.org/3/whatsnew/3.7.html#api-and-feature-removals

We need to escape the backslash by another one to keep regexp engine
from errors. In case of '\\u000', '\\' is a valid escape sequence
and the 'u' is a simple character.

To be 100% safe we need to use 're.escape(replace)', but it escapes
too many characters making the logs hard to read.

This change fixes Python 3 tests on systems with python 3.7.
Should be backward compatible.

Reported-by: Ben Pfaff <blp@ovn.org>
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-15 09:09:53 -08:00
Ben Pfaff
adb3f0b027 python: Avoid flake8 warning for unused variables.
Acked-by: Numan Siddique <nusiddiq@redhat.com>
Tested-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-11 08:45:10 -08:00
Ben Pfaff
75640c7665 python: Disable flake8 warning W504 "line break after binary operator".
OVS Python uses this style all over and I don't see a reason to avoid it.

Acked-by: Numan Siddique <nusiddiq@redhat.com>
Tested-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-11 08:45:07 -08:00
Ben Pfaff
145a7e88bb python: Fix invalid escape sequences.
It appears that Python silently treats invalid escape sequences in
strings as literals, e.g. "\." is the same as "\\.".  Newer versions of
checkpatch complain, and it does seem reasonable to me to fix these.

Acked-by: Numan Siddique <nusiddiq@redhat.com>
Tested-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-11 08:45:04 -08:00
Ilya Maximets
70506167a5 ovs-actions: Remove unneeded unicode symbols.
Fixes manpage-check warnings on FreeBSD 11.2:

lib/ovs-actions.7:1389: warning: invalid input character code 128
lib/ovs-actions.7:1389: warning: invalid input character code 128
lib/ovs-actions.7:1389: warning: can't find character with input code 144

Fixes: be51cd417343 ("ovs-actions: New document describing OVS actions in detail.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-11 08:43:53 -08:00
Ilya Maximets
63e2930184 vconn: Fix using of uninitialized deadline.
Typo introduced while making minor refactoring before applying the
patch.

Fixes logic and the clang build:

  lib/vconn.c:707:47: error:
      variable 'deadline' is uninitialized when
      used within its own initialization [-Werror,-Wuninitialized]
                              ? time_msec() + deadline
                                              ^~~~~~~~

Acked-by: Kevin Traynor <ktraynor@redhat.com>
Fixes: 04895042e9f6 ("vconn: Allow timeout configuration for blocking connection.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-11 08:42:54 -08:00
Ben Pfaff
fd4b7a0ef1 ofproto: Handle multipart requests with multiple parts.
OpenFlow has a concept of multipart messages, that is, messages that can be
broken into multiple pieces that are sent separately.  Before OpenFlow 1.3,
only replies could actually have multiple pieces.  OpenFlow 1.3 introduced
the idea that requests could have multiple pieces.  This is only useful for
multipart requests that take an array as part of the request, which amounts
to only flow monitoring requests and table features requests.  So far, OVS
hasn't implemented the multipart versions of these (it just reports an
error).  This commit introduces the necessary infastructure to implement
them properly.

Acked-by: Justin Pettit <jpettit@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-10 16:03:03 -08:00
Ben Pfaff
be51cd4173 ovs-actions: New document describing OVS actions in detail.
Acked-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-10 15:52:05 -08:00
Ben Pfaff
a31c38ad0b nroff: Fix fonts for h2, h3, h4.
Without this change, the fonts are wrong if a title contains formatting
like <code> or <var>.

Acked-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-10 15:52:05 -08:00
Ben Pfaff
63187cff99 nroff: Increase width for .IP used for ordered lists.
The ordered lists that a .25in width produced looked OK in PostScript
or PDF output, but in text output every list item spanned two lines,
like this:

   1.
     First list item.
   2.
     Second list item.

With this change, they appear normally:

   1. First list item.
   2. Second list item.

Acked-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-10 15:52:05 -08:00
Ilya Maximets
04895042e9 vconn: Allow timeout configuration for blocking connection.
On some systems in case where remote is not responding, socket could
remain in SYN_SENT state for a really long time without errors waiting
for connection. This leads to situations where vconn connection hangs
for a few minutes waiting for connection to the DOWN remote.

For example, this situation emulated by "refuse-connection" vconn
testcase. This leads to test failures because Alarm signal arrives much
faster than ETIMEDOUT from the socket:

  ./vconn.at:21: ovstest test-vconn refuse-connection tcp
  Alarm clock
  stderr:
  |socket_util|INFO|0:127.0.0.1: listening on port 63812
  |poll_loop|DBG|wakeup due to 0-ms timeout
  |poll_loop|DBG|wakeup due to 10155-ms timeout
  |fatal_signal|WARN|terminating with signal 14 (Alarm clock)
  ./vconn.at:21: exit code was 142, expected 0
  vconn.at:21: 535. tcp vconn - refuse connection (vconn.at:21): FAILED

This patch allowes to specify timeout value for vconn blocking
connections. If the connection takes more time, socket will be closed
with ETIMEDOUT error code. Negative value could be used to wait
infinitely.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-10 15:42:54 -08:00
Ilya Maximets
77f42ca535 stream: Allow timeout configuration for open_block.
On some systems in case where remote is not responding, socket could
remain in SYN_SENT state for a really long time without errors waiting
for connection. This leads to situations where open_blok() hangs for
a few minutes waiting for connection to the DOWN remote.

For example, our "multiple remotes" idl tests hangs waiting for
connection to the WRONG_PORT on FreeBSD in CirrusCI environment.
This leads to test failures because Alarm signal arrives much faster
than ETIMEDOUT from the socket.

This patch allowes to specify timeout value for 'open_block' function.
If the connection takes more time, socket will be closed with
ETIMEDOUT error code. Negative value or None in python could be
used to wait infinitely.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-10 15:39:48 -08:00
Ben Pfaff
747652d23e AUTHORS: Add new contributors. 2019-01-10 11:04:08 -08:00
Andreas Karis
ed47794ca3 utilities: gdb debug commands fix typos
Fix minor typos in ovs_gdb debug script.

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Andreas Karis <akaris@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-10 11:00:48 -08:00
Eelco Chaudron
e33b3fec1c utilities: Update gdb script so it works with all python versions
Newer versions of Python require a different iterator function. This
change will make the iterator classes work with all Python versions.

Adds a fix for python3 as it does not support the long() type.
The fix guaranties the script still works on Python 2.7.

The uKey walker is rather slow on python3, so added a spinner to
indicate we are still busy processing entries.

Fix functions using the iterkeys() function on dictionaries.

Tested-by: solomon <liwei.solomon@gmail.com>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-10 10:59:33 -08:00
solomon
0b4caa2eba ofp-group: support to insert bucket with weight value for select type
After creating a group with hash select type,then  we need to insert a new
bucket with weight, But,it fails. Commands are as following:

   # ovs-ofctl  -O OpenFlow15 add-group br0 "group_id=10, type=select, selection_method=hash,fields=tcp_src, bucket=bucket_id=10,weight:99,actions=output:1, bucket=bucket_id=20,weight:199,actions=output:1 "

   # ovs-ofctl -O OpenFlow15 insert-buckets br0 "group_id=10,type=select command_bucket_id=last,bucket=bucket_id=3,weight=100,actions=output:1"
   ovs-ofctl: type is not needed

   # ovs-ofctl -O OpenFlow15 insert-buckets br0 "group_id=10 command_bucket_id=last,bucket=bucket_id=3,weight=100,actions=output:1"
   ovs-ofctl: Only select groups can have bucket weights.

This patch can help us. However, for other types that are not select, the
check of the parameters is not strict, but it does not affect their
function, because other types do not use this weight parameter.

Signed-off-by: solomon <liwei.solomon@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-10 10:37:00 -08:00
Cian Ferriter
e49406dd0d docs: Fix table title for VM MQ config in dpdk howto.
Found this when searching "BIOS Settings" for use with DPDK.

CC: Stephen Finucane <stephen@that.guru>
Fixes: c50938a24031 ("doc: Convert INSTALL.DPDK-ADVANCED to rST")
Signed-off-by: Cian Ferriter <cian.ferriter@intel.com>
Acked-by: Stephen Finucane <stephen@that.guru>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
2019-01-10 08:11:16 +00:00
William Tu
886367d949 faq: unload kernel module when non-zero refcnt.
Describe the issue about reference count and how to
drop it and unload the kernel module.

Signed-off-by: William Tu <u9012063@gmail.com>
Cc: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-09 12:28:10 -08:00
Eli Britstein
46df7fac76 netdev-tc-offloads: Support IPv6 hlimit rewrite
Add support for IPv6 hlimit field.

Signed-off-by: Eli Britstein <elibr@mellanox.com>
Reviewed-by: Paul Blakey <paulb@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
2018-12-29 09:16:36 +09:00
Eli Britstein
e48f49e03e netdev-tc-offloads: Do not set 0 port attribute to TC tunnel
For non UDP tunnels as GRE there is no UDP port, i.e initialized to 0.

Do not set the port attribute in such case.

Signed-off-by: Eli Britstein <elibr@mellanox.com>
Reviewed-by: Paul Blakey <paulb@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
2018-12-29 09:14:50 +09:00
Lorenzo Bianconi
e46b70205e OVN: add static IP support to IPAM
Add the capability to IPAM/MACAM framework to specify a static ip address
and get the L2 one allocated dynamically using the following syntax:

$ovn-nbctl lsp-set-addresses <port> "dynamic <IP>"

The static ip address needs to belong to the subnet configured for the
logical switch

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-12-28 10:03:38 -08:00
Lorenzo Bianconi
10b9890f33 OVN: add mac address only support to IPAM/MACAM
Add the capability to assign just L2 address to IPAM/MACAM since
in the current implementation either subnet or ipv6_prefix are mandatory
to enable IPAM

Tested-by: Yossi Segev <ysegev@redhat.com>
Acked-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-12-28 10:03:36 -08:00
Stephen Finucane
80ed1b1b63 doc: Add missing ':doc:' role
This was rendering in italics instead of cross-referencing as intended.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-12-28 08:16:10 -08:00
Alin Gabriel Serdean
d4484c21fc datapath-windows: Fix race condition when deleting internal ports
We need to hold the port lock until all the operations with a port are
completed.

Found by inspection.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
Acked-by: Anand Kumar <kumaranand@vmware.com>
2018-12-28 16:43:48 +02:00
Ben Pfaff
4df926916c tests: Include actual Address Sanitizer output in testsuite log.
This will make it easier to get the Address Sanitizer output in cases
where we only have the testsuite.log, which happens with some autobuilders.

Acked-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-12-27 13:42:48 -08:00
Han Zhou
b6413ae472 ovn-sb.ovsschema: Avoid duplicated IPs in Encap table.
When adding a new chassis, if there is an old chassis with same IP
existed in Encap table, it is allowed to be added today. However,
allowing it to be added results in problems:

1. The new chassis cannot work because none of the other chassises
   are able to create tunnel to it, because of the IP confliction
   with already existed tunnel to the old chassis.

2. All the other chassises will continuously retry creating the tunnel
   and complaining about the error.

So, instead of hiding the problem, it is better to expose it while
trying to add the second chassis with duplicated IP. This patch
ensures it from the ovsdb schema.

Signed-off-by: Han Zhou <hzhou8@ebay.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-12-27 11:45:27 -08:00
Yifeng Sun
eca4cde025 nf_conntrack_proto: Fix HAVE_NET_NS_GET macro for nf_conntrack
In previous code, macro HAVE_NET_NS_SET is used in code but
never generated by config. This patch fixes it.

Fixes: 179fccce34db ("compat: Backport nf_ct_netns_{get, put}()")
Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-12-27 11:13:27 -08:00
Yifeng Sun
abaf6dcf68 odp-util: Fix fuzz runtime error of invalid dont_send value
Oss-fuzz complains that (struct user_action_cookie)->controller->dont_send
has invalid vlue, like below:
runtime error: load of value 26, which is not a valid value for type 'bool'

From this piece of code "cookie.controller.dont_send ? 1 : 0", it looks
like that we want to tolerate values than 0 and 1.

Thus, this patch changes the types of dont_send and continuation from bool
to uint8_t in order to make oss-fuzz happy.

Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11330
Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-12-27 11:11:23 -08:00
David Marchand
e883321791 system-traffic.at: avoid a race condition on monitor log
Rather than letting the test framework kill any remaining ofctl monitor,
ask and wait for it to gracefully exit before looking at the log file.
This solves random failures of tests 29, 30 and 50.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-12-27 10:03:14 -08:00
Ben Pfaff
7cdb7cabe2 AUTHORS: Update ZhiPeng Lu's email address. 2018-12-27 09:58:36 -08:00
luzhipeng-zte
8c93a1ad45 fix rpmbuild fails for rhel
This patch fixes the rpm build fail for rhel. The error is:
Checking for unpackaged file(s): /usr/lib/rpm/check-files /root/rpmbuild/BUILDROOT/openvswitch-2.10.0-1.x86_64
error: Installed (but unpackaged) file(s) found:
   /usr/share/openvswitch/scripts/ovs-monitor-ipsec

Signed-off-by: ZhiPeng LU <luzhipeng@uniudc.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-12-27 09:56:26 -08:00
Maks Naumov
2a104de013 ovn: Fix incorrect comparison of the NB and SB band action
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-12-27 09:54:24 -08:00
Ilya Maximets
2c1e8022d1 cirrus: Enable testing of Python3 and SSL.
This does not increase testing time significantly, but
increases the coverage.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-12-27 09:39:11 -08:00
Ilya Maximets
c64795a41d cirrus: Enable tests on FreeBSD.
Since all the tests fixed to work properly on FreeBSD we
could enable running of the testsuite.

+ minor refactoring of the yml file.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-12-27 09:39:11 -08:00
Ilya Maximets
05e5030d60 ovsdb-idl.at: Increase timeouts for tests with multiple remotes.
Tests with multiple remotes always involves connection attempts
to the wrong destinations. This includes few reconnection cycles
for 1 second each and also possible long timeouts for blocking
connections.

Let's increase the timeouts for these tests to allow them finish
successfully.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-12-27 09:39:11 -08:00
Ilya Maximets
cb334fff71 ofproto-macros.at: Ignore "Socket is not connected" log messages.
FreeBSD likely reports ENOTCONN instead of EPIPE/ECONNRESET in case
of sending to the disconnected socket.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-12-27 09:39:11 -08:00
Ilya Maximets
fe495d0c1d ovsdb-idl.at: Better choosing of wrong ports.
On some systems (ex. FreeBSD) kernel could allocate outcoming tcp ports
too close to the listening port of ovsdb-server. This could lead to having
outcoming tcp port of test-ovsdb application equal to one of the
WRONG_PORTs. In this case self-connection to the WRONG_PORT succeeds and
fails the tests:

  WRONG_PORT_1=51835
  WRONG_PORT_2=51836
  remotes="tcp:127.0.0.1:51835,tcp:127.0.0.1:51834,tcp:127.0.0.1:51836"
  # lsof -P -n -i @127.0.0.1
  COMMAND     PID TYPE  NODE NAME
  ovsdb-ser 82174 IPv4   TCP 127.0.0.1:51834 (LISTEN)
  python2.7 82179 IPv4   TCP 127.0.0.1:51835->127.0.0.1:51835 (ESTABLISHED)
  python2.7 82179 IPv4   TCP 127.0.0.1:51836->127.0.0.1:51836 (ESTABLISHED)

  ./ovsdb-idl.at:312: $PYTHON $srcdir/test-ovsdb.py  -t10 idl \
                                   $srcdir/idltest.ovsschema $remote
  Alarm clock
  ./ovsdb-idl.at:312: exit code was 1, expected 0

It's more likely to have outcoming port not equal to TCP_PORT + 101 or 102.
Let's use them instead.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-12-27 09:39:11 -08:00
Ilya Maximets
257edb1ae0 python: jsonrpc: Pick new remote on disconnect.
If attempt to open non-blocking connection results with EINPROGRESS,
further polling will trigger DISCONNECT action in case of failures.
While handling this action, jsonrpc python library closes the
connection but does not change the current remote. This leads to
subsequent connection to the same remote. And the story starts from
the beginning producing infinite attempts to connect to a single
remote regardless of existense of others. Like this:

 reconnect | DBG | tcp:127.0.0.1:45932: entering BACKOFF
 reconnect | INFO | tcp:127.0.0.1:45932: connecting...
 reconnect | DBG | tcp:127.0.0.1:45932: entering CONNECTING
 poller | DBG | 999-ms timeout
 reconnect | INFO | tcp:127.0.0.1:45932: connection attempt timed out
 reconnect | DBG | tcp:127.0.0.1:45932: entering BACKOFF
 poller | DBG | 0-ms timeout
 reconnect | INFO | tcp:127.0.0.1:45932: connecting...
 <...>
 reconnect | DBG | tcp:127.0.0.1:45932: entering CONNECTING
 poller | DBG | 1999-ms timeout
 reconnect | INFO | tcp:127.0.0.1:45932: connection attempt timed out
 reconnect | INFO | tcp:127.0.0.1:45932: waiting 4 seconds before reconnect
 reconnect | DBG | tcp:127.0.0.1:45932: entering BACKOFF
 <...>

Fix that by always picking the new remote on disconnect.
This mimics the behaviour of jsonrpc C library.

Fixes "multiple remotes" tests on FreeBSD.

CC: Numan Siddique <nusiddiq@redhat.com>
Fixes: 31e434fc985c ("python jsonrpc: Allow jsonrpc_session to have more than one remote.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-12-27 09:25:09 -08:00
Ilya Maximets
8e905f7616 ovn.at: Replace not portable '\+' in sed with '*'.
'*' has different semantics in common case, but it's not
important here.

This fixes test on FreBSD.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-12-25 11:34:39 -08:00
Ilya Maximets
244413eeda tests: Enable logging for ovsdb test.
It's useful to see the connection attempts and the transactions
in case of test failures.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-12-25 11:34:30 -08:00
Ilya Maximets
b481a4cc93 ovsdb-idl.at: Add IDL tests for C library with TCP connection.
Unlike Python IDL, C library tested only with unix sockets.
These tests enlarges the coverage.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-12-24 11:51:23 -08:00