Revision e9c8deab

b/daemons/ganeti-confd
117 117
    self.inotify_handler = asyncnotifier.SingleFileEventHandler(self.wm,
118 118
                                                                self.OnInotify,
119 119
                                                                cfg_file)
120
    self.notifier = asyncnotifier.AsyncNotifier(self.wm, self.inotify_handler)
120
    notifier_class = asyncnotifier.ErrorLoggingAsyncNotifier
121
    self.notifier = notifier_class(self.wm, self.inotify_handler)
121 122

  
122 123
    self.timer_handle = None
123 124
    self._EnableTimer()
b/lib/asyncnotifier.py
31 31
except ImportError:
32 32
  import pyinotify
33 33

  
34
from ganeti import daemon
34 35
from ganeti import errors
35 36

  
36 37
# We contributed the AsyncNotifier class back to python-pyinotify, and it's
......
65 66
    self.notifier.process_events()
66 67

  
67 68

  
69
class ErrorLoggingAsyncNotifier(AsyncNotifier,
70
                                daemon.GanetiBaseAsyncoreDispatcher):
71
  """An asyncnotifier that can survive errors in the callbacks.
72

  
73
  We define this as a separate class, since we don't want to make AsyncNotifier
74
  diverge from what we contributed upstream.
75

  
76
  """
77

  
78

  
68 79
class SingleFileEventHandler(pyinotify.ProcessEvent):
69 80
  """Handle modify events for a single file.
70 81

  
b/test/ganeti.asyncnotifier_unittest.py
57 57
                                                          self.cbk[i],
58 58
                                                          self.chk_files[i])
59 59
                      for i in range(len(self.NOTIFIERS))]
60
    self.notifiers = [asyncnotifier.AsyncNotifier(self.wms[i],
61
                                                  self.ihandler[i])
60
    self.notifiers = [asyncnotifier.ErrorLoggingAsyncNotifier(self.wms[i],
61
                                                              self.ihandler[i])
62 62
                       for i in range(len(self.NOTIFIERS))]
63 63
    # TERM notifier is enabled by default, as we use it to get out of the loop
64 64
    self.ihandler[self.NOTIFIER_TERM].enable()

Also available in: Unified diff