diff options
author | Kevin Wolf <kwolf@redhat.com> | 2018-04-23 12:24:16 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2018-05-23 14:30:50 +0200 |
commit | 3453d97243c72988c89a0105fa9546890eae7bd4 (patch) | |
tree | b1319fc9423528d2bcb84e8378e877f25e6bd248 /job.c | |
parent | b69f777dd9ba992fdd35828a90eefcd88c0ec332 (diff) |
job: Move .complete callback to Job
This moves the .complete callback that tells a READY job to complete
from BlockJobDriver to JobDriver. The wrapper function job_complete()
doesn't require anything block job specific any more and can be moved
to Job.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'job.c')
-rw-r--r-- | job.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -556,6 +556,22 @@ int job_finalize_single(Job *job) return 0; } +void job_complete(Job *job, Error **errp) +{ + /* Should not be reachable via external interface for internal jobs */ + assert(job->id); + if (job_apply_verb(job, JOB_VERB_COMPLETE, errp)) { + return; + } + if (job->pause_count || job_is_cancelled(job) || !job->driver->complete) { + error_setg(errp, "The active block job '%s' cannot be completed", + job->id); + return; + } + + job->driver->complete(job, errp); +} + typedef struct { Job *job; |