Commit eb1742d5 authored by Guido Trotter's avatar Guido Trotter
Browse files

LURemoveNode, promote nodes to master candidates

If after the remove node there are not enough master candidates, we'll
try to promote them.

Reviewed-by: imsnah
parent b04285f2
...@@ -1622,6 +1622,24 @@ class LURemoveNode(LogicalUnit): ...@@ -1622,6 +1622,24 @@ class LURemoveNode(LogicalUnit):
self.rpc.call_node_leave_cluster( self.rpc.call_node_leave_cluster(
# Promote nodes to master candidate as needed
cp_size = self.cfg.GetClusterInfo().candidate_pool_size
node_info = self.cfg.GetAllNodesInfo().values()
num_candidates = len([n for n in node_info
if n.master_candidate])
num_nodes = len(node_info)
for node in node_info:
if num_candidates >= cp_size or num_candidates >= num_nodes:
if node.master_candidate:
node.master_candidate = True
self.LogInfo("Promoting node %s to master candidate",
num_candidates += 1
class LUQueryNodes(NoHooksLU): class LUQueryNodes(NoHooksLU):
"""Logical unit for querying nodes. """Logical unit for querying nodes.
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