xref: /openbmc/qemu/qapi/job.json (revision 12b35405)
1# -*- Mode: Python -*-
2
3##
4# == Background jobs
5##
6
7##
8# @JobType:
9#
10# Type of a background job.
11#
12# @commit: block commit job type, see "block-commit"
13#
14# @stream: block stream job type, see "block-stream"
15#
16# @mirror: drive mirror job type, see "drive-mirror"
17#
18# @backup: drive backup job type, see "drive-backup"
19#
20# @create: image creation job type, see "blockdev-create" (since 3.0)
21#
22# @amend: image options amend job type, see "x-blockdev-amend" (since 5.1)
23#
24# Since: 1.7
25##
26{ 'enum': 'JobType',
27  'data': ['commit', 'stream', 'mirror', 'backup', 'create', 'amend'] }
28
29##
30# @JobStatus:
31#
32# Indicates the present state of a given job in its lifetime.
33#
34# @undefined: Erroneous, default state. Should not ever be visible.
35#
36# @created: The job has been created, but not yet started.
37#
38# @running: The job is currently running.
39#
40# @paused: The job is running, but paused. The pause may be requested by
41#          either the QMP user or by internal processes.
42#
43# @ready: The job is running, but is ready for the user to signal completion.
44#         This is used for long-running jobs like mirror that are designed to
45#         run indefinitely.
46#
47# @standby: The job is ready, but paused. This is nearly identical to @paused.
48#           The job may return to @ready or otherwise be canceled.
49#
50# @waiting: The job is waiting for other jobs in the transaction to converge
51#           to the waiting state. This status will likely not be visible for
52#           the last job in a transaction.
53#
54# @pending: The job has finished its work, but has finalization steps that it
55#           needs to make prior to completing. These changes will require
56#           manual intervention via @job-finalize if auto-finalize was set to
57#           false. These pending changes may still fail.
58#
59# @aborting: The job is in the process of being aborted, and will finish with
60#            an error. The job will afterwards report that it is @concluded.
61#            This status may not be visible to the management process.
62#
63# @concluded: The job has finished all work. If auto-dismiss was set to false,
64#             the job will remain in the query list until it is dismissed via
65#             @job-dismiss.
66#
67# @null: The job is in the process of being dismantled. This state should not
68#        ever be visible externally.
69#
70# Since: 2.12
71##
72{ 'enum': 'JobStatus',
73  'data': ['undefined', 'created', 'running', 'paused', 'ready', 'standby',
74           'waiting', 'pending', 'aborting', 'concluded', 'null' ] }
75
76##
77# @JobVerb:
78#
79# Represents command verbs that can be applied to a job.
80#
81# @cancel: see @job-cancel
82#
83# @pause: see @job-pause
84#
85# @resume: see @job-resume
86#
87# @set-speed: see @block-job-set-speed
88#
89# @complete: see @job-complete
90#
91# @dismiss: see @job-dismiss
92#
93# @finalize: see @job-finalize
94#
95# Since: 2.12
96##
97{ 'enum': 'JobVerb',
98  'data': ['cancel', 'pause', 'resume', 'set-speed', 'complete', 'dismiss',
99           'finalize' ] }
100
101##
102# @JOB_STATUS_CHANGE:
103#
104# Emitted when a job transitions to a different status.
105#
106# @id: The job identifier
107# @status: The new job status
108#
109# Since: 3.0
110##
111{ 'event': 'JOB_STATUS_CHANGE',
112  'data': { 'id': 'str',
113            'status': 'JobStatus' } }
114
115##
116# @job-pause:
117#
118# Pause an active job.
119#
120# This command returns immediately after marking the active job for pausing.
121# Pausing an already paused job is an error.
122#
123# The job will pause as soon as possible, which means transitioning into the
124# PAUSED state if it was RUNNING, or into STANDBY if it was READY. The
125# corresponding JOB_STATUS_CHANGE event will be emitted.
126#
127# Cancelling a paused job automatically resumes it.
128#
129# @id: The job identifier.
130#
131# Since: 3.0
132##
133{ 'command': 'job-pause', 'data': { 'id': 'str' } }
134
135##
136# @job-resume:
137#
138# Resume a paused job.
139#
140# This command returns immediately after resuming a paused job. Resuming an
141# already running job is an error.
142#
143# @id : The job identifier.
144#
145# Since: 3.0
146##
147{ 'command': 'job-resume', 'data': { 'id': 'str' } }
148
149##
150# @job-cancel:
151#
152# Instruct an active background job to cancel at the next opportunity.
153# This command returns immediately after marking the active job for
154# cancellation.
155#
156# The job will cancel as soon as possible and then emit a JOB_STATUS_CHANGE
157# event. Usually, the status will change to ABORTING, but it is possible that
158# a job successfully completes (e.g. because it was almost done and there was
159# no opportunity to cancel earlier than completing the job) and transitions to
160# PENDING instead.
161#
162# @id: The job identifier.
163#
164# Since: 3.0
165##
166{ 'command': 'job-cancel', 'data': { 'id': 'str' } }
167
168
169##
170# @job-complete:
171#
172# Manually trigger completion of an active job in the READY state.
173#
174# @id: The job identifier.
175#
176# Since: 3.0
177##
178{ 'command': 'job-complete', 'data': { 'id': 'str' } }
179
180##
181# @job-dismiss:
182#
183# Deletes a job that is in the CONCLUDED state. This command only needs to be
184# run explicitly for jobs that don't have automatic dismiss enabled.
185#
186# This command will refuse to operate on any job that has not yet reached its
187# terminal state, JOB_STATUS_CONCLUDED. For jobs that make use of JOB_READY
188# event, job-cancel or job-complete will still need to be used as appropriate.
189#
190# @id: The job identifier.
191#
192# Since: 3.0
193##
194{ 'command': 'job-dismiss', 'data': { 'id': 'str' } }
195
196##
197# @job-finalize:
198#
199# Instructs all jobs in a transaction (or a single job if it is not part of any
200# transaction) to finalize any graph changes and do any necessary cleanup. This
201# command requires that all involved jobs are in the PENDING state.
202#
203# For jobs in a transaction, instructing one job to finalize will force
204# ALL jobs in the transaction to finalize, so it is only necessary to instruct
205# a single member job to finalize.
206#
207# @id: The identifier of any job in the transaction, or of a job that is not
208#      part of any transaction.
209#
210# Since: 3.0
211##
212{ 'command': 'job-finalize', 'data': { 'id': 'str' } }
213
214##
215# @JobInfo:
216#
217# Information about a job.
218#
219# @id: The job identifier
220#
221# @type: The kind of job that is being performed
222#
223# @status: Current job state/status
224#
225# @current-progress: Progress made until now. The unit is arbitrary and the
226#                    value can only meaningfully be used for the ratio of
227#                    @current-progress to @total-progress. The value is
228#                    monotonically increasing.
229#
230# @total-progress: Estimated @current-progress value at the completion of
231#                  the job. This value can arbitrarily change while the
232#                  job is running, in both directions.
233#
234# @error: If this field is present, the job failed; if it is
235#         still missing in the CONCLUDED state, this indicates
236#         successful completion.
237#
238#         The value is a human-readable error message to describe
239#         the reason for the job failure. It should not be parsed
240#         by applications.
241#
242# Since: 3.0
243##
244{ 'struct': 'JobInfo',
245  'data': { 'id': 'str', 'type': 'JobType', 'status': 'JobStatus',
246            'current-progress': 'int', 'total-progress': 'int',
247            '*error': 'str' } }
248
249##
250# @query-jobs:
251#
252# Return information about jobs.
253#
254# Returns: a list with a @JobInfo for each active job
255#
256# Since: 3.0
257##
258{ 'command': 'query-jobs', 'returns': ['JobInfo'] }
259