提交 e5d729ba 编写于 作者: M Michael Chapman 提交者: Ján Tomko

qemu: fix race between disk mirror fail and cancel

If a VM migration is aborted, a disk mirror may be failed by QEMU before
libvirt has a chance to cancel it. The disk->mirrorState remains at
_ABORT in this case, and this breaks subsequent mirrorings of that disk.

We should instead check the mirrorState directly and transition to _NONE
if it is already aborted. Do the check *after* aborting the block job in
QEMU to avoid a race.
Signed-off-by: NMichael Chapman <mike@very.puzzling.org>
上级 77ddd0bb
...@@ -1853,6 +1853,10 @@ qemuMigrationDriveMirror(virQEMUDriverPtr driver, ...@@ -1853,6 +1853,10 @@ qemuMigrationDriveMirror(virQEMUDriverPtr driver,
} else { } else {
VIR_WARN("Unable to enter monitor. No block job cancelled"); VIR_WARN("Unable to enter monitor. No block job cancelled");
} }
/* If disk mirror is already aborted, clear the mirror state now */
if (disk->mirrorState == VIR_DOMAIN_DISK_MIRROR_STATE_ABORT)
disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_NONE;
} }
if (err) if (err)
virSetError(err); virSetError(err);
...@@ -1921,6 +1925,10 @@ qemuMigrationCancelDriveMirror(qemuMigrationCookiePtr mig, ...@@ -1921,6 +1925,10 @@ qemuMigrationCancelDriveMirror(qemuMigrationCookiePtr mig,
ret = -1; ret = -1;
goto cleanup; goto cleanup;
} }
/* If disk mirror is already aborted, clear the mirror state now */
if (disk->mirrorState == VIR_DOMAIN_DISK_MIRROR_STATE_ABORT)
disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_NONE;
} }
cleanup: cleanup:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册