public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu] loadstate: exit QEMU if loading the saved VM state fails
Date: Mon, 23 Nov 2026 01:51:54 +0100	[thread overview]
Message-ID: <20261123005156.3372554-1-t.lamprecht@proxmox.com> (raw)

QEMU kept running without executing the guest if it could not load the
state given with -loadstate, and its startup reported success. For
management software, this looks the same as a successful load together
with -S, which also stays in the prelaunch state. qemu-server took such
a resume for a success and deleted the hibernation state, so a state
that could not be loaded only for now, for example after a change to the
VM config, got lost. After a rollback to a snapshot with RAM, it
continued such a VM, which then booted from firmware on the rolled back
disks and the rollback reported success.

Exit with an error, like for a failing -loadvm. Unless --preconfig is
used, the load happens before daemonizing, so with -daemonize the parent
process reports the failure through its exit code. No process is left
behind and the state stays untouched. The user can fix the cause and
retry or explicitly discard the state. FWIW, with protection enabled
on the VM, discarding needs root, as the lock of a hibernated VM
prevents others from disabling protection. More granular protection
and unlock could help to improve that, but nothing that QEMU has to
care about.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
 ...15-PVE-add-savevm-async-for-background-state-snapshots.patch | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/patches/pve/0015-PVE-add-savevm-async-for-background-state-snapshots.patch b/debian/patches/pve/0015-PVE-add-savevm-async-for-background-state-snapshots.patch
index c7b141bfcb..b98a5d0ed9 100644
--- a/debian/patches/pve/0015-PVE-add-savevm-async-for-background-state-snapshots.patch
+++ b/debian/patches/pve/0015-PVE-add-savevm-async-for-background-state-snapshots.patch
@@ -978,7 +978,7 @@ index 061cbdf860..45c01fa53d 100644
 +        Error *local_err = NULL;
 +        if (load_snapshot_from_blockdev(loadstate, &local_err) < 0) {
 +            error_report_err(local_err);
-+            autostart = 0;
++            exit(1);
 +        }
      }
      if (replay_mode != REPLAY_MODE_NONE) {
-- 
2.47.3





             reply	other threads:[~2026-11-23  0:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23  0:51 Thomas Lamprecht [this message]
2026-11-23 14:07 ` applied: [PATCH qemu] loadstate: exit QEMU if loading the saved VM state fails Fiona Ebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261123005156.3372554-1-t.lamprecht@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal