all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [RFC PATCH pve-qemu] savevm-async: fix stuck paused vm after snapshot
@ 2026-06-12  7:53 Erik Fastermann
  0 siblings, 0 replies; only message in thread
From: Erik Fastermann @ 2026-06-12  7:53 UTC (permalink / raw)
  To: pve-devel; +Cc: Erik Fastermann

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




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-12  7:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-12  7:53 [RFC PATCH pve-qemu] savevm-async: fix stuck paused vm after snapshot Erik Fastermann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal