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

Bug fix: Broadcast only to running nodes (test added).

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1974 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 95eab563
......@@ -266,7 +266,7 @@ class Application(object):
# send at most one non-empty notification packet per node
for node in self.nm.getIdentifiedList():
node_list = node_dict.get(node.getType(), [])
if node_list:
if node_list and node.isRunning():
node.notify(Packets.NotifyNodeInformation(node_list))
def broadcastPartitionChanges(self, cell_list):
......@@ -277,6 +277,8 @@ class Application(object):
ptid = self.pt.setNextID()
self.pt.log()
for node in self.nm.getIdentifiedList():
if not node.isRunning():
continue
if node.isClient() or node.isStorage() or node.isAdmin():
node.notify(Packets.NotifyPartitionChanges(ptid, cell_list))
......
......@@ -451,6 +451,22 @@ class StorageTests(NEOFunctionalTest):
self.assertEqual(len(self.neo.getStorageList()), 1)
self.neo.expectOudatedCells(number=0)
def testDropNodeWithOtherPending(self):
""" Ensure we can drop a node """
# start with one storage
(started, stopped) = self.__setup(storage_number=2, replicas=1,
pending_number=1, partitions=10)
self.__expectRunning(started[0])
self.__expectNotKnown(stopped[0])
self.neo.expectOudatedCells(number=0)
self.neo.expectClusterRunning()
# set the second storage in pending state and drop the first
stopped[0].start()
self.__expectPending(stopped[0])
self.neo.neoctl.dropNode(started[0].getUUID())
self.__expectNotKnown(started[0])
self.__expectPending(stopped[0])
if __name__ == "__main__":
unittest.main()
......@@ -62,6 +62,9 @@ class MasterAppTests(NeoTestBase):
master.setConnection(master_conn)
storage.setConnection(storage_conn)
client.setConnection(client_conn)
master.setRunning()
client.setRunning()
storage.setRunning()
self.app.nm.add(storage)
self.app.nm.add(client)
......@@ -96,6 +99,15 @@ class MasterAppTests(NeoTestBase):
self.checkNoPacketSent(master_conn)
self.checkNotifyNodeInformation(storage_conn)
# node not running, don't send informations
client.setPending()
self.app.broadcastNodesInformation([s_node])
# check conn
self.checkNotifyNodeInformation(client_conn)
self.checkNoPacketSent(master_conn)
self.checkNotifyNodeInformation(storage_conn)
if __name__ == '__main__':
unittest.main()
......
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