On 3/25/22 18:37, Terry Wilson wrote:
> Before 46d44cf3b, it was technically possible to assign a monitor
> condition directly to Idl.tables[table_name].condition. If done
> before the connection was established, it would successfully apply
> the condition (where cond_change() actually would fail).
> 
> Although this wasn't meant to be supported, several OpenStack
> projects made use of this. After 46d44cf3b, .condition is no
> longer a list, but a ConditionState. Assigning a list to it breaks
> the Idl.
> 
> The Neutron and ovsdbapp projects have patches in-flight to
> use Idl.cond_change() if ConditionState exists, as it now works
> before connection as well. There could be other users that also
> start failing when upgrading to OVS 2.17, so this patch makes
> TableSchema.condition a property, warning users who assign to
> .condition to use cond_change() instead, but doing the equivalent
> to what it used to do (which is still broken behavior after a
> connection is established).
> 
> Fixes: 46d44cf3b ("python: idl: Add monitor_cond_since support")
> Signed-off-by: Terry Wilson <[email protected]>
> ---

Hi Terry,

This patch needs a small cleanup, it's currently failing CI due to:

python/ovs/db/idl.py:223:80: E501 line too long (80 > 79 characters)

https://mail.openvswitch.org/pipermail/ovs-build/2022-March/020832.html

>  python/ovs/db/idl.py | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/python/ovs/db/idl.py b/python/ovs/db/idl.py
> index 4ecdcaa19..b67504278 100644
> --- a/python/ovs/db/idl.py
> +++ b/python/ovs/db/idl.py
> @@ -140,6 +140,21 @@ class ConditionState(object):
>          return False
>  
>  
> +def get_condition(self):
> +    return self._condition
> +

Doesn't this mean that older clients that were reading "condition" as a
list will now be broken?  Or am I missing something?

On the other hand, I'm not sure if we can fix that in a polite way.

> +
> +def set_condition(self, condition):
> +    if isinstance(condition, ConditionState):
> +        self._condition = condition
> +    else:
> +        vlog.warn("Setting table.condition directly is unsupported! "
> +                  "Use Idl.cond_change() instead.")
> +        if not hasattr(self, '_condition'):
> +            self._condition = ConditionState()
> +        self.idl.cond_change(self.name, condition)
> +
> +
>  class Idl(object):
>      """Open vSwitch Database Interface Definition Language (OVSDB IDL).
>  
> @@ -205,6 +220,8 @@ class Idl(object):
>          Monitor.monitor_cond: IDL_S_DATA_MONITOR_COND_REQUESTED,
>          Monitor.monitor_cond_since: IDL_S_DATA_MONITOR_COND_SINCE_REQUESTED}
>  
> +    ovs.db.schema.TableSchema.condition = property(get_condition, 
> set_condition)
> +
>      def __init__(self, remote, schema_helper, probe_interval=None,
>                   leader_only=True):
>          """Creates and returns a connection to the database named 'db_name' 
> on

Thanks,
Dumitru

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

Reply via email to