From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 430411FF13A for ; Wed, 27 May 2026 13:01:35 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 445A9185D5; Wed, 27 May 2026 13:01:17 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Subject: [PATCH qemu-server 6/6] suspend: skip VM start after successfully saving state Date: Wed, 27 May 2026 13:00:50 +0200 Message-ID: <20260527110106.287916-7-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260527110106.287916-1-f.ebner@proxmox.com> References: <20260527110106.287916-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: 1779879644265 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [runstate.pm] Message-ID-Hash: QIUJA5KTD6SHK2SMU4UXZMNZUMGYUE5F X-Message-ID-Hash: QIUJA5KTD6SHK2SMU4UXZMNZUMGYUE5F 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.1, so version-guard it. Signed-off-by: Fiona Ebner --- 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..157cd1a8 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, 1)) { + $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