diff --git a/internal/server/instance/drivers/driver_qemu.go b/internal/server/instance/drivers/driver_qemu.go index f13e1cd85e6..38be7d614f5 100644 --- a/internal/server/instance/drivers/driver_qemu.go +++ b/internal/server/instance/drivers/driver_qemu.go @@ -9329,7 +9329,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())