job: Move state transitions to Job

This moves BlockJob.status and the closely related functions
(block_)job_state_transition() and (block_)job_apply_verb to Job. The
two QAPI enums are renamed to JobStatus and JobVerb.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Kevin Wolf 2018-04-13 17:19:31 +02:00
parent e7c1d78bbd
commit a50c2ab858
8 changed files with 123 additions and 112 deletions

View file

@ -1068,9 +1068,9 @@
'data': ['commit', 'stream', 'mirror', 'backup'] }
##
# @BlockJobVerb:
# @JobVerb:
#
# Represents command verbs that can be applied to a blockjob.
# Represents command verbs that can be applied to a job.
#
# @cancel: see @block-job-cancel
#
@ -1088,14 +1088,14 @@
#
# Since: 2.12
##
{ 'enum': 'BlockJobVerb',
{ 'enum': 'JobVerb',
'data': ['cancel', 'pause', 'resume', 'set-speed', 'complete', 'dismiss',
'finalize' ] }
##
# @BlockJobStatus:
# @JobStatus:
#
# Indicates the present state of a given blockjob in its lifetime.
# Indicates the present state of a given job in its lifetime.
#
# @undefined: Erroneous, default state. Should not ever be visible.
#
@ -1134,7 +1134,7 @@
#
# Since: 2.12
##
{ 'enum': 'BlockJobStatus',
{ 'enum': 'JobStatus',
'data': ['undefined', 'created', 'running', 'paused', 'ready', 'standby',
'waiting', 'pending', 'aborting', 'concluded', 'null' ] }
@ -1184,7 +1184,7 @@
'data': {'type': 'str', 'device': 'str', 'len': 'int',
'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
'status': 'BlockJobStatus',
'status': 'JobStatus',
'auto-finalize': 'bool', 'auto-dismiss': 'bool',
'*error': 'str' } }
@ -2416,7 +2416,7 @@
# QEMU 2.12+ job lifetime management semantics.
#
# This command will refuse to operate on any job that has not yet reached
# its terminal state, BLOCK_JOB_STATUS_CONCLUDED. For jobs that make use of
# its terminal state, JOB_STATUS_CONCLUDED. For jobs that make use of the
# BLOCK_JOB_READY event, block-job-cancel or block-job-complete will still need
# to be used as appropriate.
#