On 6/27/25 2:09 PM, Ilya Maximets wrote:
> Currently, there is no convenient way to know what are the constraints
> for a particular column in the server's schema in C IDL.  This is
> a problem, because clients may want to know how many elements are
> allowed in a certain column.  For example, we recently increased the
> allowed number of prefixes configured in the Flow_Table table in OVS,
> but the client (ovn-controller) has no good way to know how many
> prefixes are actually supported in the schema of the currently running
> ovsdb-server.  The IDL's code is generated from one schema version,
> while the actual server may be using newer or older one.  If the
> client specifies too many prefixes, the transaction will fail, and
> there is also no good way to tell from the ovn-controller why exactly
> transaction failed.
> 
> Currently used solution is to create another database connection just
> to intercept schema changes and parse the schema JSON manually inside
> the ovn-controller:
>   
> https://github.com/ovn-org/ovn/commit/89e43f7528b067b1bc9f6c5fd67857b39ebc518d
> 
> While this approach works, it's not a clean solution.  We have the
> server's schema on the CS level and we can provide the types to the
> application via IDL functions.  This will allow ovn-controller to
> just use ovsrec_flow_table_prefixes_server_type(idl)->n_max instead
> of all the awkward schema parsing.
> 
> Python IDL is more dynamic and has a different way of connecting
> where the user first obtains the schema and then initializes IDL
> with that schema.  The parsed schema object with all the types is
> also available through the get_idl_schema() method.  So, it is
> already possible to check the types there.
> 
> Signed-off-by: Ilya Maximets <i.maxim...@ovn.org>
> ---

Hi Ilya,

>  NEWS                     |  4 +++
>  lib/ovsdb-cs.c           | 64 +++++++++++++++++++++++++---------
>  lib/ovsdb-idl-provider.h |  3 +-
>  lib/ovsdb-idl.c          | 74 ++++++++++++++++++++++++++++++++++------
>  lib/ovsdb-idl.h          |  3 ++
>  ovsdb/ovsdb-idlc.in      | 12 +++++++
>  tests/ovsdb-idl.at       | 10 +++---
>  tests/test-ovsdb.c       | 33 +++++++++++++-----
>  8 files changed, 162 insertions(+), 41 deletions(-)
> 
> diff --git a/NEWS b/NEWS
> index d7231fabc..7f2d3462a 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -8,6 +8,10 @@ Post-v3.5.0
>       * New debug appctl command 'dpdk/get-memzone-stats'.
>       * Removed upper limit for the number of rx/tx descriptors 
> (n_r/txq_desc).
>       * OVS validated with DPDK 24.11.2.
> +   - OVSDB-IDL:
> +     * New functions <db>_<table>_<column>_server_type() that allow checking
> +       the server-side type of a particular column.  Can be used for checking
> +       type constraints when the server schema is older or newer than 
> client's.

Nit (but I'm no native speaker so take this with a grain of salt):
s/than client's/than that of the client/.

Otherwise the rest looks good to me, thanks for the nice addition!

Acked-by: Dumitru Ceara <dce...@redhat.com>

Regards,
Dumitru

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to