blockjobs: add block-job-finalize

Instead of automatically transitioning from PENDING to CONCLUDED, gate
the .prepare() and .commit() phases behind an explicit acknowledgement
provided by the QMP monitor if auto_finalize = false has been requested.

This allows us to perform graph changes in prepare and/or commit so that
graph changes do not occur autonomously without knowledge of the
controlling management layer.

Transactions that have reached the "PENDING" state together can all be
moved to invoke their finalization methods by issuing block_job_finalize
to any one job in the transaction.

Jobs in a transaction with mixed job->auto_finalize settings will all
remain stuck in the "PENDING" state, as if the entire transaction was
specified with auto_finalize = false. Jobs that specified
auto_finalize = true, however, will still not emit the PENDING event.

Signed-off-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
John Snow 2018-03-10 03:27:43 -05:00 committed by Kevin Wolf
parent 5f241594c4
commit 11b61fbc0d
5 changed files with 98 additions and 17 deletions

View file

@ -244,6 +244,23 @@ void block_job_cancel(BlockJob *job);
*/
void block_job_complete(BlockJob *job, Error **errp);
/**
* block_job_finalize:
* @job: The job to fully commit and finish.
* @errp: Error object.
*
* For jobs that have finished their work and are pending
* awaiting explicit acknowledgement to commit their work,
* This will commit that work.
*
* FIXME: Make the below statement universally true:
* For jobs that support the manual workflow mode, all graph
* changes that occur as a result will occur after this command
* and before a successful reply.
*/
void block_job_finalize(BlockJob *job, Error **errp);
/**
* block_job_dismiss:
* @job: The job to be dismissed.