Revision 1fce5219
b/lib/cmdlib.py | ||
---|---|---|
153 | 153 |
""" |
154 | 154 |
raise NotImplementedError |
155 | 155 |
|
156 |
def HooksCallBack(self, phase, hook_results, feedback_fn, lu_result): |
|
157 |
"""Notify the LU about the results of its hooks. |
|
158 |
|
|
159 |
This method is called every time a hooks phase is executed, and notifies |
|
160 |
the Logical Unit about the hooks' result. The LU can then use it to alter |
|
161 |
its result based on the hooks. By default the method does nothing and the |
|
162 |
previous result is passed back unchanged but any LU can define it if it |
|
163 |
wants to use the local cluster hook-scripts somehow. |
|
164 |
|
|
165 |
Args: |
|
166 |
phase: the hooks phase that has just been run |
|
167 |
hooks_results: the results of the multi-node hooks rpc call |
|
168 |
feedback_fn: function to send feedback back to the caller |
|
169 |
lu_result: the previous result this LU had, or None in the PRE phase. |
|
170 |
|
|
171 |
""" |
|
172 |
return lu_result |
|
173 |
|
|
156 | 174 |
|
157 | 175 |
class NoHooksLU(LogicalUnit): |
158 | 176 |
"""Simple LU which runs no hooks. |
b/lib/mcpu.py | ||
---|---|---|
127 | 127 |
lu = lu_class(self, op, self.cfg, self.sstore) |
128 | 128 |
lu.CheckPrereq() |
129 | 129 |
hm = HooksMaster(rpc.call_hooks_runner, self, lu) |
130 |
hm.RunPhase(constants.HOOKS_PHASE_PRE) |
|
130 |
h_results = hm.RunPhase(constants.HOOKS_PHASE_PRE) |
|
131 |
lu.HooksCallBack(constants.HOOKS_PHASE_PRE, |
|
132 |
h_results, self._feedback_fn, None) |
|
131 | 133 |
try: |
132 | 134 |
result = lu.Exec(self._feedback_fn) |
133 |
hm.RunPhase(constants.HOOKS_PHASE_POST) |
|
135 |
h_results = hm.RunPhase(constants.HOOKS_PHASE_POST) |
|
136 |
result = lu.HooksCallBack(constants.HOOKS_PHASE_POST, |
|
137 |
h_results, self._feedback_fn, result) |
|
134 | 138 |
finally: |
135 | 139 |
if lu.cfg is not None: |
136 | 140 |
# we use lu.cfg and not self.cfg as for init cluster, self.cfg |
... | ... | |
166 | 170 |
lu.CheckPrereq() |
167 | 171 |
#if do_hooks: |
168 | 172 |
# hm = HooksMaster(rpc.call_hooks_runner, self, lu) |
169 |
# hm.RunPhase(constants.HOOKS_PHASE_PRE) |
|
173 |
# h_results = hm.RunPhase(constants.HOOKS_PHASE_PRE) |
|
174 |
# lu.HooksCallBack(constants.HOOKS_PHASE_PRE, |
|
175 |
# h_results, self._feedback_fn, None) |
|
170 | 176 |
result = lu.Exec(self._feedback_fn) |
171 | 177 |
#if do_hooks: |
172 |
# hm.RunPhase(constants.HOOKS_PHASE_POST) |
|
178 |
# h_results = hm.RunPhase(constants.HOOKS_PHASE_POST) |
|
179 |
# result = lu.HooksCallBack(constants.HOOKS_PHASE_POST, |
|
180 |
# h_results, self._feedback_fn, result) |
|
173 | 181 |
return result |
174 | 182 |
|
175 | 183 |
def LogStep(self, current, total, message): |
Also available in: Unified diff