Set the correct job states after the operation is requested in qemu.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_blockjob.c | 4 +++-
src/qemu/qemu_driver.c | 8 +++++---
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index fe0114bf26..0f08cf7967 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -256,7 +256,9 @@ bool
qemuBlockJobIsRunning(qemuBlockJobDataPtr job)
{
return job->state == QEMU_BLOCKJOB_STATE_RUNNING ||
- job->state == QEMU_BLOCKJOB_STATE_READY;
+ job->state == QEMU_BLOCKJOB_STATE_READY ||
+ job->state == QEMU_BLOCKJOB_STATE_ABORTING ||
+ job->state == QEMU_BLOCKJOB_STATE_PIVOTING;
}
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index fa9e3c2bfc..39b5ea5e7e 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -17028,6 +17028,7 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
if (disk && disk->mirror)
disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_PIVOT;
+ job->state = QEMU_BLOCKJOB_STATE_PIVOTING;
cleanup:
return ret;
@@ -17182,10 +17183,10 @@ qemuDomainBlockJobAbort(virDomainPtr dom,
goto endjob;
}
- if (disk->mirrorState != VIR_DOMAIN_DISK_MIRROR_STATE_NONE &&
- disk->mirrorState != VIR_DOMAIN_DISK_MIRROR_STATE_READY) {
+ if (job->state == QEMU_BLOCKJOB_STATE_ABORTING ||
+ job->state == QEMU_BLOCKJOB_STATE_PIVOTING) {
virReportError(VIR_ERR_OPERATION_INVALID,
- _("another job on disk '%s' is still being
ended"),
+ _("block job on disk '%s' is still being
ended"),
disk->dst);
goto endjob;
}
@@ -17209,6 +17210,7 @@ qemuDomainBlockJobAbort(virDomainPtr dom,
if (disk->mirror)
disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_ABORT;
+ job->state = QEMU_BLOCKJOB_STATE_ABORTING;
}
ignore_value(virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm,
driver->caps));
--
2.21.0