Commit cd46f3b4 authored by Luca Bigliardi's avatar Luca Bigliardi
Browse files

node-remove post on removed node

Run post phase of node-remove on the removed node as well.
Signed-off-by: default avatarLuca Bigliardi <>
Reviewed-by: default avatarIustin Pop <>
parent 6ef2dc74
......@@ -128,12 +128,13 @@ Adds a node to the cluster.
Removes a node from the cluster.
Removes a node from the cluster. On the removed node the hooks are called
during the execution of the operation and not after its completion.
:directory: node-remove
:env. vars: NODE_NAME
:pre-execution: all existing nodes except the removed node
:post-execution: all existing nodes except the removed node
:post-execution: all existing nodes
......@@ -2155,7 +2155,8 @@ class LURemoveNode(LogicalUnit):
"NODE_NAME": self.op.node_name,
all_nodes = self.cfg.GetNodeList()
if self.op.node_name in all_nodes:
return env, all_nodes, all_nodes
def CheckPrereq(self):
......@@ -2198,6 +2199,26 @@ class LURemoveNode(LogicalUnit):
# Run post hooks on the node before it's removed
hm = self.proc.hmclass(self.rpc.call_hooks_runner, self)
h_results = hm.RunPhase(constants.HOOKS_PHASE_POST, [])
res = h_results[]
if res.fail_msg:
if not res.offline:
self.LogError("Failed to start hooks on %s: %s" %
(, res.fail_msg))
for script, hkr, output in res.payload:
if hkr != constants.HKR_FAIL:
if output:
self.LogWarning("On %s script %s failed, output: %s" %
(, script, output))
self.LogWarning("On %s script %s failed (no output)." %
(, script))
result = self.rpc.call_node_leave_cluster(
msg = result.fail_msg
if msg:
......@@ -111,6 +111,7 @@ class Processor(object):
self._feedback_fn = None
self.exclusive_BGL = False
self.rpc = rpc.RpcRunner(context.cfg)
self.hmclass = HooksMaster
def _ExecLU(self, lu):
"""Logical Unit execution sequence.
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