From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id C4D501FF138 for ; Mon, 29 Jun 2026 15:55:33 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 582112149E; Mon, 29 Jun 2026 15:55:17 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Subject: [PATCH qemu-server v2 5/5] suspend: skip VM start after successfully saving state Date: Mon, 29 Jun 2026 15:54:21 +0200 Message-ID: <20260629135438.172004-6-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260629135438.172004-1-f.ebner@proxmox.com> References: <20260629135438.172004-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1782741270445 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.009 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 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: 4YFYWIZ3OLOK4GQD2KC323R7A3NBLGIV X-Message-ID-Hash: 4YFYWIZ3OLOK4GQD2KC323R7A3NBLGIV X-MailFrom: f.ebner@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: When creating a snapshot of the VM state for hibernation, the VM must not be started again if the snapshot operation was completed successfully. The VM should remain stopped, so that the QMP 'quit' is issued without further activity from the VM. The 'skip-vm-start' parameter for 'savevm-start' is available since QEMU version 11.0.2, so version-guard it. Signed-off-by: Fiona Ebner --- Changes in v2: * check for 11.0.2 instead of 11.0.1 src/PVE/QemuServer/RunState.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/PVE/QemuServer/RunState.pm b/src/PVE/QemuServer/RunState.pm index 2d98e6bb..889ddd28 100644 --- a/src/PVE/QemuServer/RunState.pm +++ b/src/PVE/QemuServer/RunState.pm @@ -2,6 +2,7 @@ package PVE::QemuServer::RunState; use v5.36; +use JSON qw(); use POSIX qw(strftime); use PVE::Cluster; @@ -13,6 +14,7 @@ use PVE::QemuConfig; use PVE::QemuMigrate::Helpers; use PVE::QemuServer::Monitor qw(mon_cmd); use PVE::QemuServer::Network; +use PVE::QemuServer::QMPHelpers; # note: if using the statestorage parameter, the caller has to check privileges sub vm_suspend($vmid, $skiplock = undef, $includestate = undef, $statestorage = undef) { @@ -72,7 +74,11 @@ sub vm_suspend($vmid, $skiplock = undef, $includestate = undef, $statestorage = eval { PVE::QemuMigrate::Helpers::set_migration_caps($vmid, 1); - mon_cmd($vmid, "savevm-start", statefile => $path); + my $savevm_start_params = { statefile => $path }; + if (PVE::QemuServer::QMPHelpers::runs_at_least_qemu_version($vmid, 11, 0, 2)) { + $savevm_start_params->{'skip-vm-start'} = JSON::true; + } + mon_cmd($vmid, "savevm-start", $savevm_start_params->%*); for (;;) { my $state = mon_cmd($vmid, "query-savevm"); if (!$state->{status}) { -- 2.47.3