Commit bcb66fca authored by Iustin Pop's avatar Iustin Pop
Browse files

Encode the actual exception raised by LU execution

Currently, the actual exception raised during an LU execution (one of
OpPrereqError, OpExecError, HooksError, etc.) is lost because the code simply sets that to a str(err), and the code in
simply passes that string to OpExecError.

This patch moves to encoding the errors as per errors.EncodeError and
changes the cli code to parse and raise that (if possible).
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarMichael Hanselmann <>
parent 6956e9cd
......@@ -716,6 +716,7 @@ def PollJob(job_id, cl=None, feedback_fn=None):
if status == constants.OP_STATUS_SUCCESS:
has_ok = True
elif status == constants.OP_STATUS_ERROR:
if has_ok:
raise errors.OpExecError("partial failure (opcode %d): %s" %
(idx, msg))
......@@ -460,6 +460,9 @@ class _JobQueueWorker(workerpool.BaseWorker):
op.status = constants.OP_STATUS_ERROR
if isinstance(err, errors.GenericError):
op.result = errors.EncodeException(err)
op.result = str(err)
op.end_timestamp = TimeStampNow()"Op %s/%s: Error in opcode %s: %s",
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