From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 35F981FF09B for ; Mon, 23 Nov 2026 01:52:19 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 3C23421435; Mon, 23 Nov 2026 01:52:15 +0100 (CET) From: Thomas Lamprecht 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 Message-ID: <20261123005156.3372554-1-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1795395121799 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.148 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: YAE43N43BY5NXIM4CJIHHAPR3ULCBCRW X-Message-ID-Hash: YAE43N43BY5NXIM4CJIHHAPR3ULCBCRW X-MailFrom: t.lamprecht@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- ...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