Commit cbde95b6 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Add a log method on the node manager to help debugging.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@748 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 1a330a1d
...@@ -20,8 +20,9 @@ import logging ...@@ -20,8 +20,9 @@ import logging
from neo import protocol from neo import protocol
from neo.protocol import RUNNING_STATE, TEMPORARILY_DOWN_STATE, DOWN_STATE, \ from neo.protocol import RUNNING_STATE, TEMPORARILY_DOWN_STATE, DOWN_STATE, \
BROKEN_STATE, PENDING_STATE, MASTER_NODE_TYPE, STORAGE_NODE_TYPE, \ BROKEN_STATE, PENDING_STATE, HIDDEN_STATE, MASTER_NODE_TYPE, \
CLIENT_NODE_TYPE, VALID_NODE_STATE_LIST, ADMIN_NODE_TYPE STORAGE_NODE_TYPE, CLIENT_NODE_TYPE, ADMIN_NODE_TYPE, \
VALID_NODE_STATE_LIST, ADMIN_NODE_TYPE
from neo.util import dump from neo.util import dump
class Node(object): class Node(object):
...@@ -170,3 +171,24 @@ class NodeManager(object): ...@@ -170,3 +171,24 @@ class NodeManager(object):
for node in self.getNodeList(): for node in self.getNodeList():
if filter is not None and filter(node): if filter is not None and filter(node):
self.remove(node) self.remove(node)
def log(self):
node_state_dict = { RUNNING_STATE: 'R',
TEMPORARILY_DOWN_STATE: 'T',
DOWN_STATE: 'D',
BROKEN_STATE: 'B',
HIDDEN_STATE: 'H',
PENDING_STATE: 'P'}
node_type_dict = {
MASTER_NODE_TYPE: 'M',
STORAGE_NODE_TYPE: 'S',
CLIENT_NODE_TYPE: 'C',
ADMIN_NODE_TYPE: 'A',
}
for uuid, node in sorted(self.uuid_dict.items()):
args = (
dump(uuid),
node_type_dict[node.getNodeType()],
node_state_dict[node.getState()]
)
logging.debug('nm: %s : %s/%s' % args)
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