Revision b2751b57
b/lib/mcpu.py | ||
---|---|---|
191 | 191 |
|
192 | 192 |
return result |
193 | 193 |
|
194 |
def ChainOpCode(self, op): |
|
195 |
"""Chain and execute an opcode. |
|
196 |
|
|
197 |
This is used by LUs when they need to execute a child LU. |
|
198 |
|
|
199 |
Args: |
|
200 |
- opcode: the opcode to be executed |
|
201 |
|
|
202 |
""" |
|
203 |
if not isinstance(op, opcodes.OpCode): |
|
204 |
raise errors.ProgrammerError("Non-opcode instance passed" |
|
205 |
" to ExecOpcode") |
|
206 |
|
|
207 |
lu_class = self.DISPATCH_TABLE.get(op.__class__, None) |
|
208 |
if lu_class is None: |
|
209 |
raise errors.OpCodeUnknown("Unknown opcode") |
|
210 |
|
|
211 |
if lu_class.REQ_BGL and not self.exclusive_BGL: |
|
212 |
raise errors.ProgrammerError("LUs which require the BGL cannot" |
|
213 |
" be chained to granular ones.") |
|
214 |
|
|
215 |
assert lu_class.REQ_BGL, "ChainOpCode is still BGL-only" |
|
216 |
|
|
217 |
if lu_class.REQ_WSSTORE: |
|
218 |
sstore = ssconf.WritableSimpleStore() |
|
219 |
else: |
|
220 |
sstore = ssconf.SimpleStore() |
|
221 |
|
|
222 |
#do_hooks = lu_class.HPATH is not None |
|
223 |
lu = lu_class(self, op, self.context, sstore) |
|
224 |
lu.CheckPrereq() |
|
225 |
#if do_hooks: |
|
226 |
# hm = HooksMaster(rpc.call_hooks_runner, self, lu) |
|
227 |
# h_results = hm.RunPhase(constants.HOOKS_PHASE_PRE) |
|
228 |
# lu.HooksCallBack(constants.HOOKS_PHASE_PRE, |
|
229 |
# h_results, self._feedback_fn, None) |
|
230 |
result = lu.Exec(self._feedback_fn) |
|
231 |
#if do_hooks: |
|
232 |
# h_results = hm.RunPhase(constants.HOOKS_PHASE_POST) |
|
233 |
# result = lu.HooksCallBack(constants.HOOKS_PHASE_POST, |
|
234 |
# h_results, self._feedback_fn, result) |
|
235 |
return result |
|
236 |
|
|
237 | 194 |
def LogStep(self, current, total, message): |
238 | 195 |
"""Log a change in LU execution progress. |
239 | 196 |
|
Also available in: Unified diff