Revision 05f1ebf3
b/daemons/ganeti-confd | ||
---|---|---|
192 | 192 |
check, to verify that the reload hasn't failed. |
193 | 193 |
|
194 | 194 |
""" |
195 |
def __init__(self, reader, mainloop):
|
|
195 |
def __init__(self, processor, mainloop):
|
|
196 | 196 |
"""Constructor for ConfdConfigurationReloader |
197 | 197 |
|
198 |
@type reader: L{ssconf.SimpleConfigReader}
|
|
199 |
@param reader: ganeti-confd SimpleConfigReader
|
|
198 |
@type processor: L{confd.server.ConfdProcessor}
|
|
199 |
@param processor: ganeti-confd ConfdProcessor
|
|
200 | 200 |
@type mainloop: L{daemon.Mainloop} |
201 | 201 |
@param mainloop: ganeti-confd mainloop |
202 | 202 |
|
203 | 203 |
""" |
204 |
self.reader = reader
|
|
204 |
self.processor = processor
|
|
205 | 205 |
self.mainloop = mainloop |
206 | 206 |
|
207 | 207 |
self.polling = False |
... | ... | |
239 | 239 |
raise errors.ConfdFatalError(err) |
240 | 240 |
|
241 | 241 |
try: |
242 |
reloaded = self.reader.Reload() |
|
242 |
reloaded = self.processor.reader.Reload()
|
|
243 | 243 |
if reloaded: |
244 | 244 |
logging.info("Reloaded ganeti config") |
245 | 245 |
else: |
... | ... | |
275 | 275 |
""" |
276 | 276 |
self.timer_handle = None |
277 | 277 |
try: |
278 |
reloaded = self.reader.Reload() |
|
278 |
reloaded = self.processor.reader.Reload()
|
|
279 | 279 |
except errors.ConfigurationError: |
280 | 280 |
# transform a ConfigurationError in a fatal error, that will cause confd |
281 | 281 |
# to quit. |
... | ... | |
320 | 320 |
""" |
321 | 321 |
mainloop = daemon.Mainloop() |
322 | 322 |
|
323 |
# confd-level SimpleConfigReader |
|
324 |
reader = ssconf.SimpleConfigReader() |
|
325 |
|
|
326 | 323 |
# Asyncronous confd UDP server |
327 |
processor = ConfdProcessor(reader)
|
|
324 |
processor = ConfdProcessor() |
|
328 | 325 |
server = ConfdAsyncUDPServer(options.bind_address, options.port, processor) |
329 | 326 |
|
330 | 327 |
# Configuration reloader |
331 |
reloader = ConfdConfigurationReloader(reader, mainloop)
|
|
328 |
reloader = ConfdConfigurationReloader(processor, mainloop)
|
|
332 | 329 |
|
333 | 330 |
mainloop.Run() |
334 | 331 |
|
b/lib/confd/server.py | ||
---|---|---|
34 | 34 |
from ganeti import errors |
35 | 35 |
from ganeti import utils |
36 | 36 |
from ganeti import serializer |
37 |
from ganeti import ssconf |
|
37 | 38 |
|
38 | 39 |
from ganeti.confd import querylib |
39 | 40 |
|
... | ... | |
41 | 42 |
class ConfdProcessor(object): |
42 | 43 |
"""A processor for confd requests. |
43 | 44 |
|
45 |
@ivar reader: confd SimpleConfigReader |
|
46 |
|
|
44 | 47 |
""" |
45 | 48 |
DISPATCH_TABLE = { |
46 | 49 |
constants.CONFD_REQ_PING: querylib.PingQuery, |
... | ... | |
49 | 52 |
querylib.InstanceIpToNodePrimaryIpQuery, |
50 | 53 |
} |
51 | 54 |
|
52 |
def __init__(self, reader):
|
|
55 |
def __init__(self): |
|
53 | 56 |
"""Constructor for ConfdProcessor |
54 | 57 |
|
55 |
@type reader: L{ssconf.SimpleConfigReader} |
|
56 |
@param reader: ConfigReader to use to access the config |
|
57 |
|
|
58 | 58 |
""" |
59 |
self.reader = reader
|
|
59 |
self.reader = ssconf.SimpleConfigReader()
|
|
60 | 60 |
self.hmac_key = utils.ReadFile(constants.HMAC_CLUSTER_KEY) |
61 | 61 |
assert \ |
62 | 62 |
not constants.CONFD_REQS.symmetric_difference(self.DISPATCH_TABLE), \ |
Also available in: Unified diff