From 87257c76b9d58c1c52f3b30244ecfa20ce3eee72 Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Tue, 24 May 2022 17:18:56 +0200 Subject: [PATCH] qemu: Fix VSERPORT_CHANGE event in post-copy migration When a domain has a guest agent channel enabled and the agent is running in the guest, we will get VSERPORT_CHANGE event on a destination host as soon as we start vCPUs there. This is not an issue for normal migration, but post-copy migration will remain running after we started vCPUs on the destination. If it runs for more than 30s, the VSERPORT_CHANGE event handler will fail to get a job and log the following error message: Timed out during operation: cannot acquire state change lock (held by monitor=remoteDispatchDomainMigrateFinish3Params) and of course we will think the guest agent is not connected and thus all APIs talking to it will fail. Until the agent or libvirt daemon is restarted. Luckily we only need to update the channel state (to mark it as connected) and connect to the agent neither of which conflicts with migration. Thus we can safely enable processing this event during migration. Signed-off-by: Jiri Denemark Reviewed-by: Peter Krempa --- src/qemu/qemu_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2a1a7f52f1..ee1adb0300 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3998,7 +3998,7 @@ processSerialChangedEvent(virQEMUDriver *driver, memset(&dev, 0, sizeof(dev)); } - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY_MIGRATION_SAFE) < 0) return; if (!virDomainObjIsActive(vm)) { -- 2.47.2