[ovs-dev] [PATCH ovn] ovn-controller: Release lport if the ofport of the VIF is -1.

Mark Michelson mmichels at redhat.com
Tue Jul 28 18:21:11 UTC 2020


Acked-by: Mark Michelson <mmichels at redhat.com>

On 7/28/20 4:37 AM, numans at ovn.org wrote:
> From: Numan Siddique <numans at ovn.org>
> 
> If ofport of an OVS interface is set -1 for some reason, then ovn-controller
> is not releasing the logical port which maps to the OVS interface.
> 
> This patch fixes this issue.
> 
> Fixes: 354bdba51abf("ovn-controller: I-P for SB port binding and OVS interface in runtime_data.")
> Signed-off-by: Numan Siddique <numans at ovn.org>
> ---
>   controller/binding.c |  6 +++---
>   tests/system-ovn.at  | 48 ++++++++++++++++++++++++++++++++++++++++++++
>   2 files changed, 51 insertions(+), 3 deletions(-)
> 
> diff --git a/controller/binding.c b/controller/binding.c
> index 520bff080f..880fbb13b8 100644
> --- a/controller/binding.c
> +++ b/controller/binding.c
> @@ -1853,9 +1853,9 @@ binding_handle_ovs_interface_changes(struct binding_ctx_in *b_ctx_in,
>                    * inteface to new port binding. */
>                   if (old_iface_id && strcmp(iface_id, old_iface_id)) {
>                       cleared_iface_id = old_iface_id;
> -                } else if (!ofport) {
> -                    /* If ofport is 0, we need to release the iface if already
> -                     * claimed. */
> +                } else if (ofport <= 0) {
> +                    /* If ofport is <= 0, we need to release the iface if
> +                     * already claimed. */
>                       cleared_iface_id = iface_id;
>                   }
>               } else if (old_iface_id) {
> diff --git a/tests/system-ovn.at b/tests/system-ovn.at
> index bca2601267..dee4351755 100644
> --- a/tests/system-ovn.at
> +++ b/tests/system-ovn.at
> @@ -4572,3 +4572,51 @@ OVS_TRAFFIC_VSWITCHD_STOP(["/failed to query port patch-.*/d
>   /connection dropped.*/d"])
>   
>   AT_CLEANUP
> +
> +AT_SETUP([ovn -- controller I-P handling when ovs iface ofport is -1])
> +
> +ovn_start
> +
> +OVS_TRAFFIC_VSWITCHD_START()
> +ADD_BR([br-int])
> +
> +# Set external-ids in br-int needed for ovn-controller
> +ovs-vsctl \
> +        -- set Open_vSwitch . external-ids:system-id=hv1 \
> +        -- set Open_vSwitch . external-ids:ovn-remote=unix:$ovs_base/ovn-sb/ovn-sb.sock \
> +        -- set Open_vSwitch . external-ids:ovn-encap-type=geneve \
> +        -- set Open_vSwitch . external-ids:ovn-encap-ip=169.0.0.1 \
> +        -- set bridge br-int fail-mode=secure other-config:disable-in-band=true
> +
> +# Start ovn-controller
> +start_daemon ovn-controller
> +
> +ovn-nbctl ls-add sw0
> +ovn-nbctl lsp-add sw0 sw0-port1
> +ovn-nbctl lsp-set-addresses sw0-port1 "10:54:00:00:00:03 10.0.0.3"
> +
> +ovs-vsctl add-port br-int p1 -- \
> +    set Interface p1 external_ids:iface-id=sw0-port1 -- \
> +    set Interface p1 type=internal
> +
> +OVS_WAIT_UNTIL([test x$(ovn-nbctl lsp-get-up sw0-port1) = xup])
> +ovs-vsctl set interface p1 type=\"\"
> +OVS_WAIT_UNTIL([test x$(ovn-nbctl lsp-get-up sw0-port1) = xdown])
> +
> +OVS_APP_EXIT_AND_WAIT([ovn-controller])
> +
> +as ovn-sb
> +OVS_APP_EXIT_AND_WAIT([ovsdb-server])
> +
> +as ovn-nb
> +OVS_APP_EXIT_AND_WAIT([ovsdb-server])
> +
> +as northd
> +OVS_APP_EXIT_AND_WAIT([ovn-northd])
> +
> +as
> +OVS_TRAFFIC_VSWITCHD_STOP(["/failed to query port patch-.*/d
> +/connection dropped.*/d
> +/could not open network device p1*/d"])
> +
> +AT_CLEANUP
> 



More information about the dev mailing list