提交 70057796 编写于 作者: P Peter Krempa

qemu: Use QEMU_BLOCKJOB_STATE_PIVOTING/ABORTING in qemuDomainBlockJobAbort

Set the correct job states after the operation is requested in qemu.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 9e200a0f
...@@ -256,7 +256,9 @@ bool ...@@ -256,7 +256,9 @@ bool
qemuBlockJobIsRunning(qemuBlockJobDataPtr job) qemuBlockJobIsRunning(qemuBlockJobDataPtr job)
{ {
return job->state == QEMU_BLOCKJOB_STATE_RUNNING || 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;
} }
...@@ -671,6 +673,10 @@ qemuBlockJobEventProcessConcluded(qemuBlockJobDataPtr job, ...@@ -671,6 +673,10 @@ qemuBlockJobEventProcessConcluded(qemuBlockJobDataPtr job,
if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0)
goto cleanup; goto cleanup;
if (job->newstate == QEMU_BLOCKJOB_STATE_COMPLETED &&
job->state == QEMU_BLOCKJOB_STATE_ABORTING)
job->newstate = QEMU_BLOCKJOB_STATE_CANCELLED;
if (refreshed) if (refreshed)
qemuDomainSaveStatus(vm); qemuDomainSaveStatus(vm);
......
...@@ -17029,6 +17029,7 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver, ...@@ -17029,6 +17029,7 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
if (disk && disk->mirror) if (disk && disk->mirror)
disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_PIVOT; disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_PIVOT;
job->state = QEMU_BLOCKJOB_STATE_PIVOTING;
cleanup: cleanup:
return ret; return ret;
...@@ -17183,10 +17184,10 @@ qemuDomainBlockJobAbort(virDomainPtr dom, ...@@ -17183,10 +17184,10 @@ qemuDomainBlockJobAbort(virDomainPtr dom,
goto endjob; goto endjob;
} }
if (disk->mirrorState != VIR_DOMAIN_DISK_MIRROR_STATE_NONE && if (job->state == QEMU_BLOCKJOB_STATE_ABORTING ||
disk->mirrorState != VIR_DOMAIN_DISK_MIRROR_STATE_READY) { job->state == QEMU_BLOCKJOB_STATE_PIVOTING) {
virReportError(VIR_ERR_OPERATION_INVALID, 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); disk->dst);
goto endjob; goto endjob;
} }
...@@ -17210,6 +17211,7 @@ qemuDomainBlockJobAbort(virDomainPtr dom, ...@@ -17210,6 +17211,7 @@ qemuDomainBlockJobAbort(virDomainPtr dom,
if (disk->mirror) if (disk->mirror)
disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_ABORT; disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_ABORT;
job->state = QEMU_BLOCKJOB_STATE_ABORTING;
} }
ignore_value(virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps)); ignore_value(virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册