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

Add drop node command to remove a storage node and drop it from the partition

table (alias to 'set node <uuid> DOWN 1')


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@921 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent bc6d6810
...@@ -123,13 +123,25 @@ def printPTAction(options): ...@@ -123,13 +123,25 @@ def printPTAction(options):
def startCluster(options): def startCluster(options):
""" """
Allow it to leave the recovery stage and accept the current partition table, Allow it to leave the recovery stage and accept the current partition
or make an empty if nothing was found. table, or make an empty if nothing was found.
Parameter: Cluster name Parameter: Cluster name
""" """
name = options.pop(0) name = options.pop(0)
return protocol.setClusterState(name, protocol.VERIFYING) return protocol.setClusterState(name, protocol.VERIFYING)
def dropNode(options):
"""
Drop one or more storage node from the partition table. Its content
is definitely lost. Be carefull because currently there is no check
about the cluster operational status, so you can drop a node with
non-replicated data.
Parameter: UUID
"""
uuid_list = [bin(opt) for opt in options]
return protocol.setNodeState(uuid_list, protocol.DOWN_STATE, 1)
action_dict = { action_dict = {
'print': { 'print': {
'pt': printPTAction, 'pt': printPTAction,
...@@ -140,10 +152,11 @@ action_dict = { ...@@ -140,10 +152,11 @@ action_dict = {
'node': setNodeAction, 'node': setNodeAction,
'cluster': setClusterAction, 'cluster': setClusterAction,
}, },
'add': addAction,
'start': { 'start': {
'cluster': startCluster, 'cluster': startCluster,
} },
'add': addAction,
'drop': dropNode,
} }
class Application(object): class Application(object):
......
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