On Tue, Sep 10, 2024 at 5:21 AM Mohammad Heib <[email protected]> wrote:
>
> 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]>

Thanks for the fix.  I applied this patch to main and backported till 23.09.

Numan

> ---
>  controller/physical.c |  3 ++-
>  tests/ovn.at          | 51 ++++++++++++++++++++++++++-----------------
>  2 files changed, 33 insertions(+), 21 deletions(-)
>
> 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
>  ])
>
> --
> 2.34.3
>
> _______________________________________________
> dev mailing list
> [email protected]
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to