On Wed, Nov 4, 2015 at 11:43 PM, Liran Schour <[email protected]> wrote: > Andy Zhou <[email protected]> wrote on 04/11/2015 05:20:08 PM: > >> From: Andy Zhou <[email protected]> >> To: Liran Schour/Haifa/IBM@IBMIL >> Cc: dev <[email protected]> >> 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 <[email protected]> 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] _______________________________________________ dev mailing list [email protected] http://openvswitch.org/mailman/listinfo/dev
