From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id AD42F1FF14C for ; Fri, 12 Jun 2026 09:53:53 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id BDD54AE17; Fri, 12 Jun 2026 09:53:52 +0200 (CEST) From: Erik Fastermann To: pve-devel@lists.proxmox.com Subject: [RFC PATCH pve-qemu] savevm-async: fix stuck paused vm after snapshot Date: Fri, 12 Jun 2026 09:53:45 +0200 Message-ID: <20260612075345.110118-1-e.fastermann@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.114 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods RDNS_NONE 0.793 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record Message-ID-Hash: Q7LS3KS75DGUPTVOFNYPET3QMBATTCB2 X-Message-ID-Hash: Q7LS3KS75DGUPTVOFNYPET3QMBATTCB2 X-MailFrom: efastermann@ruth.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 CC: Erik Fastermann X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- ...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 +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 +--- + 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