all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Daniel Kral <d.kral@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server 6/7] api: vm_reboot: initialize the config-aware timeout in API handler
Date: Wed, 22 Jul 2026 16:01:48 +0200	[thread overview]
Message-ID: <20260722140149.296952-7-d.kral@proxmox.com> (raw)
In-Reply-To: <20260722140149.296952-1-d.kral@proxmox.com>

As vm_reboot() is the only remaining caller which depends on
_do_vm_stop() to acknowledge the shutdown timeout from the VM config,
move the behavior to the API handler and remove it from _do_vm_stop().

Signed-off-by: Daniel Kral <d.kral@proxmox.com>
---
 src/PVE/API2/Qemu.pm  | 8 +++++++-
 src/PVE/QemuServer.pm | 1 -
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/PVE/API2/Qemu.pm b/src/PVE/API2/Qemu.pm
index 2613aea0..a380cfc1 100644
--- a/src/PVE/API2/Qemu.pm
+++ b/src/PVE/API2/Qemu.pm
@@ -4002,6 +4002,12 @@ __PACKAGE__->register_method({
         my $node = extract_param($param, 'node');
         my $vmid = extract_param($param, 'vmid');
 
+        my $timeout = extract_param($param, 'timeout');
+        if (!defined($timeout)) {
+            my $conf = PVE::QemuConfig->load_config($vmid);
+            $timeout = PVE::QemuServer::Helpers::config_aware_shutdown_timeout($conf);
+        }
+
         die "VM is paused - cannot shutdown\n" if PVE::QemuServer::vm_is_paused($vmid, 1);
 
         die "VM $vmid not running\n" if !PVE::QemuServer::check_running($vmid);
@@ -4010,7 +4016,7 @@ __PACKAGE__->register_method({
             my $upid = shift;
 
             syslog('info', "requesting reboot of VM $vmid: $upid\n");
-            PVE::QemuServer::vm_reboot($vmid, $param->{timeout});
+            PVE::QemuServer::vm_reboot($vmid, $timeout);
             return;
         };
 
diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index fefaf36c..1f2bc424 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -6241,7 +6241,6 @@ sub _do_vm_stop {
     if (!$nocheck) {
         $conf = PVE::QemuConfig->load_config($vmid);
         PVE::QemuConfig->check_lock($conf) if !$skiplock;
-        $timeout //= PVE::QemuServer::Helpers::config_aware_shutdown_timeout($conf) if $shutdown;
         PVE::GuestHelpers::exec_hookscript($conf, $vmid, 'pre-stop');
     }
 
-- 
2.47.3





  parent reply	other threads:[~2026-07-22 14:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22 14:01 [PATCH-SERIES ha-manager/qemu-server 0/7] fix #7230: acknowledge configured shutdown timeout for HA resources Daniel Kral
2026-07-22 14:01 ` [PATCH qemu-server 1/7] rename config_aware_timeout to config_aware_start_timeout Daniel Kral
2026-07-22 14:01 ` [PATCH qemu-server 2/7] vm_stop: introduce config_aware_shutdown_timeout helper Daniel Kral
2026-07-22 14:01 ` [PATCH qemu-server 3/7] api: qemu: improve wording in timeout parameter descriptions Daniel Kral
2026-07-22 14:01 ` [PATCH qemu-server 4/7] api: qemu: add verbose description for shutdown and reboot timeouts Daniel Kral
2026-07-22 14:01 ` [PATCH qemu-server 5/7] fix #7230: api: vm_shutdown: make HA resources acknowledge config timeout Daniel Kral
2026-07-22 14:01 ` Daniel Kral [this message]
2026-07-22 14:01 ` [PATCH ha-manager 7/7] fix #7230: resources: let shutdown api handle timeout fallback value Daniel Kral

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=20260722140149.296952-7-d.kral@proxmox.com \
    --to=d.kral@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 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