Commit 15744c7a authored by Grégory Wisniewski's avatar Grégory Wisniewski

Bug fix: Admin crash with an unknown storage node.

Test case (added):
- Start a cluster with two storages
- Restart the whole cluster except one storage
- Allow recover from existing storage
- The admin crash when getting the new partition table because it doesn't
known the second (down) node.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1975 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent bddc1802
......@@ -136,11 +136,15 @@ class RecoveryManager(MasterHandler):
'for %s', dump(uuid), dump(self.target_uuid))
return
# load unknown storage nodes
new_nodes = []
for offset, row in row_list:
for uuid, state in row:
node = app.nm.getByUUID(uuid)
if node is None:
app.nm.createStorage(uuid=uuid)
new_nodes.append(app.nm.createStorage(uuid=uuid))
# notify about new nodes
if new_nodes:
self.app.broadcastNodesInformation(new_nodes)
# load partition in memory
try:
self.app.pt.load(ptid, row_list, self.app.nm)
......
......@@ -468,5 +468,22 @@ class StorageTests(NEOFunctionalTest):
self.__expectNotKnown(started[0])
self.__expectPending(stopped[0])
def testRestartWithMissingStorage(self):
# start a cluster with a replica
(started, stopped) = self.__setup(storage_number=2, replicas=1,
pending_number=0, partitions=10)
self.__expectRunning(started[0])
self.__expectRunning(started[1])
self.neo.expectOudatedCells(number=0)
self.neo.expectClusterRunning()
# restart it with one storage only
self.neo.stop()
self.neo.start(except_storages=(started[1], ))
self.__expectRunning(started[0])
self.__expectUnknown(started[1])
self.neo.expectClusterRunning()
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