From mboxrd@z Thu Jan 1 00:00:00 1970 From: John McCullough Subject: Re: XenStore Watch Behavior Date: Mon, 28 Aug 2006 17:48:31 -0700 Message-ID: <20060829004830.GC23281@cs.ucsd.edu> References: <20060826203222.GA2835@cs.ucsd.edu> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="8t9RHnE3ZwKMSgU+" Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: xen-devel@lists.xensource.com, John McCullough List-Id: xen-devel@lists.xenproject.org --8t9RHnE3ZwKMSgU+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Aug 27, 2006 at 03:57:06PM +0100, Keir Fraser wrote: > On 26/8/06 9:32 pm, "John McCullough" wrote: > > > What is the intended behavior of watches on the XenStore? Should > > only one watch be allowed on a given sub-hierarchy? Should the most > > specific watch be triggered alone? Should all watches be triggered? > > I believe it's all supposed to work in a very obvious and simple way: All > watches registered on a prefix of the updated node's path should be fired. A > single transaction can fire the same watch multiple times if that watch is > on a common prefix of a number of nodes updated by that transaction (since > each firing event specifies the full path of the modified node, so events > can't really be merged). > > If you observe different behaviour from this then it is most likely a bug > and we would love to receive patches! > I am attaching a band-aid style patch for xswatch. I haven't dug very far into the xenstore code yet, and I'm not sure how much time I have to dedicate on this quite yet. What this patch addresses is xswatch's tendency to receive watches for non-xswatch created watches with those tokens. Is the indended behavior of read_watch to pick up on all available watches and leave you to discriminate which to service based on token? Something that has recently perplexed me, is when using the watch during the save/restore process, my handler won't receive watches where the value written in the store has an underscore. In the shutdown situation, the underscore value is passed. I am at a loss to guess why this is happening. -John --8t9RHnE3ZwKMSgU+ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="xswatch-fix.diff" Only respond to watches that originated from xswatch. diff -r ec03b24a2d83 tools/python/xen/xend/xenstore/xswatch.py --- a/tools/python/xen/xend/xenstore/xswatch.py Tue Aug 15 19:53:55 2006 +0100 +++ b/tools/python/xen/xend/xenstore/xswatch.py Mon Aug 28 11:04:43 2006 -0700 @@ -63,9 +63,10 @@ def watchMain(): try: we = xs.read_watch() watch = we[1] - res = watch.fn(we[0], *watch.args, **watch.kwargs) - if not res: - watch.unwatch() + if watch.__class__ == xswatch: + res = watch.fn(we[0], *watch.args, **watch.kwargs) + if not res: + watch.unwatch() except: log.exception("read_watch failed") # Ignore this exception -- there's no point throwing it --8t9RHnE3ZwKMSgU+ Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --8t9RHnE3ZwKMSgU+--