public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
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	[thread overview]
Message-ID: <20260527110106.287916-7-f.ebner@proxmox.com> (raw)
In-Reply-To: <20260527110106.287916-1-f.ebner@proxmox.com>

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 <f.ebner@proxmox.com>
---
 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





      parent reply	other threads:[~2026-05-27 11:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-27 11:00 [PATCH-SERIES qemu/qemu-server 0/6] fix #6424: avoid timeout issue for QMP 'quit' for bulk suspend Fiona Ebner
2026-05-27 11:00 ` [PATCH qemu 1/6] regenerate patches to restore incremental numbering Fiona Ebner
2026-05-27 11:00 ` [PATCH qemu 2/6] async snapshot: allow skipping VM start after successful completion Fiona Ebner
2026-05-27 11:00 ` [PATCH qemu 3/6] update submodule and patches to QEMU 11.0.1 Fiona Ebner
2026-05-27 11:00 ` [PATCH qemu-server 4/6] fix #6424: increase timeout for QMP 'quit' to 60s to avoid issue with bulk suspend Fiona Ebner
2026-05-27 11:00 ` [PATCH qemu-server 5/6] run state: use v5.36 and signatures in module Fiona Ebner
2026-05-27 11:00 ` Fiona Ebner [this message]

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=20260527110106.287916-7-f.ebner@proxmox.com \
    --to=f.ebner@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal