From: Jiri Denemark Date: Tue, 24 May 2022 15:18:56 +0000 (+0200) Subject: qemu: Fix VSERPORT_CHANGE event in post-copy migration X-Git-Tag: v8.5.0-rc1~119 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87257c76b9d58c1c52f3b30244ecfa20ce3eee72;p=thirdparty%2Flibvirt.git 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 --- 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)) {