Revision 562bee4d

b/daemons/ganeti-confd
196 196
    logging.error("Received unhandled inotify event: %s" % event)
197 197

  
198 198

  
199
class ConfdConfigurationReloader(object):
200
  """Logic to control when to reload the ganeti configuration
201

  
202
  This class is able to alter between inotify and polling, to rate-limit the
203
  number of reloads. When using inotify it also supports a fallback timed
204
  check, to verify that the reload hasn't failed.
205

  
206
  """
207
  def __init__(self, reader):
208
    """Constructor for ConfdConfigurationReloader
209

  
210
    @type reader: L{ssconf.SimpleConfigReader}
211
    @param reader: ganeti-confd SimpleConfigReader
212

  
213
    """
214
    self.reader = reader
215

  
216
    # Asyncronous inotify handler for config changes
217
    self.wm = pyinotify.WatchManager()
218
    self.inotify_handler = ConfdInotifyEventHandler(self.wm, reader)
219
    self.notifier = AsyncNotifier(self.wm, self.confd_event_handler)
220

  
221

  
199 222
def CheckConfd(options, args):
200 223
  """Initial checks whether to run exit with a failure.
201 224

  
......
222 245
  processor = ConfdProcessor(reader)
223 246
  server = ConfdAsyncUDPServer(options.bind_address, options.port, processor)
224 247

  
225
  # Asyncronous inotify handler for config changes
226
  wm = pyinotify.WatchManager()
227
  confd_event_handler = ConfdInotifyEventHandler(wm, reader)
228
  notifier = AsyncNotifier(wm, confd_event_handler)
248
  # Configuration reloader
249
  reloader = ConfdConfigurationReloader(reader)
229 250

  
230 251
  mainloop.Run()
231 252

  

Also available in: Unified diff