Fix a race condition between ofport being assigned and SB going
to sleep.

Fixes: dd46a88d8e8e ("ovn-controller: Port up/ovn-installed reported too 
early.")
Signed-off-by: Xavier Simonart <[email protected]>
---
 tests/ovn-controller.at | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tests/ovn-controller.at b/tests/ovn-controller.at
index 9f104916a..96f489df2 100644
--- a/tests/ovn-controller.at
+++ b/tests/ovn-controller.at
@@ -4110,6 +4110,11 @@ check ovn-appctl vlog/set dbg
 check ovs-vsctl add-port br-int vif1 -- \
     set Interface vif1 external-ids:iface-id=lsp1
 
+# Make sure ofport got created before sleeping sb as otherwise,
+# in conditional monitoring, the new condition (i.e. monitor_cond
+# logical_port == lsp1) will only be received after sb wakes up.
+ofport=$(wait_and_get_ofport name=vif1)
+
 check ovn-nbctl ls-add ls1
 sleep_controller hv1
 check ovn-nbctl --wait=sb lsp-add ls1 lsp1 -- \
@@ -4120,9 +4125,7 @@ wake_up_controller hv1
 
 # Wait for pflow for lsp1
 OVS_WAIT_UNTIL([
-    ofport=$(as hv1 ovs-vsctl --bare --columns ofport find Interface name=vif1)
-    echo "vif1 port=$ofport"
-    test -n "$ofport" && test 1 -le $(as hv1 ovs-ofctl dump-flows br-int | 
grep -c in_port=$ofport)
+    test 1 -le $(as hv1 ovs-ofctl dump-flows br-int | grep -c in_port=$ofport)
 ])
 
 # If ovn-installed in ovs, all flows should be installed.
-- 
2.47.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to