job: Add job_event_*()

Go through the Job layer in order to send QMP events. For the moment,
these functions only call a notifier in the BlockJob layer that sends
the existing commands.

This uses notifiers rather than JobDriver callbacks because internal
users of jobs won't receive QMP events, but might still be interested
in getting notified for the events.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
Kevin Wolf 2018-04-23 18:04:57 +02:00
parent 5d4f376998
commit 139a9f020d
4 changed files with 73 additions and 14 deletions

View file

@ -82,6 +82,15 @@ typedef struct BlockJob {
/** Block other operations when block job is running */
Error *blocker;
/** Called when a cancelled job is finalised. */
Notifier finalize_cancelled_notifier;
/** Called when a successfully completed job is finalised. */
Notifier finalize_completed_notifier;
/** Called when the job transitions to PENDING */
Notifier pending_notifier;
/** BlockDriverStates that are involved in this block job */
GSList *nodes;