Skip to content

Commit

Permalink
controller: Container lport install flows in MAIN chassis only.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Numan Siddique <[email protected]>
(cherry picked from commit a33ce96)
  • Loading branch information
mohammadheib authored and numansiddique committed Oct 10, 2024
1 parent d7738bd commit d1f55ee
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 20 deletions.
3 changes: 2 additions & 1 deletion controller/physical.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
49 changes: 30 additions & 19 deletions tests/ovn.at
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d1f55ee

Please sign in to comment.