On 6/18/25 4:01 PM, Mike Pattrick via dev wrote:
> On Tue, Jun 17, 2025 at 2:59 PM Mark Michelson via dev
> <ovs-dev@openvswitch.org> wrote:
>>
>> The ctl_get_row() function attempts to match a user-provided string to a
>> particular database row. This works by comparing the user-provided
>> string to the values of columns provided by the ctl utility (e.g.
>> ovs-vsctl).
>>
>> Before this commit, this comparison could only be made for columns of
>> type OVSDB_TYPE_INTEGER and OVSDB_TYPE_STRING. If a ctl utility provided
>> a column of a different type, then db-ctl-base.c would assert in
>> get_row_by_id().
>>
>> This commit enhances the ability of ctl_get_row() to also retrieve rows
>> based on columns of type OVSDB_TYPE_UUID. The user-provided string is
>> converted to a UUID and compared against the column's value. If it
>> matches, then the row matches.
>>
>> Signed-off-by: Mark Michelson <mmich...@redhat.com>
>> ---
>> Some context: The OVN southbound database has a Datapath_Binding column
>> that currently has two external-ids that identify a corresponding
>> northbound logical datapath by UUID. Being external-ids, the key and
>> value are both strings.
>>
>> The `ovn-sbctl lflow-list` command can take an optional argument to narrow 
>> the
>> output to only logical flows for a relevant datapath. The ovn-sbctl utility
>> uses ctl_get_row() with the user input to find the relevant datapath. A user
>> can pass the northbound UUID of the relevant datapath, and ctl_get_row() will
>> find it using one of the external-ids.
>>
>> An upcoming change in OVN is going to change how the Datapath_Binding
>> records refer to their corresponding northbound logical datapath UUIDs.
>> Instead of using external-ids, the value is going to be stored in a
>> column of type UUID. Therefore, in order to preserve current
>> functionality in OVN, OVS needs to be able to retrieve the row based on a
>> column of type UUID. This change helps provide that functionality.
>> ---
> 
> I modified the "struct ctl_table_class" variable in ovs-vsctl.c and
> tested it, this seems to work ok.
> 
> At first I was worried that a length check would be needed in
> record_id_equals(), as there is one in the TYPE_STRING uuid check just
> above, but it doesn't actually seem to be needed.
> 
> Acked-by: Mike Pattrick <m...@redhat.com>

Thanks, Mark and Mike!  As long as OVN has test coverage for this, it should
be fine.  In the future we may want to expand OVS tests as well to cover ctl
use cases that ovs-vsctl doesn't have.  With that, applied.

Best regards, Ilya Maximets.
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to