[ovs-dev] [PATCH] tests: Really fix requested-chassis localport test

Frode Nordahl frode.nordahl at canonical.com
Fri Nov 5 16:10:51 UTC 2021


On Fri, Nov 5, 2021 at 5:06 PM Frode Nordahl
<frode.nordahl at canonical.com> wrote:
>
> Use OVS_WAIT_UNTIL instead of AT_CHECK, which should avoid race
> conditions where the check is ran before the tables are populated.
>
> Fixes: ad77db239d9a ("controller: Make use of Port_Binding:requested_chassis.")
> Signed-off-by: Frode Nordahl <frode.nordahl at canonical.com>
> ---
>  tests/ovn.at | 30 ++++++++++++++++++++++++------
>  1 file changed, 24 insertions(+), 6 deletions(-)
>
> diff --git a/tests/ovn.at b/tests/ovn.at
> index 6f6f5c2da..828fbf68e 100644
> --- a/tests/ovn.at
> +++ b/tests/ovn.at
> @@ -28748,18 +28748,36 @@ check ovn-nbctl lsp-set-type sw0-lport localport
>  # First confirm operation without requested-chassis
>  check_row_count Port_Binding 1 logical_port=sw0-lport 'up=true'
>
> -AT_CHECK([as hv1 ovs-ofctl -O OpenFlow15 dump-flows br-int table=0 | grep -q in_port=13], [0], [])
> -AT_CHECK([as hv2 ovs-ofctl -O OpenFlow15 dump-flows br-int table=0 | grep -q in_port=13], [0], [])
> +OVS_WAIT_UNTIL([
> +    as hv1 \
> +    ovs-ofctl -O OpenFlow15 dump-flows br-int table=0 | grep -q in_port=13
> +])
> +OVS_WAIT_UNTIL([
> +    as hv2 \
> +    ovs-ofctl -O OpenFlow15 dump-flows br-int table=0 | grep -q in_port=13
> +])
>
>  # Set requested-chassis to one of the HVs
>  check ovn-nbctl --wait=hv lsp-set-options sw0-lport requested-chassis="hv1"
> -AT_CHECK([as hv1 ovs-ofctl -O OpenFlow15 dump-flows br-int table=0 | grep -q in_port=13], [0], [])
> -AT_CHECK([as hv2 ovs-ofctl -O OpenFlow15 dump-flows br-int table=0 | grep -q in_port=13], [1], [])
> +OVS_WAIT_UNTIL([
> +    as hv1 \
> +    ovs-ofctl -O OpenFlow15 dump-flows br-int table=0 | grep -q in_port=13
> +])
> +OVS_WAIT_UNTIL([
> +   ! as hv2 \
> +   ovs-ofctl -O OpenFlow15 dump-flows br-int table=0 | grep -q in_port=13
> +])
>
>  # Set requested-chassis to empty string
>  check ovn-nbctl --wait=hv lsp-set-options sw0-lport requested-chassis=""
> -AT_CHECK([as hv1 ovs-ofctl -O OpenFlow15 dump-flows br-int table=0 | grep -q in_port=13], [0], [])
> -AT_CHECK([as hv2 ovs-ofctl -O OpenFlow15 dump-flows br-int table=0 | grep -q in_port=13], [0], [])
> +OVS_WAIT_UNTIL([
> +    as hv1 \
> +    ovs-ofctl -O OpenFlow15 dump-flows br-int table=0 | grep -q in_port=13
> +])
> +OVS_WAIT_UNTIL([
> +    as hv2 \
> +    ovs-ofctl -O OpenFlow15 dump-flows br-int table=0 | grep -q in_port=13
> +])
>
>  OVN_CLEANUP([hv1],[hv2])
>  AT_CLEANUP
> --
> 2.32.0
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Hold on, I'm running this in a tight loop on a loaded system to
confirm if it actually helps or not, and it just failed for me:
ovn-nbctl ls-add sw0
./ovn-macros.at:385: "$@"
ovn-nbctl lsp-add sw0 sw0-lport
./ovn-macros.at:385: "$@"
ovn-nbctl lsp-set-addresses sw0-lport 50:54:00:00:00:01 10.0.0.2
./ovn-macros.at:385: "$@"
ovn-nbctl lsp-set-type sw0-lport localport
./ovn-macros.at:385: "$@"

Checking for 1 rows in sb Port_Binding with logical_port=sw0-lport
up=true... found 1
ovn.at:28723: waiting until
    as hv1 \
    ovs-ofctl -O OpenFlow15 dump-flows br-int table=0 | grep -q in_port=13
...
ovn.at:28723: wait failed after 30 seconds

I'll investigate some more and respin.

-- 
Frode Nordahl


More information about the dev mailing list