11 # Type of a background job.
13 # @commit: block commit job type, see "block-commit"
15 # @stream: block stream job type, see "block-stream"
17 # @mirror: drive mirror job type, see "drive-mirror"
19 # @backup: drive backup job type, see "drive-backup"
21 # @create: image creation job type, see "blockdev-create" (since 3.0)
23 # @amend: image options amend job type, see "x-blockdev-amend" (since
26 # @snapshot-load: snapshot load job type, see "snapshot-load" (since
29 # @snapshot-save: snapshot save job type, see "snapshot-save" (since
32 # @snapshot-delete: snapshot delete job type, see "snapshot-delete"
38 'data': ['commit', 'stream', 'mirror', 'backup', 'create', 'amend',
39 'snapshot-load', 'snapshot-save', 'snapshot-delete'] }
44 # Indicates the present state of a given job in its lifetime.
46 # @undefined: Erroneous, default state. Should not ever be visible.
48 # @created: The job has been created, but not yet started.
50 # @running: The job is currently running.
52 # @paused: The job is running, but paused. The pause may be requested
53 # by either the QMP user or by internal processes.
55 # @ready: The job is running, but is ready for the user to signal
56 # completion. This is used for long-running jobs like mirror that
57 # are designed to run indefinitely.
59 # @standby: The job is ready, but paused. This is nearly identical to
60 # @paused. The job may return to @ready or otherwise be canceled.
62 # @waiting: The job is waiting for other jobs in the transaction to
63 # converge to the waiting state. This status will likely not be
64 # visible for the last job in a transaction.
66 # @pending: The job has finished its work, but has finalization steps
67 # that it needs to make prior to completing. These changes will
68 # require manual intervention via @job-finalize if auto-finalize
69 # was set to false. These pending changes may still fail.
71 # @aborting: The job is in the process of being aborted, and will
72 # finish with an error. The job will afterwards report that it is
73 # @concluded. This status may not be visible to the management
76 # @concluded: The job has finished all work. If auto-dismiss was set
77 # to false, the job will remain in the query list until it is
78 # dismissed via @job-dismiss.
80 # @null: The job is in the process of being dismantled. This state
81 # should not ever be visible externally.
85 { 'enum': 'JobStatus',
86 'data': ['undefined', 'created', 'running', 'paused', 'ready', 'standby',
87 'waiting', 'pending', 'aborting', 'concluded', 'null' ] }
92 # Represents command verbs that can be applied to a job.
94 # @cancel: see @job-cancel
96 # @pause: see @job-pause
98 # @resume: see @job-resume
100 # @set-speed: see @block-job-set-speed
102 # @complete: see @job-complete
104 # @dismiss: see @job-dismiss
106 # @finalize: see @job-finalize
111 'data': ['cancel', 'pause', 'resume', 'set-speed', 'complete', 'dismiss',
115 # @JOB_STATUS_CHANGE:
117 # Emitted when a job transitions to a different status.
119 # @id: The job identifier
121 # @status: The new job status
125 { 'event': 'JOB_STATUS_CHANGE',
126 'data': { 'id': 'str',
127 'status': 'JobStatus' } }
132 # Pause an active job.
134 # This command returns immediately after marking the active job for
135 # pausing. Pausing an already paused job is an error.
137 # The job will pause as soon as possible, which means transitioning
138 # into the PAUSED state if it was RUNNING, or into STANDBY if it was
139 # READY. The corresponding JOB_STATUS_CHANGE event will be emitted.
141 # Cancelling a paused job automatically resumes it.
143 # @id: The job identifier.
147 { 'command': 'job-pause', 'data': { 'id': 'str' } }
152 # Resume a paused job.
154 # This command returns immediately after resuming a paused job.
155 # Resuming an already running job is an error.
157 # @id: The job identifier.
161 { 'command': 'job-resume', 'data': { 'id': 'str' } }
166 # Instruct an active background job to cancel at the next opportunity.
167 # This command returns immediately after marking the active job for
170 # The job will cancel as soon as possible and then emit a
171 # JOB_STATUS_CHANGE event. Usually, the status will change to
172 # ABORTING, but it is possible that a job successfully completes (e.g.
173 # because it was almost done and there was no opportunity to cancel
174 # earlier than completing the job) and transitions to PENDING instead.
176 # @id: The job identifier.
180 { 'command': 'job-cancel', 'data': { 'id': 'str' } }
185 # Manually trigger completion of an active job in the READY state.
187 # @id: The job identifier.
191 { 'command': 'job-complete', 'data': { 'id': 'str' } }
196 # Deletes a job that is in the CONCLUDED state. This command only
197 # needs to be run explicitly for jobs that don't have automatic
200 # This command will refuse to operate on any job that has not yet
201 # reached its terminal state, JOB_STATUS_CONCLUDED. For jobs that make
202 # use of JOB_READY event, job-cancel or job-complete will still need
203 # to be used as appropriate.
205 # @id: The job identifier.
209 { 'command': 'job-dismiss', 'data': { 'id': 'str' } }
214 # Instructs all jobs in a transaction (or a single job if it is not
215 # part of any transaction) to finalize any graph changes and do any
216 # necessary cleanup. This command requires that all involved jobs are
217 # in the PENDING state.
219 # For jobs in a transaction, instructing one job to finalize will
220 # force ALL jobs in the transaction to finalize, so it is only
221 # necessary to instruct a single member job to finalize.
223 # @id: The identifier of any job in the transaction, or of a job that
224 # is not part of any transaction.
228 { 'command': 'job-finalize', 'data': { 'id': 'str' } }
233 # Information about a job.
235 # @id: The job identifier
237 # @type: The kind of job that is being performed
239 # @status: Current job state/status
241 # @current-progress: Progress made until now. The unit is arbitrary
242 # and the value can only meaningfully be used for the ratio of
243 # @current-progress to @total-progress. The value is
244 # monotonically increasing.
246 # @total-progress: Estimated @current-progress value at the completion
247 # of the job. This value can arbitrarily change while the job is
248 # running, in both directions.
250 # @error: If this field is present, the job failed; if it is still
251 # missing in the CONCLUDED state, this indicates successful
254 # The value is a human-readable error message to describe the
255 # reason for the job failure. It should not be parsed by
260 { 'struct': 'JobInfo',
261 'data': { 'id': 'str', 'type': 'JobType', 'status': 'JobStatus',
262 'current-progress': 'int', 'total-progress': 'int',
268 # Return information about jobs.
270 # Returns: a list with a @JobInfo for each active job
274 { 'command': 'query-jobs', 'returns': ['JobInfo'] }