mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
job: Add error message for failing jobs
So far we relied on job->ret and strerror() to produce an error message for failed jobs. Not surprisingly, this tends to result in completely useless messages. This adds a Job.error field that can contain an error string for a failing job, and a parameter to job_completed() that sets the field. As a default, if NULL is passed, we continue to use strerror(job->ret). All existing callers are changed to pass NULL. They can be improved in separate patches. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Jeff Cody <jcody@redhat.com>
This commit is contained in:
parent
4a5f2779ba
commit
1266c9b9f5
10 changed files with 29 additions and 17 deletions
|
@ -321,7 +321,7 @@ static void backup_complete(Job *job, void *opaque)
|
|||
{
|
||||
BackupCompleteData *data = opaque;
|
||||
|
||||
job_completed(job, data->ret);
|
||||
job_completed(job, data->ret, NULL);
|
||||
g_free(data);
|
||||
}
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ static void commit_complete(Job *job, void *opaque)
|
|||
* bdrv_set_backing_hd() to fail. */
|
||||
block_job_remove_all_bdrv(bjob);
|
||||
|
||||
job_completed(job, ret);
|
||||
job_completed(job, ret, NULL);
|
||||
g_free(data);
|
||||
|
||||
/* If bdrv_drop_intermediate() didn't already do that, remove the commit
|
||||
|
|
|
@ -581,7 +581,7 @@ static void mirror_exit(Job *job, void *opaque)
|
|||
blk_set_perm(bjob->blk, 0, BLK_PERM_ALL, &error_abort);
|
||||
blk_insert_bs(bjob->blk, mirror_top_bs, &error_abort);
|
||||
|
||||
job_completed(job, data->ret);
|
||||
job_completed(job, data->ret, NULL);
|
||||
|
||||
g_free(data);
|
||||
bdrv_drained_end(src);
|
||||
|
|
|
@ -93,7 +93,7 @@ out:
|
|||
}
|
||||
|
||||
g_free(s->backing_file_str);
|
||||
job_completed(job, data->ret);
|
||||
job_completed(job, data->ret, NULL);
|
||||
g_free(data);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue