Commit c32895c6 authored by Vincent Pelletier's avatar Vincent Pelletier

Factorise node acceptance logging.

parent 4640bf1d
...@@ -478,12 +478,12 @@ class Application(object): ...@@ -478,12 +478,12 @@ class Application(object):
# always accept admin nodes # always accept admin nodes
node_ctor = self.nm.createAdmin node_ctor = self.nm.createAdmin
handler = administration.AdministrationHandler(self) handler = administration.AdministrationHandler(self)
logging.info('Accept an admin %s', dump(uuid)) human_readable_node_type = 'n admin '
elif node_type == NodeTypes.MASTER: elif node_type == NodeTypes.MASTER:
# always put other master in waiting state # always put other master in waiting state
node_ctor = self.nm.createMaster node_ctor = self.nm.createMaster
handler = secondary.SecondaryMasterHandler(self) handler = secondary.SecondaryMasterHandler(self)
logging.info('Accept a master %s', dump(uuid)) human_readable_node_type = ' master '
elif node_type == NodeTypes.CLIENT: elif node_type == NodeTypes.CLIENT:
# refuse any client before running # refuse any client before running
if self.cluster_state != ClusterStates.RUNNING: if self.cluster_state != ClusterStates.RUNNING:
...@@ -491,16 +491,17 @@ class Application(object): ...@@ -491,16 +491,17 @@ class Application(object):
raise NotReadyError raise NotReadyError
node_ctor = self.nm.createClient node_ctor = self.nm.createClient
handler = client.ClientServiceHandler(self) handler = client.ClientServiceHandler(self)
logging.info('Accept a client %s', dump(uuid)) human_readable_node_type = ' client '
elif node_type == NodeTypes.STORAGE: elif node_type == NodeTypes.STORAGE:
node_ctor = self.nm.createStorage node_ctor = self.nm.createStorage
manager = self._current_manager manager = self._current_manager
if manager is None: if manager is None:
manager = self manager = self
(uuid, state, handler) = manager.identifyStorageNode(uuid, node) (uuid, state, handler) = manager.identifyStorageNode(uuid, node)
logging.info('Accept a storage %s (%s)', dump(uuid), state) human_readable_node_type = ' storage (%s) ' % (state, )
else: else:
raise NotImplementedError(node_type) raise NotImplementedError(node_type)
logging.info('Accept a' + human_readable_node_type + dump(uuid))
return (uuid, node, state, handler, node_ctor) return (uuid, node, state, handler, node_ctor)
def onTransactionCommitted(self, txn): def onTransactionCommitted(self, txn):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment