From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 166F8706BE for ; Fri, 22 Jul 2022 15:28:00 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 149383E14 for ; Fri, 22 Jul 2022 15:28:00 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Fri, 22 Jul 2022 15:27:58 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 1A5E343C2E for ; Fri, 22 Jul 2022 15:27:58 +0200 (CEST) From: Daniel Tschlatscher To: pve-devel@lists.proxmox.com Date: Fri, 22 Jul 2022 15:27:35 +0200 Message-Id: <20220722132738.397449-2-d.tschlatscher@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220722132738.397449-1-d.tschlatscher@proxmox.com> References: <20220722132738.397449-1-d.tschlatscher@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.101 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% 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 Subject: [pve-devel] [PATCH qemu-server v2 2/4] fix #3502: VM start timeout config parameter X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jul 2022 13:28:00 -0000 This patch makes it possible to now set the starting timeout value for a VM via the config parameter 'startoptions'. Now, if the timeout parameter is set, it will override the heuristic calculation of the VM start timeout. The maximum value for the timeout parameter is 86400 seconds, which is one day. The minimum value is 0, which disables the timeout. Signed-off-by: Daniel Tschlatscher --- Changes from v1: * Now uses the "startoptions" propertystring * Maximum timeout reduced to 86400 PVE/API2/Qemu.pm | 2 ++ PVE/QemuServer.pm | 1 + PVE/QemuServer/Helpers.pm | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index a824657..7449b9f 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -517,6 +517,7 @@ my $generaloptions = { 'reboot' => 1, 'startdate' => 1, 'startup' => 1, + 'startoptions' => 1, 'tdf' => 1, 'template' => 1, 'tags' => 1, @@ -2494,6 +2495,7 @@ __PACKAGE__->register_method({ description => "Wait maximal timeout seconds.", type => 'integer', minimum => 0, + maximum => 86400, default => 'max(30, vm memory in GiB)', optional => 1, }, diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index e9aa248..48e43f8 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -713,6 +713,7 @@ EODESCR description => "Some (read-only) meta-information about this guest.", optional => 1, }, + startoptions => get_standard_option('start-options'), }; my $cicustom_fmt = { diff --git a/PVE/QemuServer/Helpers.pm b/PVE/QemuServer/Helpers.pm index c10d842..ce09db7 100644 --- a/PVE/QemuServer/Helpers.pm +++ b/PVE/QemuServer/Helpers.pm @@ -142,6 +142,10 @@ sub version_cmp { sub config_aware_timeout { my ($config, $is_suspended) = @_; + + my $startup = PVE::JSONSchema::pve_parse_startup_options($config->{startoptions}); + return $startup->{timeout} if defined($startup->{timeout}); + my $memory = $config->{memory}; my $timeout = 30; -- 2.30.2