Skip to content

Commit

Permalink
tests: Wait for new ovn-controllers to connect to Southbound.
Browse files Browse the repository at this point in the history
Simulated chassis are added with ovn_attach(), ovn_az_attach() and
start_virtual_controller().  Wait for ovn-controllers to register in the
Southbound (create their Encap record) before continuing.  That's
required because 'ovn-nbctl --wait=hv sync' (used throughout the test
suite) has different semantics if no chassis is registered in the
Southbound.  In those cases the command is equivalent to 'ovn-nbctl
--wait=sb sync'.

This was causing a race condition due to which CI would occasionally
fail because of missing OpenFlows, e.g.:
https://github.com/ovsrobot/ovn/actions/runs/6471719045/job/17570941948#step:8:4849

Co-authored-by: Xavier Simonart <xsimonar@redhat.com>
Signed-off-by: Xavier Simonart <xsimonar@redhat.com>
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: 0-day Robot <robot@bytheb.org>
  • Loading branch information
2 people authored and ovsrobot committed Oct 11, 2023
1 parent 0c22ac3 commit d41699a
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/ovn-macros.at
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,25 @@ net_attach () {
|| return 1
}

ovn_wait_for_encaps() {
local systemid=$1

local encap=$(ovs-vsctl get Open_vSwitch . external_ids:ovn-encap-type-$systemid)
if [[ -n "$encap" ]]; then
encap=$(ovs-vsctl get Open_vSwitch .external_ids:ovn-encap-type)
fi

local ip=$(ovs-vsctl get Open_vSwitch . external_ids:ovn-encap-ip-$systemid)
if [[ -n "$ip" ]]; then
ip=$(ovs-vsctl get Open_vSwitch .external_ids:ovn-encap-ip)
fi

IFS="," read -r -a encap_types <<< "$encap"
for e in "${encap_types[[@]]}"; do
wait_column "$ip" sb:Encap ip chassis_name="$systemid" type="$e"
done
}

# ovn_az_attach AZ NETWORK BRIDGE IP [MASKLEN] [ENCAP]
ovn_az_attach() {
local az=$1 net=$2 bridge=$3 ip=$4 masklen=${5-24} encap=${6-geneve,vxlan} systemid=${7-$sandbox} cli_args=${@:8}
Expand Down Expand Up @@ -332,6 +351,11 @@ ovn_az_attach() {
fi

start_daemon ovn-controller --enable-dummy-vif-plug ${cli_args} || return 1
if test X"$az" = XNONE; then
ovn_wait_for_encaps $systemid
else
ovn_as $az ovn_wait_for_encaps $systemid
fi
}

# ovn_attach NETWORK BRIDGE IP [MASKLEN] [ENCAP]
Expand Down Expand Up @@ -372,6 +396,7 @@ start_virtual_controller() {
|| return 1

ovn-controller --enable-dummy-vif-plug ${cli_args} -vconsole:off --detach --no-chdir
ovn_wait_for_encaps $systemid
}

# ovn_setenv AZ
Expand Down

0 comments on commit d41699a

Please sign in to comment.