qemu: blockjob: Add block job states for abort and pivot operations

When initiating a pivot or abort of a block job we need to track which
one was initiated. Currently it was done via data stashed in
virDomainDiskDef. Add possibility to track this also together with the
job itself.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2019-02-11 14:36:24 +01:00
parent dd9dc7bfe1
commit 9e200a0f39
2 changed files with 10 additions and 1 deletions

View File

@ -53,7 +53,9 @@ VIR_ENUM_IMPL(qemuBlockjobState,
"ready",
"new",
"running",
"concluded");
"concluded",
"aborting",
"pivoting");
VIR_ENUM_IMPL(qemuBlockjob,
QEMU_BLOCKJOB_TYPE_LAST,
@ -599,6 +601,8 @@ qemuBlockJobEventProcessConcludedTransition(qemuBlockJobDataPtr job,
case QEMU_BLOCKJOB_STATE_NEW:
case QEMU_BLOCKJOB_STATE_RUNNING:
case QEMU_BLOCKJOB_STATE_CONCLUDED:
case QEMU_BLOCKJOB_STATE_ABORTING:
case QEMU_BLOCKJOB_STATE_PIVOTING:
case QEMU_BLOCKJOB_STATE_LAST:
default:
break;
@ -724,6 +728,9 @@ qemuBlockJobEventProcess(virQEMUDriverPtr driver,
case QEMU_BLOCKJOB_STATE_NEW:
case QEMU_BLOCKJOB_STATE_RUNNING:
case QEMU_BLOCKJOB_STATE_LAST:
/* these are never processed as 'newstate' */
case QEMU_BLOCKJOB_STATE_ABORTING:
case QEMU_BLOCKJOB_STATE_PIVOTING:
default:
job->newstate = -1;
}

View File

@ -40,6 +40,8 @@ typedef enum {
QEMU_BLOCKJOB_STATE_RUNNING,
QEMU_BLOCKJOB_STATE_CONCLUDED, /* job has finished, but it's unknown
whether it has failed or not */
QEMU_BLOCKJOB_STATE_ABORTING,
QEMU_BLOCKJOB_STATE_PIVOTING,
QEMU_BLOCKJOB_STATE_LAST
} qemuBlockjobState;
verify((int)QEMU_BLOCKJOB_STATE_NEW == VIR_DOMAIN_BLOCK_JOB_LAST);