return timeout
-class OpExecCbBase: # pylint: disable-msg=W0232
+class OpExecCbBase: # pylint: disable=W0232
"""Base class for OpCode execution callbacks.
"""
"""
if not isinstance(op, opcodes.OpCode):
raise errors.ProgrammerError("Non-opcode instance passed"
- " to ExecOpcode")
+ " to ExecOpcode (%s)" % type(op))
lu_class = self.DISPATCH_TABLE.get(op.__class__, None)
if lu_class is None:
assert lu.needed_locks is not None, "needed_locks not set by LU"
try:
- return self._LockAndExecLU(lu, locking.LEVEL_INSTANCE, calc_timeout,
- priority)
+ result = self._LockAndExecLU(lu, locking.LEVEL_INSTANCE, calc_timeout,
+ priority)
finally:
if self._ec_id:
self.context.cfg.DropECReservations(self._ec_id)
finally:
self._cbs = None
+ resultcheck_fn = op.OP_RESULT
+ if not (resultcheck_fn is None or resultcheck_fn(result)):
+ logging.error("Expected opcode result matching %s, got %s",
+ resultcheck_fn, result)
+ raise errors.OpResultError("Opcode result does not match %s" %
+ resultcheck_fn)
+
+ return result
+
def Log(self, *args):
"""Forward call to feedback callback function.