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 58F2C94E22 for ; Mon, 16 Jan 2023 16:39:26 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 31A3F1869 for ; Mon, 16 Jan 2023 16:38:56 +0100 (CET) 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)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Mon, 16 Jan 2023 16:38:54 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id A6AC444B48 for ; Mon, 16 Jan 2023 16:38:54 +0100 (CET) Message-ID: <32281fd9-db24-044e-2b72-51b2cd188f51@proxmox.com> Date: Mon, 16 Jan 2023 16:38:53 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Thunderbird/109.0 Content-Language: en-GB To: Proxmox VE development discussion References: <20230105100837.195520-1-d.tschlatscher@proxmox.com> <20230105100837.195520-2-d.tschlatscher@proxmox.com> From: Thomas Lamprecht In-Reply-To: <20230105100837.195520-2-d.tschlatscher@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.011 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 NICE_REPLY_A -0.097 Looks like a legit reply (A) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pve-devel] [PATCH common v4 1/6] VM start timeout config parameter in backend 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: Mon, 16 Jan 2023 15:39:26 -0000 for anyone wanting to pick this up: high level: it should go into pve-guest-common Am 05/01/2023 um 11:08 schrieb Daniel Tschlatscher: > This allows setting the 'startoptions' property string in the config. > For now this only implements the 'timeout' parameter but should be > rather easily extensible and allow related VM start config options > to be also configurable here. > > Signed-off-by: Daniel Tschlatscher > --- > > Changes from v3: > * No changes > > src/PVE/JSONSchema.pm | 38 ++++++++++++++++++++++++++++++++++++++ > 1 file changed, 38 insertions(+) > > diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm > index 527e409..64dc01b 100644 > --- a/src/PVE/JSONSchema.pm > +++ b/src/PVE/JSONSchema.pm > @@ -640,6 +640,17 @@ sub pve_verify_startup_order { > die "unable to parse startup options\n"; > } > > +register_format('start-options', \&pve_verify_startup_options); would prefer `guest-start-options`, as we have starts for other things (e.g., ceph or systemd services) > +sub pve_verify_startup_options { > + my ($value, $noerr) = @_; > + > + return $value if pve_parse_startup_options($value); > + > + return undef if $noerr; > + > + die "unable to parse vm start options\n"; > +} > + > my %bwlimit_opt = ( > optional => 1, > type => 'number', minimum => '0', > @@ -748,6 +759,33 @@ PVE::JSONSchema::register_standard_option('pve-startup-order', { > typetext => '[[order=]\d+] [,up=\d+] [,down=\d+] ', > }); > > +sub pve_parse_startup_options { > + my ($value) = @_; > + > + return undef if !$value; > + > + my $res = {}; > + > + foreach my $p (split(/,/, $value)) { > + next if $p =~ m/^\s*$/; > + > + if ($p =~ m/^timeout=(\d+)$/ && int($1) <= 86400) { > + $res->{timeout} = $1; > + } else { > + return undef; > + } > + } > + > + return $res; > +} > + > +register_standard_option('start-options', { > + description => "Start up options for the VM. This only allows setting the VM start timeout for now, which is the maximum VM startup timeout in seconds. The maximum value for timeout is 86400, the minimum 0, which disables the timeout completely. If timeout is unset, the timeout will either be the memory of the VM in GiBs or 30, depending on which is higher. If unset and hibernated, the value will at least be 300 seconds, with hugepages at least 150 seconds.", please split to multiple lines with 100cc max each > + optional => 1, > + type => 'string', format => 'start-options', > + typetext => 'timeout=\d+', > +}); > + > register_format('pve-tfa-secret', \&pve_verify_tfa_secret); > sub pve_verify_tfa_secret { > my ($key, $noerr) = @_;