From patchwork Thu Feb 2 07:52:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gurucharan Shetty X-Patchwork-Id: 723235 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vDnws5dnNz9s74 for ; Fri, 3 Feb 2017 05:05:49 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 4CBD9C3B; Thu, 2 Feb 2017 18:05:46 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 9DDC7C38 for ; Thu, 2 Feb 2017 18:05:45 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg0-f67.google.com (mail-pg0-f67.google.com [74.125.83.67]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 003761DE for ; Thu, 2 Feb 2017 18:05:44 +0000 (UTC) Received: by mail-pg0-f67.google.com with SMTP id 3so2426558pgj.1 for ; Thu, 02 Feb 2017 10:05:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=gOqaIkyFcU+YMC6woovvJVFZUcV/QIX1J7tw0ordu6g=; b=pRGyYdPWRG7TLDgyvVf99REIeFfy9Dj12kydLsHVc+IPWR0rc1SvTIse4K482E081y cQRLf7fY4/mStS4Rixy6LJOnIq+s7BrkCCpjuy9O750QtzMpTkPhU1w0+pLC1vgoJs/J Ef90F+EnJREzLT2CGwawTiFrVCT8jcdTjUWIoeCYjtXD5n7FcWUTMlDEsw+4l7qbh9Jq o0gNMs2NSAA8ZFPN1Iv0gt9pqnbXuMEMvai2fSFSxQZM74JB2C5KsZ/SIFVbPbdsBHv6 +Zfhc+tgqqh8aDlKZ721OJdaf3S/QRR9exbJrUvD7FgUJgmzjMXI8DYSFZus+t3R7Yn0 y10A== X-Gm-Message-State: AIkVDXIUqXFA+ZVVhGiWTZIR+rX4XnQNca4LnEZDCVmNKWy9igiIHnVAhDAjSA/VjBE1Gw== X-Received: by 10.98.111.194 with SMTP id k185mr12267942pfc.83.1486058744073; Thu, 02 Feb 2017 10:05:44 -0800 (PST) Received: from ubuntu.eng.vmware.com ([208.91.1.34]) by smtp.gmail.com with ESMTPSA id z77sm60279268pfk.47.2017.02.02.10.05.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 Feb 2017 10:05:43 -0800 (PST) From: Gurucharan Shetty To: dev@openvswitch.org Date: Wed, 1 Feb 2017 23:52:14 -0800 Message-Id: <1486021934-30576-1-git-send-email-guru@ovn.org> X-Mailer: git-send-email 1.9.1 X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_00, DATE_IN_PAST_06_12, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH] system-ovn.at: Fix race conditions. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org The code to wait for a particular type of flow in ovs-vswitchd was not specific enough. This commit changes that and to be doubly sure, also uses the sync command. Reported-by: Andy Zhou Reported-by: Joe Stringer Signed-off-by: Gurucharan Shetty Acked-by: Ben Pfaff --- tests/system-ovn.at | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/tests/system-ovn.at b/tests/system-ovn.at index 638ac56..7296550 100644 --- a/tests/system-ovn.at +++ b/tests/system-ovn.at @@ -97,7 +97,8 @@ ovn-nbctl -- --id=@nat create nat type="snat" logical_ip=192.168.2.2 \ external_ip=30.0.0.1 -- add logical_router R2 nat @nat # wait for ovn-controller to catch up. -OVS_WAIT_UNTIL([ovs-ofctl dump-flows br-int | grep ct\( | grep nat]) +ovn-nbctl --wait=hv sync +OVS_WAIT_UNTIL([ovs-ofctl dump-flows br-int | grep 'nat(src=30.0.0.1)']) # 'alice1' should be able to ping 'foo1' directly. NS_CHECK_EXEC([alice1], [ping -q -c 3 -i 0.3 -w 2 192.168.1.2 | FORMAT_PING], \ @@ -250,7 +251,8 @@ ovn-nbctl lsp-add alice alice1 \ ovn-nbctl -- --id=@nat create nat type="snat" logical_ip=192.168.1.2 \ external_ip=172.16.1.1 -- add logical_router R2 nat @nat -OVS_WAIT_UNTIL([ovs-ofctl dump-flows br-int | grep ct\( | grep nat]) +ovn-nbctl --wait=hv sync +OVS_WAIT_UNTIL([ovs-ofctl dump-flows br-int | grep 'nat(src=172.16.1.1)']) # South-North SNAT: 'foo1' pings 'alice1'. But 'alice1' receives traffic # from 172.16.1.1 @@ -420,7 +422,8 @@ ovn-nbctl -- --id=@nat create nat type="snat" logical_ip=192.168.2.2 \ external_ip=30.0.0.4 -- add logical_router R3 nat @nat # wait for ovn-controller to catch up. -OVS_WAIT_UNTIL([ovs-ofctl dump-flows br-int | grep ct\( | grep nat]) +ovn-nbctl --wait=hv sync +OVS_WAIT_UNTIL([ovs-ofctl dump-flows br-int | grep 'nat(src=30.0.0.4)']) # North-South DNAT: 'alice1' should be able to ping 'foo1' via 30.0.0.2 NS_CHECK_EXEC([alice1], [ping -q -c 3 -i 0.3 -w 2 30.0.0.2 | FORMAT_PING], \ @@ -580,7 +583,9 @@ ovn-nbctl add logical_switch foo load_balancer $uuid ovn-nbctl set load_balancer $uuid vips:'"30.0.0.2:8000"'='"172.16.1.2:80,172.16.1.3:80,172.16.1.4:80"' # Wait for ovn-controller to catch up. -OVS_WAIT_UNTIL([ovs-ofctl -O OpenFlow13 dump-groups br-int | grep ct\(]) +ovn-nbctl --wait=hv sync +OVS_WAIT_UNTIL([ovs-ofctl -O OpenFlow13 dump-groups br-int | \ +grep 'nat(dst=172.16.1.4:80)']) # Start webservers in 'bar1', 'bar2' and 'bar3'. OVS_START_L7([bar1], [http]) @@ -699,7 +704,9 @@ ovn-nbctl set logical_switch foo load_balancer=$uuid ovn-nbctl set load_balancer $uuid vips:'"30.0.0.2:8000"'='"192.168.1.3:80,192.168.1.4:80,192.168.1.5:80"' # Wait for ovn-controller to catch up. -OVS_WAIT_UNTIL([ovs-ofctl -O OpenFlow13 dump-groups br-int | grep ct\(]) +ovn-nbctl --wait=hv sync +OVS_WAIT_UNTIL([ovs-ofctl -O OpenFlow13 dump-groups br-int | \ +grep 'nat(dst=192.168.1.5:80)']) # Start webservers in 'foo2', 'foo3' and 'foo4'. OVS_START_L7([foo2], [http]) @@ -846,7 +853,9 @@ ovn-nbctl set logical_router R2 load_balancer=$uuid ovn-nbctl set load_balancer $uuid vips:'"30.0.0.2:8000"'='"192.168.1.2:80,192.168.2.2:80"' # Wait for ovn-controller to catch up. -OVS_WAIT_UNTIL([ovs-ofctl -O OpenFlow13 dump-groups br-int | grep ct\(]) +ovn-nbctl --wait=hv sync +OVS_WAIT_UNTIL([ovs-ofctl -O OpenFlow13 dump-groups br-int | \ +grep 'nat(dst=192.168.2.2:80)']) # Start webservers in 'foo1', 'bar1'. OVS_START_L7([foo1], [http]) @@ -1020,7 +1029,9 @@ ovn-nbctl set logical_router R2 load_balancer=$uuid ovn-nbctl set logical_router R3 load_balancer=$uuid # Wait for ovn-controller to catch up. -OVS_WAIT_UNTIL([ovs-ofctl -O OpenFlow13 dump-groups br-int | grep ct\(]) +ovn-nbctl --wait=hv sync +OVS_WAIT_UNTIL([ovs-ofctl -O OpenFlow13 dump-groups br-int | \ +grep 'nat(dst=192.168.2.2)']) # Start webservers in 'foo1', 'bar1'. OVS_START_L7([foo1], [http]) @@ -1151,7 +1162,8 @@ AT_CHECK([ovn-nbctl lr-nat-add R1 dnat_and_snat 172.16.1.4 192.168.1.3 foo2 00:0 # Add a SNAT rule AT_CHECK([ovn-nbctl lr-nat-add R1 snat 172.16.1.1 192.168.0.0/16]) -OVS_WAIT_UNTIL([ovs-ofctl dump-flows br-int | grep ct\( | grep nat]) +ovn-nbctl --wait=hv sync +OVS_WAIT_UNTIL([ovs-ofctl dump-flows br-int | grep 'nat(src=172.16.1.1)']) # North-South DNAT: 'alice1' pings 'foo1' using 172.16.1.3. NS_CHECK_EXEC([alice1], [ping -q -c 3 -i 0.3 -w 2 172.16.1.3 | FORMAT_PING], \ @@ -1297,7 +1309,8 @@ AT_CHECK([ovn-nbctl lr-nat-add R1 dnat_and_snat 172.16.1.4 192.168.2.2 bar1 00:0 # Add a SNAT rule AT_CHECK([ovn-nbctl lr-nat-add R1 snat 172.16.1.1 192.168.0.0/16]) -OVS_WAIT_UNTIL([ovs-ofctl dump-flows br-int | grep ct\( | grep nat]) +ovn-nbctl --wait=hv sync +OVS_WAIT_UNTIL([ovs-ofctl dump-flows br-int | grep 'nat(src=172.16.1.1)']) echo "------ hv dump ------" ovs-ofctl show br-int