diff mbox series

[ovs-dev] system-userspace-packet-type-aware.at: Wait for ip address updates.

Message ID 20200916180246.2972179-1-i.maximets@ovn.org
State Accepted
Commit 61069e7be6df5784089e8a4e65f85b55a6166bb8
Headers show
Series [ovs-dev] system-userspace-packet-type-aware.at: Wait for ip address updates. | expand

Commit Message

Ilya Maximets Sept. 16, 2020, 6:02 p.m. UTC
ovs-router module checks for the source ip address of the interface
while adding a new route.  netdev module doesn't request ip addresses
from the system every time, but instead it caches currently assigned
ip addresses and updates the cache on netlink notifications if needed.

So, there is a slight delay between setting ip address on interface
in a system and a moment OVS updates list of ip addresses of this
interface.  If route addition happens within this time frame, it
fails with the following error:

    # ovs-appctl ovs/route/add 10.0.0.0/24 br-p1
    Error while inserting route.
    ovs-appctl: ovs-vswitchd: server returned an error

This makes system tests to fail frequently.

Let's wait until local route successfully added.  This will mean
that OVS finished processing of a netlink event and will use up to
date list of ip addresses on desired interface.

Fixes: 526cf4e1d6a8 ("tests: Added unit tests in packet-type-aware.at")
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
---
 tests/system-userspace-packet-type-aware.at | 3 +++
 1 file changed, 3 insertions(+)

Comments

Aaron Conole Sept. 18, 2020, 1:29 p.m. UTC | #1
Ilya Maximets <i.maximets@ovn.org> writes:

> ovs-router module checks for the source ip address of the interface
> while adding a new route.  netdev module doesn't request ip addresses
> from the system every time, but instead it caches currently assigned
> ip addresses and updates the cache on netlink notifications if needed.
>
> So, there is a slight delay between setting ip address on interface
> in a system and a moment OVS updates list of ip addresses of this
> interface.  If route addition happens within this time frame, it
> fails with the following error:
>
>     # ovs-appctl ovs/route/add 10.0.0.0/24 br-p1
>     Error while inserting route.
>     ovs-appctl: ovs-vswitchd: server returned an error
>
> This makes system tests to fail frequently.
>
> Let's wait until local route successfully added.  This will mean
> that OVS finished processing of a netlink event and will use up to
> date list of ip addresses on desired interface.
>
> Fixes: 526cf4e1d6a8 ("tests: Added unit tests in packet-type-aware.at")
> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
> ---

Acked-by: Aaron Conole <aconole@redhat.com>
Flavio Leitner Sept. 19, 2020, 2:44 p.m. UTC | #2
On Wed, Sep 16, 2020 at 08:02:46PM +0200, Ilya Maximets wrote:
> ovs-router module checks for the source ip address of the interface
> while adding a new route.  netdev module doesn't request ip addresses
> from the system every time, but instead it caches currently assigned
> ip addresses and updates the cache on netlink notifications if needed.
> 
> So, there is a slight delay between setting ip address on interface
> in a system and a moment OVS updates list of ip addresses of this
> interface.  If route addition happens within this time frame, it
> fails with the following error:
> 
>     # ovs-appctl ovs/route/add 10.0.0.0/24 br-p1
>     Error while inserting route.
>     ovs-appctl: ovs-vswitchd: server returned an error
> 
> This makes system tests to fail frequently.
> 
> Let's wait until local route successfully added.  This will mean
> that OVS finished processing of a netlink event and will use up to
> date list of ip addresses on desired interface.
> 
> Fixes: 526cf4e1d6a8 ("tests: Added unit tests in packet-type-aware.at")
> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
> ---

Acked-by: Flavio Leitner <fbl@sysclose.org>
Ilya Maximets Oct. 9, 2020, 3:07 p.m. UTC | #3
On 9/16/20 8:02 PM, Ilya Maximets wrote:
> ovs-router module checks for the source ip address of the interface
> while adding a new route.  netdev module doesn't request ip addresses
> from the system every time, but instead it caches currently assigned
> ip addresses and updates the cache on netlink notifications if needed.
> 
> So, there is a slight delay between setting ip address on interface
> in a system and a moment OVS updates list of ip addresses of this
> interface.  If route addition happens within this time frame, it
> fails with the following error:
> 
>     # ovs-appctl ovs/route/add 10.0.0.0/24 br-p1
>     Error while inserting route.
>     ovs-appctl: ovs-vswitchd: server returned an error
> 
> This makes system tests to fail frequently.
> 
> Let's wait until local route successfully added.  This will mean
> that OVS finished processing of a netlink event and will use up to
> date list of ip addresses on desired interface.
> 
> Fixes: 526cf4e1d6a8 ("tests: Added unit tests in packet-type-aware.at")
> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
> ---

Thanks, Flavio and Aaron!

Applied to master and backported down to 2.8.

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/tests/system-userspace-packet-type-aware.at b/tests/system-userspace-packet-type-aware.at
index c2246316d..974304758 100644
--- a/tests/system-userspace-packet-type-aware.at
+++ b/tests/system-userspace-packet-type-aware.at
@@ -129,6 +129,7 @@  AT_CHECK([
     ip addr add 10.0.0.1/24 dev br-p1
     ip link set br-p1 up
 ], [0], [stdout])
+OVS_WAIT_UNTIL([ovs-appctl ovs/route/show | grep -q br-p1])
 
 AT_CHECK([
     ovs-appctl ovs/route/add 10.0.0.0/24 br-p1
@@ -141,6 +142,7 @@  AT_CHECK([
     ip addr add 20.0.0.2/24 dev br-p2
     ip link set br-p2 up
 ], [0], [stdout])
+OVS_WAIT_UNTIL([ovs-appctl ovs/route/show | grep -q br-p2])
 
 AT_CHECK([
     ovs-appctl ovs/route/add 20.0.0.0/24 br-p2
@@ -153,6 +155,7 @@  AT_CHECK([
     ip addr add 30.0.0.3/24 dev br-p3
     ip link set br-p3 up
 ], [0], [stdout])
+OVS_WAIT_UNTIL([ovs-appctl ovs/route/show | grep -q br-p3])
 
 AT_CHECK([
     ovs-appctl ovs/route/add 30.0.0.0/24 br-p3