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

Remove 'master_node_list' attribute on apps.

There is no need to store the master address list out of the node manager, any master found in configuration is loaded in the node manager and can be retreived by it if needed.
Remove redundant intialization code in test module, master nodes are created at app initialization.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1484 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 6cdbf741
......@@ -55,16 +55,15 @@ class Application(object):
# always use default connector for now
self.connector_handler = getConnectorHandler()
# Internal attributes.
self.em = EventManager()
self.nm = NodeManager()
self.name = config.getCluster()
self.server = config.getBind()
self.master_node_list = config.getMasters()
self.master_addresses = config.getMasters()
logging.debug('IP address is %s, port is %d', *(self.server))
logging.debug('master nodes are %s', self.master_node_list)
# Internal attributes.
self.em = EventManager()
self.nm = NodeManager()
# The partition table is initialized after getting the number of
# partitions.
......@@ -113,8 +112,9 @@ class Application(object):
nm = self.nm
nm.clear()
self.cluster_state = None
for address in self.master_node_list:
nm.createMaster(address=address)
for address in self.master_addresses:
self.nm.createMaster(address=address)
# search, find, connect and identify to the primary master
bootstrap = BootstrapManager(self, self.name, NodeTypes.ADMIN,
......
......@@ -252,9 +252,7 @@ class Application(object):
self.trying_master_node = None
# load master node list
self.master_node_list = parseMasterList(master_nodes)
logging.debug('master nodes are %s', self.master_node_list)
for address in self.master_node_list:
for address in parseMasterList(master_nodes):
self.nm.createMaster(address=address)
# no self-assigned UUID, primary master will supply us one
......
......@@ -46,18 +46,19 @@ class Application(object):
# always use default connector for now
self.connector_handler = getConnectorHandler()
self.name = config.getCluster()
self.server = config.getBind()
self.master_node_list = config.getMasters()
logging.debug('IP address is %s, port is %d', *(self.server))
logging.debug('master nodes are %s', self.master_node_list)
# Internal attributes.
self.em = EventManager()
self.nm = NodeManager()
self.tm = TransactionManager()
self.name = config.getCluster()
self.server = config.getBind()
for address in config.getMasters():
self.nm.createMaster(address=address)
logging.debug('IP address is %s, port is %d', *(self.server))
# Partition table
replicas, partitions = config.getReplicas(), config.getPartitions()
if replicas < 0:
......@@ -98,8 +99,6 @@ class Application(object):
def run(self):
"""Make sure that the status is sane and start a loop."""
for address in self.master_node_list:
self.nm.createMaster(address=address)
# Make a listening port.
self.listening_conn = ListeningConnection(self.em, None,
......
......@@ -43,19 +43,19 @@ class Application(object):
# set the cluster name
self.name = config.getCluster()
# set the bind address
self.server = config.getBind()
logging.debug('IP address is %s, port is %d', *(self.server))
# load master node list
self.master_node_list = config.getMasters()
logging.debug('master nodes are %s', self.master_node_list)
# Internal attributes.
self.em = EventManager()
self.nm = NodeManager()
self.dm = buildDatabaseManager(config.getAdapter(), config.getDatabase())
# load master nodes
for address in config.getMasters():
self.nm.createMaster(address=address)
# set the bind address
self.server = config.getBind()
logging.debug('IP address is %s, port is %d', *(self.server))
# The partition table is initialized after getting the number of
# partitions.
self.pt = None
......@@ -132,9 +132,6 @@ class Application(object):
if len(self.name) == 0:
raise RuntimeError, 'cluster name must be non-empty'
for address in self.master_node_list:
self.nm.createMaster(address=address)
# Make a listening port
handler = identification.IdentificationHandler(self)
self.listening_conn = ListeningConnection(self.em, handler,
......
......@@ -34,8 +34,6 @@ class MasterClientHandlerTests(NeoTestBase):
self.app.em = Mock({"getConnectionList" : []})
self.app.loid = '\0' * 8
self.app.tm.setLastTID('\0' * 8)
for address in self.app.master_node_list:
self.app.nm.createMaster(address=address)
self.service = ClientServiceHandler(self.app)
# define some variable to simulate client and storage node
self.client_port = 11022
......
......@@ -43,8 +43,6 @@ class MasterClientElectionTests(NeoTestBase):
self.app = Application(config)
self.app.pt.clear()
self.app.em = Mock({"getConnectionList" : []})
for address in self.app.master_node_list:
self.app.nm.createMaster(address=address)
self.election = ClientElectionHandler(self.app)
self.app.unconnected_master_node_set = set()
self.app.negotiating_master_node_set = set()
......@@ -245,8 +243,6 @@ class MasterServerElectionTests(NeoTestBase):
self.app = Application(config)
self.app.pt.clear()
self.app.em = Mock({"getConnectionList" : []})
for address in self.app.master_node_list:
self.app.nm.createMaster(address=address)
self.election = ServerElectionHandler(self.app)
self.app.unconnected_master_node_set = set()
self.app.negotiating_master_node_set = set()
......
......@@ -30,8 +30,6 @@ class MasterRecoveryTests(NeoTestBase):
config = self.getMasterConfiguration()
self.app = Application(config)
self.app.pt.clear()
for address in self.app.master_node_list:
self.app.nm.createMaster(address=address)
self.recovery = RecoveryHandler(self.app)
self.app.unconnected_master_node_set = set()
self.app.negotiating_master_node_set = set()
......
......@@ -35,8 +35,6 @@ class MasterStorageHandlerTests(NeoTestBase):
self.app.pt.clear()
self.app.pt.setID(pack('!Q', 1))
self.app.em = Mock({"getConnectionList" : []})
for address in self.app.master_node_list:
self.app.nm.createMaster(address=address)
self.service = StorageServiceHandler(self.app)
self.client_handler = ClientServiceHandler(self.app)
# define some variable to simulate client and storage node
......
......@@ -33,8 +33,6 @@ class MasterVerificationTests(NeoTestBase):
config = self.getMasterConfiguration()
self.app = Application(config)
self.app.pt.clear()
for address in self.app.master_node_list:
self.app.nm.createMaster(address=address)
self.verification = VerificationHandler(self.app)
self.app.unconnected_master_node_set = set()
self.app.negotiating_master_node_set = set()
......
......@@ -47,8 +47,6 @@ class StorageClientHandlerTests(NeoTestBase):
self.app.store_lock_dict = {}
self.app.load_lock_dict = {}
self.app.event_queue = deque()
for address in self.app.master_node_list:
self.app.nm.createMaster(address=address)
# handler
self.operation = ClientOperationHandler(self.app)
# set pmn
......
......@@ -47,8 +47,6 @@ class StorageMasterHandlerTests(NeoTestBase):
self.app.store_lock_dict = {}
self.app.load_lock_dict = {}
self.app.event_queue = deque()
for address in self.app.master_node_list:
self.app.nm.createMaster(address=address)
# handler
self.operation = MasterOperationHandler(self.app)
# set pmn
......
......@@ -45,8 +45,6 @@ class StorageStorageHandlerTests(NeoTestBase):
self.app.store_lock_dict = {}
self.app.load_lock_dict = {}
self.app.event_queue = deque()
for address in self.app.master_node_list:
self.app.nm.createMaster(address=address)
# handler
self.operation = StorageOperationHandler(self.app)
# set pmn
......
......@@ -29,8 +29,6 @@ class BootstrapManagerTests(NeoTestBase):
# create an application object
config = self.getStorageConfiguration()
self.app = Application(config)
for address in self.app.master_node_list:
self.app.nm.createMaster(address=address)
self.bootstrap = BootstrapManager(self.app, 'main', NodeTypes.STORAGE)
# define some variable to simulate client and storage node
self.master_port = 10010
......
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