]> Git Repo - qemu.git/commit - blockjob.c
blockjob: report a better error message
authorStefano Garzarella <[email protected]>
Thu, 25 Feb 2021 10:36:33 +0000 (11:36 +0100)
committerKevin Wolf <[email protected]>
Mon, 8 Mar 2021 13:55:18 +0000 (14:55 +0100)
commit3b6ad6230e902168f63315e47933025b016f546e
treea47904478f8652e83d76cea0a127ff68ee229670
parent4aa6fc69e8d2d64d37af382854ff5b12675248c2
blockjob: report a better error message

When a block job fails, we report strerror(-job->job.ret) error
message, also if the job set an error object.
Let's report a better error message using error_get_pretty(job->job.err).

If an error object was not set, strerror(-job->ret) is used as fallback,
as explained in include/qemu/job.h:

typedef struct Job {
    ...
    /**
     * Error object for a failed job.
     * If job->ret is nonzero and an error object was not set, it will be set
     * to strerror(-job->ret) during job_completed.
     */
    Error *err;
}

In block_job_query() there can be a transient where 'job.err' is not set
by a scheduled bottom half. In that case we use strerror(-job->ret) as it
was before.

Suggested-by: Kevin Wolf <[email protected]>
Signed-off-by: Stefano Garzarella <[email protected]>
Message-Id: <20210225103633[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
blockjob.c
This page took 0.025445 seconds and 4 git commands to generate.