Revision cd46f3b4
b/doc/hooks.rst | ||
---|---|---|
128 | 128 |
OP_REMOVE_NODE |
129 | 129 |
++++++++++++++ |
130 | 130 |
|
131 |
Removes a node from the cluster. |
|
131 |
Removes a node from the cluster. On the removed node the hooks are called |
|
132 |
during the execution of the operation and not after its completion. |
|
132 | 133 |
|
133 | 134 |
:directory: node-remove |
134 | 135 |
:env. vars: NODE_NAME |
135 | 136 |
:pre-execution: all existing nodes except the removed node |
136 |
:post-execution: all existing nodes except the removed node
|
|
137 |
:post-execution: all existing nodes |
|
137 | 138 |
|
138 | 139 |
OP_NODE_SET_PARAMS |
139 | 140 |
++++++++++++++++++ |
b/lib/cmdlib.py | ||
---|---|---|
2155 | 2155 |
"NODE_NAME": self.op.node_name, |
2156 | 2156 |
} |
2157 | 2157 |
all_nodes = self.cfg.GetNodeList() |
2158 |
all_nodes.remove(self.op.node_name) |
|
2158 |
if self.op.node_name in all_nodes: |
|
2159 |
all_nodes.remove(self.op.node_name) |
|
2159 | 2160 |
return env, all_nodes, all_nodes |
2160 | 2161 |
|
2161 | 2162 |
def CheckPrereq(self): |
... | ... | |
2198 | 2199 |
|
2199 | 2200 |
self.context.RemoveNode(node.name) |
2200 | 2201 |
|
2202 |
# Run post hooks on the node before it's removed |
|
2203 |
hm = self.proc.hmclass(self.rpc.call_hooks_runner, self) |
|
2204 |
try: |
|
2205 |
h_results = hm.RunPhase(constants.HOOKS_PHASE_POST, [node.name]) |
|
2206 |
finally: |
|
2207 |
res = h_results[node.name] |
|
2208 |
if res.fail_msg: |
|
2209 |
if not res.offline: |
|
2210 |
self.LogError("Failed to start hooks on %s: %s" % |
|
2211 |
(node.name, res.fail_msg)) |
|
2212 |
for script, hkr, output in res.payload: |
|
2213 |
if hkr != constants.HKR_FAIL: |
|
2214 |
continue |
|
2215 |
if output: |
|
2216 |
self.LogWarning("On %s script %s failed, output: %s" % |
|
2217 |
(node.name, script, output)) |
|
2218 |
else: |
|
2219 |
self.LogWarning("On %s script %s failed (no output)." % |
|
2220 |
(node.name, script)) |
|
2221 |
|
|
2201 | 2222 |
result = self.rpc.call_node_leave_cluster(node.name) |
2202 | 2223 |
msg = result.fail_msg |
2203 | 2224 |
if msg: |
b/lib/mcpu.py | ||
---|---|---|
111 | 111 |
self._feedback_fn = None |
112 | 112 |
self.exclusive_BGL = False |
113 | 113 |
self.rpc = rpc.RpcRunner(context.cfg) |
114 |
self.hmclass = HooksMaster |
|
114 | 115 |
|
115 | 116 |
def _ExecLU(self, lu): |
116 | 117 |
"""Logical Unit execution sequence. |
Also available in: Unified diff