#!/usr/bin/python
#
-# Copyright (C) 2009, Google Inc.
+# Copyright (C) 2009, 2010 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
from ganeti import constants
from ganeti import errors
from ganeti import daemon
+from ganeti import netutils
class ConfdAsyncUDPServer(daemon.AsyncUDPSocket):
"""Constructor for ConfdAsyncUDPServer
@type bind_address: string
- @param bind_address: socket bind address ('' for all)
+ @param bind_address: socket bind address
@type port: int
@param port: udp port
@type processor: L{confd.server.ConfdProcessor}
@param processor: ConfdProcessor to use to handle queries
"""
- daemon.AsyncUDPSocket.__init__(self)
+ family = netutils.IPAddress.GetAddressFamily(bind_address)
+ daemon.AsyncUDPSocket.__init__(self, family)
self.bind_address = bind_address
self.port = port
self.processor = processor
self.inotify_handler = asyncnotifier.SingleFileEventHandler(self.wm,
self.OnInotify,
cfg_file)
- self.notifier = asyncnotifier.AsyncNotifier(self.wm, self.inotify_handler)
+ notifier_class = asyncnotifier.ErrorLoggingAsyncNotifier
+ self.notifier = notifier_class(self.wm, self.inotify_handler)
self.timer_handle = None
self._EnableTimer()
print >> sys.stderr, "Need HMAC key %s to run" % constants.CONFD_HMAC_KEY
sys.exit(constants.EXIT_FAILURE)
+ # TODO: once we have a cluster param specifying the address family
+ # preference, we need to check if the requested options.bind_address does not
+ # conflict with that. If so, we might warn or EXIT_FAILURE.
+
def ExecConfd(options, _):
"""Main confd function, executed with PID file held