From: Erik Fastermann <e.fastermann@proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Erik Fastermann <e.fastermann@proxmox.com>
Subject: [RFC PATCH pve-qemu] savevm-async: fix stuck paused vm after snapshot
Date: Fri, 12 Jun 2026 09:53:45 +0200 [thread overview]
Message-ID: <20260612075345.110118-1-e.fastermann@proxmox.com> (raw)
When creating a snapshot of a paused vm, the vm hung indefinitely in the
state "paused (finish-migrate)" and had to be restarted. This patch
fixes this by only transitioning the vm run state if the vm was
currently running.
Signed-off-by: Erik Fastermann <e.fastermann@proxmox.com>
---
...c-fix-stuck-paused-vm-after-snapshot.patch | 48 +++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 49 insertions(+)
create mode 100644 debian/patches/pve/0047-savevm-async-fix-stuck-paused-vm-after-snapshot.patch
diff --git a/debian/patches/pve/0047-savevm-async-fix-stuck-paused-vm-after-snapshot.patch b/debian/patches/pve/0047-savevm-async-fix-stuck-paused-vm-after-snapshot.patch
new file mode 100644
index 0000000..46f0422
--- /dev/null
+++ b/debian/patches/pve/0047-savevm-async-fix-stuck-paused-vm-after-snapshot.patch
@@ -0,0 +1,48 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Erik Fastermann <e.fastermann@proxmox.com>
+Date: Thu, 11 Jun 2026 13:42:05 +0200
+Subject: [PATCH] savevm-async: fix stuck paused vm after snapshot
+
+When creating a snapshot of a paused vm, the vm hung indefinitely in the
+state "paused (finish-migrate)" and had to be restarted. This patch
+fixes this by only transitioning the vm run state if the vm was
+currently running.
+
+Signed-off-by: Erik Fastermann <e.fastermann@proxmox.com>
+---
+ migration/savevm-async.c | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/migration/savevm-async.c b/migration/savevm-async.c
+index acd1a4de6e..153433f539 100644
+--- a/migration/savevm-async.c
++++ b/migration/savevm-async.c
+@@ -181,9 +181,11 @@ static void process_savevm_finalize(void *opaque)
+ blk_set_aio_context(snap_state.target, qemu_get_aio_context(), NULL);
+
+ snap_state.vm_needs_start = runstate_is_running();
+- ret = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
+- if (ret < 0) {
+- save_snapshot_error("vm_stop_force_state error %d", ret);
++ if (snap_state.vm_needs_start) {
++ ret = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
++ if (ret < 0) {
++ save_snapshot_error("vm_stop_force_state error %d", ret);
++ }
+ }
+
+ if (!aborted) {
+@@ -370,7 +372,9 @@ void qmp_savevm_start(const char *statefile, Error **errp)
+
+ if (!statefile) {
+ snap_state.vm_needs_start = runstate_is_running();
+- vm_stop(RUN_STATE_SAVE_VM);
++ if (snap_state.vm_needs_start) {
++ vm_stop(RUN_STATE_SAVE_VM);
++ }
+ snap_state.state = SAVE_STATE_COMPLETED;
+ return;
+ }
+--
+2.47.3
+
diff --git a/debian/patches/series b/debian/patches/series
index 84c0664..6463a4a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -70,3 +70,4 @@ pve/0043-PVE-backup-get-device-info-allow-caller-to-specify-f.patch
pve/0044-PVE-backup-implement-backup-access-setup-and-teardow.patch
pve/0045-PVE-backup-prepare-for-the-switch-to-using-blockdev-.patch
pve/0046-savevm-async-reuse-migration-blocker-check-for-snaps.patch
+pve/0047-savevm-async-fix-stuck-paused-vm-after-snapshot.patch
--
2.47.3
reply other threads:[~2026-06-12 7:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260612075345.110118-1-e.fastermann@proxmox.com \
--to=e.fastermann@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