# -*- Mode: Python -*-
+# vim: filetype=python
##
# == Background jobs
#
# @backup: drive backup job type, see "drive-backup"
#
+# @create: image creation job type, see "blockdev-create" (since 3.0)
+#
+# @amend: image options amend job type, see "x-blockdev-amend" (since 5.1)
+#
# Since: 1.7
##
{ 'enum': 'JobType',
- 'data': ['commit', 'stream', 'mirror', 'backup'] }
+ 'data': ['commit', 'stream', 'mirror', 'backup', 'create', 'amend'] }
##
# @JobStatus:
# the last job in a transaction.
#
# @pending: The job has finished its work, but has finalization steps that it
-# needs to make prior to completing. These changes may require
-# manual intervention by the management process if manual was set
-# to true. These changes may still fail.
+# needs to make prior to completing. These changes will require
+# manual intervention via @job-finalize if auto-finalize was set to
+# false. These pending changes may still fail.
#
# @aborting: The job is in the process of being aborted, and will finish with
# an error. The job will afterwards report that it is @concluded.
# This status may not be visible to the management process.
#
-# @concluded: The job has finished all work. If manual was set to true, the job
-# will remain in the query list until it is dismissed.
+# @concluded: The job has finished all work. If auto-dismiss was set to false,
+# the job will remain in the query list until it is dismissed via
+# @job-dismiss.
#
# @null: The job is in the process of being dismantled. This state should not
# ever be visible externally.
#
# Represents command verbs that can be applied to a job.
#
-# @cancel: see @block-job-cancel
+# @cancel: see @job-cancel
#
-# @pause: see @block-job-pause
+# @pause: see @job-pause
#
-# @resume: see @block-job-resume
+# @resume: see @job-resume
#
# @set-speed: see @block-job-set-speed
#
-# @complete: see @block-job-complete
+# @complete: see @job-complete
#
-# @dismiss: see @block-job-dismiss
+# @dismiss: see @job-dismiss
#
-# @finalize: see @block-job-finalize
+# @finalize: see @job-finalize
#
# Since: 2.12
##
# @id: The job identifier
# @status: The new job status
#
-# Since: 2.13
+# Since: 3.0
##
{ 'event': 'JOB_STATUS_CHANGE',
'data': { 'id': 'str',
#
# @id: The job identifier.
#
-# Since: 2.13
+# Since: 3.0
##
{ 'command': 'job-pause', 'data': { 'id': 'str' } }
#
# @id : The job identifier.
#
-# Since: 2.13
+# Since: 3.0
##
{ 'command': 'job-resume', 'data': { 'id': 'str' } }
#
# @id: The job identifier.
#
-# Since: 2.13
+# Since: 3.0
##
{ 'command': 'job-cancel', 'data': { 'id': 'str' } }
#
# @id: The job identifier.
#
-# Since: 2.13
+# Since: 3.0
##
{ 'command': 'job-complete', 'data': { 'id': 'str' } }
#
# @id: The job identifier.
#
-# Since: 2.13
+# Since: 3.0
##
{ 'command': 'job-dismiss', 'data': { 'id': 'str' } }
# @id: The identifier of any job in the transaction, or of a job that is not
# part of any transaction.
#
-# Since: 2.13
+# Since: 3.0
##
{ 'command': 'job-finalize', 'data': { 'id': 'str' } }
+
+##
+# @JobInfo:
+#
+# Information about a job.
+#
+# @id: The job identifier
+#
+# @type: The kind of job that is being performed
+#
+# @status: Current job state/status
+#
+# @current-progress: Progress made until now. The unit is arbitrary and the
+# value can only meaningfully be used for the ratio of
+# @current-progress to @total-progress. The value is
+# monotonically increasing.
+#
+# @total-progress: Estimated @current-progress value at the completion of
+# the job. This value can arbitrarily change while the
+# job is running, in both directions.
+#
+# @error: If this field is present, the job failed; if it is
+# still missing in the CONCLUDED state, this indicates
+# successful completion.
+#
+# The value is a human-readable error message to describe
+# the reason for the job failure. It should not be parsed
+# by applications.
+#
+# Since: 3.0
+##
+{ 'struct': 'JobInfo',
+ 'data': { 'id': 'str', 'type': 'JobType', 'status': 'JobStatus',
+ 'current-progress': 'int', 'total-progress': 'int',
+ '*error': 'str' } }
+
+##
+# @query-jobs:
+#
+# Return information about jobs.
+#
+# Returns: a list with a @JobInfo for each active job
+#
+# Since: 3.0
+##
+{ 'command': 'query-jobs', 'returns': ['JobInfo'] }