From d7f9ebf46a8c8f2e41b34a1df13fad2ac9a095a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Thu, 14 Nov 2024 23:02:25 -0500 Subject: [PATCH] incusd/instance/qemu: Don't take over operations on console retrieval MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes an issue where we'd get both stopped and migrated events during live-migration as the console retrieval happening during the migration would mark the migration operation as completed, turning the final stop operation into its own entity rather than completing the migration operation. Signed-off-by: Stéphane Graber --- internal/server/instance/drivers/driver_qemu.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/server/instance/drivers/driver_qemu.go b/internal/server/instance/drivers/driver_qemu.go index 8cac04a858..bcb004443d 100644 --- a/internal/server/instance/drivers/driver_qemu.go +++ b/internal/server/instance/drivers/driver_qemu.go @@ -9322,7 +9322,10 @@ func (d *qemu) ConsoleLog() (string, error) { return "", err } - defer op.Done(nil) + // Only mark the operation as done if only processing the console retrieval. + if op.Action() == operationlock.ActionConsoleRetrieve { + defer op.Done(nil) + } // Check if the agent is running. monitor, err := qmp.Connect(d.monitorPath(), qemuSerialChardevName, d.getMonitorEventHandler(), d.QMPLogFilePath())