From 75f710599f2c35bad1a724d0243f372d05cc07ed Mon Sep 17 00:00:00 2001 From: John Snow Date: Sat, 10 Mar 2018 03:27:36 -0500 Subject: blockjobs: add block_job_dismiss For jobs that have reached their CONCLUDED state, prior to having their last reference put down (meaning jobs that have completed successfully, unsuccessfully, or have been canceled), allow the user to dismiss the job's lingering status report via block-job-dismiss. This gives management APIs the chance to conclusively determine if a job failed or succeeded, even if the event broadcast was missed. Note: block_job_do_dismiss and block_job_decommission happen to do exactly the same thing, but they're called from different semantic contexts, so both aliases are kept to improve readability. Note 2: Don't worry about the 0x04 flag definition for AUTO_DISMISS, she has a friend coming in a future patch to fill the hole where 0x02 is. Verbs: Dismiss: operates on CONCLUDED jobs only. Signed-off-by: John Snow Signed-off-by: Kevin Wolf --- include/block/blockjob.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include/block') diff --git a/include/block/blockjob.h b/include/block/blockjob.h index df0a9773d1..c535829b46 100644 --- a/include/block/blockjob.h +++ b/include/block/blockjob.h @@ -142,6 +142,9 @@ typedef struct BlockJob { /** Current state; See @BlockJobStatus for details. */ BlockJobStatus status; + /** True if this job should automatically dismiss itself */ + bool auto_dismiss; + BlockJobTxn *txn; QLIST_ENTRY(BlockJob) txn_list; } BlockJob; @@ -151,6 +154,8 @@ typedef enum BlockJobCreateFlags { BLOCK_JOB_DEFAULT = 0x00, /* BlockJob is not QMP-created and should not send QMP events */ BLOCK_JOB_INTERNAL = 0x01, + /* BlockJob requires manual dismiss step */ + BLOCK_JOB_MANUAL_DISMISS = 0x04, } BlockJobCreateFlags; /** @@ -234,6 +239,15 @@ void block_job_cancel(BlockJob *job); */ void block_job_complete(BlockJob *job, Error **errp); +/** + * block_job_dismiss: + * @job: The job to be dismissed. + * @errp: Error object. + * + * Remove a concluded job from the query list. + */ +void block_job_dismiss(BlockJob **job, Error **errp); + /** * block_job_query: * @job: The job to get information about. -- cgit v1.2.3