]> git.proxmox.com Git - mirror_qemu.git/commit - blockjob.c
blockjobs: add prepare callback
authorJohn Snow <jsnow@redhat.com>
Sat, 10 Mar 2018 08:27:40 +0000 (03:27 -0500)
committerKevin Wolf <kwolf@redhat.com>
Mon, 19 Mar 2018 11:01:24 +0000 (12:01 +0100)
commit2da4617a5457a6542b0ff702caa983e78d6fe5d6
tree08b6983b1b702735b6b9eb320620627ff4d4237c
parentefe4d4b7b2f59bb8cdaa8651b832b8153ec24ce9
blockjobs: add prepare callback

Some jobs upon finalization may need to perform some work that can
still fail. If these jobs are part of a transaction, it's important
that these callbacks fail the entire transaction.

We allow for a new callback in addition to commit/abort/clean that
allows us the opportunity to have fairly late-breaking failures
in the transactional process.

The expected flow is:

- All jobs in a transaction converge to the PENDING state,
  added in a forthcoming commit.
- Upon being finalized, either automatically or explicitly
  by the user, jobs prepare to complete.
- If any job fails preparation, all jobs call .abort.
- Otherwise, they succeed and call .commit.

Signed-off-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
blockjob.c
include/block/blockjob_int.h