[ovs-dev] Combining monitor2 and monitor_cond methods

Andy Zhou azhou at nicira.com
Mon Nov 9 17:49:37 UTC 2015


On Wed, Nov 4, 2015 at 11:43 PM, Liran Schour <LIRANS at il.ibm.com> wrote:
> Andy Zhou <azhou at nicira.com> wrote on 04/11/2015 05:20:08 PM:
>
>> From: Andy Zhou <azhou at nicira.com>
>> To: Liran Schour/Haifa/IBM at IBMIL
>> Cc: dev <dev at openvswitch.org>
>> Date: 04/11/2015 05:20 PM
>> Subject: Re: Combining monitor2 and monitor_cond methods
>
>>
>> On Wed, Nov 4, 2015 at 5:22 AM, Liran Schour <LIRANS at il.ibm.com> wrote:
>> > In order not to have 2 new monitor methods, maybe we should combine them
>> > into a single method.
>> >
>> > However, as I thought on this, monitor_cond without any conditions
>> > should
>> > not send any updates at all. A typical usage will be in OVN when
>> > ovn-controller will open a monitor_cond session with empty
>> > "where"condition
>> > array and when VMs are deployed on this host, it will add conditions by
>> > monitor_cond_change method and by that will get all the updates relevant
>> > to
>> > that specific host.
>> >
>> > As I see it, we have here 2 options:
>> > 1. monitor_cond without any "where" value will behave as the proposed
>> > monitor2 method - send updates upon all rows using update2
>> > notifications.
>> >     monitor_cond with "where" value that is an empty array will not send
>> > any
>> > updates at all till conditions are added by monitor_cond_change method.
>> >
>> This can work, but the API seems subtle. So I'd prefer to explore the
>> next option more.
>>
>> > 2. monitor_cond always sends updates. If there is no "where" value or it
>> > is
>> > an empty array, updates on all rows will be sent using update2
>> > notifications. In this case a client will not be able to open a monitor
>> > session and expect no updates at all like written in the usage above.
>> >
>>
>> This seems natural.
>>
>> If no updates are expected at the beginning, could we come up with a
>> where condition that
>> will not generate any updates? Like "where false".
>>
>
> It can work if we can define "where" to be an array of <condition> and
> boolean values. For example: "where" : [false, <condition>*]. Since the
> monitor_cond will monitor any row that match at least one of the conditions,
> if we will have "where" : [false] no row will be monitored.

This solution looks good to me. May be we can define <condition> as either
a 3-element array or a JSON boolean. For completeness, we can define
where : [] to be the same as where : [true]



More information about the dev mailing list