ia64/xen-unstable

changeset 12655:07e3f39eaf10

Silence log message when trying to unregister a watch that's already been
unregistered -- this is not a problem.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Wed Nov 29 12:14:45 2006 +0000 (2006-11-29)
parents 53795f0a41b1
children 1b501311c778
files tools/python/xen/xend/xenstore/xswatch.py
line diff
     1.1 --- a/tools/python/xen/xend/xenstore/xswatch.py	Wed Nov 29 12:16:59 2006 +0000
     1.2 +++ b/tools/python/xen/xend/xenstore/xswatch.py	Wed Nov 29 12:14:45 2006 +0000
     1.3 @@ -5,6 +5,7 @@
     1.4  # Public License.  See the file "COPYING" in the main directory of
     1.5  # this archive for more details.
     1.6  
     1.7 +import errno
     1.8  import threading
     1.9  from xen.xend.xenstore.xsutil import xshandle
    1.10  
    1.11 @@ -65,7 +66,15 @@ def watchMain():
    1.12              watch = we[1]
    1.13              res = watch.fn(we[0], *watch.args, **watch.kwargs)
    1.14              if not res:
    1.15 -                watch.unwatch()
    1.16 +                try:
    1.17 +                    watch.unwatch()
    1.18 +                except RuntimeError, exn:
    1.19 +                    if exn.args[0] == errno.ENOENT:
    1.20 +                        # The watch has already been unregistered -- that's
    1.21 +                        # fine.
    1.22 +                        pass
    1.23 +                    else:
    1.24 +                        raise
    1.25          except:
    1.26              log.exception("read_watch failed")
    1.27              # Ignore this exception -- there's no point throwing it