提交 019461fa 编写于 作者: P Peter Krempa

qemu: driver: Set mirror state after successful command

When aborting or pivoting a block job we record which operation we do
for the mirror in the virDomainDiskDef structure. As everything is
synchronized by a job it's not necessary to modify the state prior to
calling the monitor and resetting the state on failure.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 d41e1aa1
...@@ -17107,7 +17107,6 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver, ...@@ -17107,7 +17107,6 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
* XXX If the abort command is synchronous but the qemu event says * XXX If the abort command is synchronous but the qemu event says
* that pivot failed, we need to reflect that failure into the * that pivot failed, we need to reflect that failure into the
* overall return value. */ * overall return value. */
disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_PIVOT;
qemuDomainObjEnterMonitor(driver, vm); qemuDomainObjEnterMonitor(driver, vm);
ret = qemuMonitorDrivePivot(priv->mon, job->name); ret = qemuMonitorDrivePivot(priv->mon, job->name);
if (qemuDomainObjExitMonitor(driver, vm) < 0) { if (qemuDomainObjExitMonitor(driver, vm) < 0) {
...@@ -17115,11 +17114,11 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver, ...@@ -17115,11 +17114,11 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
goto cleanup; goto cleanup;
} }
if (ret < 0) { /* The pivot failed. The block job in QEMU remains in the synchronised state */
/* The pivot failed. The block job in QEMU remains in the synchronised if (ret < 0)
* phase. Reset the state we changed and return the error to the user */ goto cleanup;
disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_READY;
} disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_PIVOT;
cleanup: cleanup:
return ret; return ret;
...@@ -17298,9 +17297,6 @@ qemuDomainBlockJobAbort(virDomainPtr dom, ...@@ -17298,9 +17297,6 @@ qemuDomainBlockJobAbort(virDomainPtr dom,
if ((ret = qemuDomainBlockPivot(driver, vm, job, disk)) < 0) if ((ret = qemuDomainBlockPivot(driver, vm, job, disk)) < 0)
goto endjob; goto endjob;
} else { } else {
if (disk->mirror)
disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_ABORT;
qemuDomainObjEnterMonitor(driver, vm); qemuDomainObjEnterMonitor(driver, vm);
ret = qemuMonitorBlockJobCancel(qemuDomainGetMonitor(vm), job->name); ret = qemuMonitorBlockJobCancel(qemuDomainGetMonitor(vm), job->name);
if (qemuDomainObjExitMonitor(driver, vm) < 0) { if (qemuDomainObjExitMonitor(driver, vm) < 0) {
...@@ -17308,11 +17304,11 @@ qemuDomainBlockJobAbort(virDomainPtr dom, ...@@ -17308,11 +17304,11 @@ qemuDomainBlockJobAbort(virDomainPtr dom,
goto endjob; goto endjob;
} }
if (ret < 0) { if (ret < 0)
if (disk->mirror)
disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_NONE;
goto endjob; goto endjob;
}
if (disk->mirror)
disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_ABORT;
} }
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.
先完成此消息的编辑!
想要评论请 注册