From d1f55ee8158b6954deafab13e847004a455e8044 Mon Sep 17 00:00:00 2001 From: Mohammad Heib Date: Tue, 10 Sep 2024 12:21:01 +0300 Subject: [PATCH] controller: Container lport install flows in MAIN chassis only. 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 Signed-off-by: Numan Siddique (cherry picked from commit a33ce9613037405d6eed912dbb07244b4b44599a) --- controller/physical.c | 3 ++- tests/ovn.at | 49 ++++++++++++++++++++++++++----------------- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/controller/physical.c b/controller/physical.c index 30c5147794..e6f5628fed 100644 --- a/controller/physical.c +++ b/controller/physical.c @@ -1592,7 +1592,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 3b0cbfcbf5..faadb8a96f 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -37864,47 +37864,58 @@ 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 -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 ]) -# set lport requested-chassis to differant chassis +OVS_WAIT_FOR_OUTPUT([as hv2 ovs-ofctl dump-flows br-int table=0 |grep priority=150|grep dl_vlan=7| grep -c in_port=8], [1],[dnl +0 +]) + +# 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=0 |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 0