On 1/25/22 23:22, Lorenzo Bianconi wrote:
> Introduce the capability to specify CoPP name in order to
> reuse the same CoPP reference on multiple datapaths.
> Introduce the following CoPP commands:
> - ovn-nbctl copp-add <name> <proto> <meter>
> - ovn-nbctl copp-del <name> <proto>
> - ovn-nbctl copp-list <name>
> - ovn-nbctl ls-copp-add <name> <switch>
> - ovn-nbctl lr-copp-add <name> <router>
> 
> Introduce name and external_ids columns in CoPP table.
> 
> Reported-ad: https://bugzilla.redhat.com/show_bug.cgi?id=2040852
> Signed-off-by: Lorenzo Bianconi <[email protected]>
> ---

Hi Lorenzo,

Overall this change looks OK to me.  There is however one issue, when
updating copp entries by UUID, see below.

Also, I think we should add NEWS entries mentioning the new commands and
also letting users know that the "name" is now mandatory and used as
unique index.

[...]

> diff --git a/utilities/ovn-nbctl.c b/utilities/ovn-nbctl.c
> index d67d2db65..e0d5191f1 100644
> --- a/utilities/ovn-nbctl.c
> +++ b/utilities/ovn-nbctl.c

[...]

> @@ -6295,23 +6290,16 @@ nbctl_ls_copp_add(struct ctl_context *ctx)
>          return;
>      }
>  
> -    const struct nbrec_logical_switch *ls = NULL;
> -    error = ls_by_name_or_uuid(ctx, ls_name, true, &ls);
> -    if (error) {
> -        ctx->error = error;
> -        return;
> -    }
> -
> -    const struct nbrec_copp *copp =
> -        copp_meter_add(ctx, ls->copp, proto_name, meter);
> -    nbrec_logical_switch_set_copp(ls, copp);
> +    error = copp_by_name_or_uuid(ctx, ctx->argv[1], false, &copp);
> +    copp = copp_meter_add(ctx, copp, proto_name, meter);
> +    nbrec_copp_set_name(copp, ctx->argv[1]);

If ctx->argv[1] was an UUID we shouldn't reset the name, e.g., this is
wrong:

$ ovn-nbctl copp-add copp1 arp meter-arp
$ ovn-nbctl list copp | grep -e uuid -e name
_uuid               : 04ebc387-ee3e-4d93-b6a3-2037c1da74d9
name                : copp1
$ ovn-nbctl copp-add 04ebc387-ee3e-4d93-b6a3-2037c1da74d9 igmp meter-igmp
$ ovn-nbctl list copp | grep -e uuid -e name
_uuid               : 04ebc387-ee3e-4d93-b6a3-2037c1da74d9
name                : "04ebc387-ee3e-4d93-b6a3-2037c1da74d9"

Regards,
Dumitru

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to