From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 43FEE1FF13A for ; Wed, 22 Jul 2026 16:02:35 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 86FD421534; Wed, 22 Jul 2026 16:02:30 +0200 (CEST) From: Daniel Kral 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 Message-ID: <20260722140149.296952-7-d.kral@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260722140149.296952-1-d.kral@proxmox.com> References: <20260722140149.296952-1-d.kral@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1784728918067 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.230 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_LOW -0.7 Sender listed at https://www.dnswl.org/, low trust 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: RIGVGVCJWJYHHGQIUFZS35NJL7SMDZ6O X-Message-ID-Hash: RIGVGVCJWJYHHGQIUFZS35NJL7SMDZ6O X-MailFrom: d.kral@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: 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 --- 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