[PATCH] qemu: Don't emit SUSPENDED_POSTCOPY event on destination

Jiri Denemark posted 1 patch 4 years, 2 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/6b02e03938cc4527d23a0aeccc3186a66a452419.1579180669.git.jdenemar@redhat.com
src/qemu/qemu_process.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] qemu: Don't emit SUSPENDED_POSTCOPY event on destination
Posted by Jiri Denemark 4 years, 2 months ago
When pause-before-switchover QEMU capability is enabled, we get STOP
event before MIGRATION event with postcopy-active state. To properly
handle post-copy migration and emit correct events commit
v4.10.0-rc1-4-geca9d21e6c added a hack to
qemuProcessHandleMigrationStatus which translates the paused state
reason to VIR_DOMAIN_PAUSED_POSTCOPY and emits
VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY event when migration state changes
to post-copy.

However, the code was effective on both sides of migration resulting in
a confusing VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY event on the destination
host, where entering post-copy mode is already properly advertised by
VIR_DOMAIN_EVENT_RESUMED_POSTCOPY event.

https://bugzilla.redhat.com/show_bug.cgi?id=1791458

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/qemu/qemu_process.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 4195042194..a7bbab9e56 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1653,6 +1653,7 @@ qemuProcessHandleMigrationStatus(qemuMonitorPtr mon G_GNUC_UNUSED,
     virDomainObjBroadcast(vm);
 
     if (status == QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY &&
+        priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_OUT &&
         virDomainObjGetState(vm, &reason) == VIR_DOMAIN_PAUSED &&
         reason == VIR_DOMAIN_PAUSED_MIGRATION) {
         VIR_DEBUG("Correcting paused state reason for domain %s to %s",
-- 
2.25.0

Re: [PATCH] qemu: Don't emit SUSPENDED_POSTCOPY event on destination
Posted by Ján Tomko 4 years, 2 months ago
On Thu, Jan 16, 2020 at 02:17:49PM +0100, Jiri Denemark wrote:
>When pause-before-switchover QEMU capability is enabled, we get STOP
>event before MIGRATION event with postcopy-active state. To properly
>handle post-copy migration and emit correct events commit
>v4.10.0-rc1-4-geca9d21e6c added a hack to
>qemuProcessHandleMigrationStatus which translates the paused state
>reason to VIR_DOMAIN_PAUSED_POSTCOPY and emits
>VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY event when migration state changes
>to post-copy.
>
>However, the code was effective on both sides of migration resulting in
>a confusing VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY event on the destination
>host, where entering post-copy mode is already properly advertised by
>VIR_DOMAIN_EVENT_RESUMED_POSTCOPY event.
>
>https://bugzilla.redhat.com/show_bug.cgi?id=1791458
>
>Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
>---
> src/qemu/qemu_process.c | 1 +
> 1 file changed, 1 insertion(+)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano