diff mbox series

[ovs-dev] controller: Container lport install flows in MAIN chassis only.

Message ID 20240910091602.46002-1-mheib@redhat.com
State Not Applicable
Headers show
Series [ovs-dev] controller: Container lport install flows in MAIN chassis only. | expand

Checks

Context Check Description
ovsrobot/apply-robot fail apply and check: fail

Commit Message

Mohammad Heib Sept. 10, 2024, 9:16 a.m. UTC
If container lport parent_port has an additional chassis option set with
multiple chassis in some cases the container lport flows in table 0 will
be installed in all those chassis instead of the main chassis.

This patch will limit the container port flows in table 0 to only the
parent port main chassis.

Rreported-at: https://issues.redhat.com/browse/FDP-772
Signed-off-by: Mohammad Heib <mheib@redhat.com>
---
 controller/physical.c |  3 ++-
 tests/ovn.at          | 51 ++++++++++++++++++++++++++-----------------
 2 files changed, 33 insertions(+), 21 deletions(-)

Comments

0-day Robot Sept. 10, 2024, 9:37 a.m. UTC | #1
Bleep bloop.  Greetings Mohammad Heib, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


git-am:
error: sha1 information is lacking or useless (controller/physical.c).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 controller: Container lport install flows in MAIN chassis only.
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".


Patch skipped due to previous failure.

Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot
diff mbox series

Patch

diff --git a/controller/physical.c b/controller/physical.c
index 9e04ad5f2..184e5ef34 100644
--- a/controller/physical.c
+++ b/controller/physical.c
@@ -1658,7 +1658,8 @@  consider_port_binding(struct ovsdb_idl_index *sbrec_port_binding_by_name,
                 sbrec_port_binding_by_name, binding->parent_port);
 
             if (parent_port
-                && !lport_can_bind_on_this_chassis(chassis, parent_port)) {
+                && (lport_can_bind_on_this_chassis(chassis,
+                    parent_port) != CAN_BIND_AS_MAIN)) {
                 /* Even though there is an ofport for this container
                  * parent port, it is requested on different chassis ignore
                  * this container port.
diff --git a/tests/ovn.at b/tests/ovn.at
index acf18c4e0..c4a1317d4 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -38238,49 +38238,60 @@  AT_CLEANUP
 OVN_FOR_EACH_NORTHD([
 AT_SETUP([ovn-controller - cleanup VIF/CIF related flows/fields when updating requested-chassis])
 ovn_start
-
 net_add n1
-sim_add hv1
-ovs-vsctl add-br br-phys
-ovn_attach n1 br-phys 192.168.0.1
-check ovs-vsctl -- add-port br-int vif1 -- \
-    set Interface vif1 external-ids:iface-id=lsp1 \
-    ofport-request=8
 
-check ovn-nbctl ls-add lsw0
+for i in 1 2; do
+    sim_add hv$i
+    as hv$i
+    ovs-vsctl add-br br-phys
+    ovn_attach n1 br-phys 192.168.0.$i
+    check ovs-vsctl -- add-port br-int vif1 -- \
+        set Interface vif1 ofport-request=8
+done
 
+check ovn-nbctl ls-add lsw0
+as hv1
+check ovs-vsctl set Interface vif1 external-ids:iface-id=lsp1
 check ovn-nbctl lsp-add lsw0 lsp1
 check ovn-nbctl lsp-add lsw0 sw0-port1.1 lsp1 7
 
 # wait for the VIF to be claimed to this chassis
 wait_row_count Chassis 1 name=hv1
+wait_row_count Chassis 1 name=hv2
 hv1_uuid=$(fetch_column Chassis _uuid name=hv1)
+hv2_uuid=$(fetch_column Chassis _uuid name=hv2)
+
 wait_for_ports_up lsp1
 wait_for_ports_up sw0-port1.1
 wait_column "$hv1_uuid" Port_Binding chassis logical_port=lsp1
 wait_column "$hv1_uuid" Port_Binding chassis logical_port=sw0-port1.1
 
 # check that flows is installed
-OVS_WAIT_FOR_OUTPUT([as hv1 ovs-ofctl dump-flows br-int table=0 |grep priority=100 | grep -c in_port=8], [0],[dnl
+OVS_WAIT_FOR_OUTPUT([as hv1 ovs-ofctl dump-flows br-int table=OFTABLE_PHY_TO_LOG |grep priority=150|grep dl_vlan=7| grep -c in_port=8], [0],[dnl
 1
 ])
-OVS_WAIT_FOR_OUTPUT([as hv1 ovs-ofctl dump-flows br-int table=0 |grep priority=150|grep dl_vlan=7| grep -c in_port=8], [0],[dnl
-1
+
+OVS_WAIT_FOR_OUTPUT([as hv2 ovs-ofctl dump-flows br-int table=OFTABLE_PHY_TO_LOG |grep priority=150|grep dl_vlan=7| grep -c in_port=8], [1],[dnl
+0
 ])
 
-# set lport requested-chassis to differant chassis
+# Add hv2 to lport Additional requested chassis as MAIN chassis
+# and check that no flows installed in table 0 in hv1
 check ovn-nbctl set Logical_Switch_Port lsp1 \
-    options:requested-chassis=foo
+    options:requested-chassis=hv2,hv1
 
-OVS_WAIT_UNTIL([test `ovn-sbctl get Port_Binding lsp1 up` = 'false'])
-OVS_WAIT_UNTIL([test `ovn-sbctl get Port_Binding sw0-port1.1 up` = 'false'])
-wait_column "" Port_Binding chassis logical_port=lsp1
-wait_column "" Port_Binding chassis logical_port=sw0-port1.1
+as hv2
+check ovs-vsctl set Interface vif1 external-ids:iface-id=lsp1
+ovn-nbctl --wait=hv sync
 
-OVS_WAIT_FOR_OUTPUT([as hv1 ovs-ofctl dump-flows br-int table=0 |grep priority=100 |grep -c in_port=8], [1],[dnl
-0
+wait_for_ports_up lsp1
+wait_for_ports_up sw0-port1.1
+wait_column "$hv2_uuid" Port_Binding chassis logical_port=lsp1
+
+OVS_WAIT_FOR_OUTPUT([as hv2 ovs-ofctl dump-flows br-int table=OFTABLE_PHY_TO_LOG |grep priority=150|grep dl_vlan=7| grep -c in_port=8], [0],[dnl
+1
 ])
-OVS_WAIT_FOR_OUTPUT([as hv1 ovs-ofctl dump-flows br-int table=0 |grep priority=150|grep dl_vlan=7| grep -c in_port=8], [1],[dnl
+OVS_WAIT_FOR_OUTPUT([as hv1 ovs-ofctl dump-flows br-int table=OFTABLE_PHY_TO_LOG |grep priority=150|grep dl_vlan=7| grep -c in_port=8], [1],[dnl
 0
 ])