public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH common v4 1/6] VM start timeout config parameter in backend
Date: Mon, 16 Jan 2023 16:38:53 +0100	[thread overview]
Message-ID: <32281fd9-db24-044e-2b72-51b2cd188f51@proxmox.com> (raw)
In-Reply-To: <20230105100837.195520-2-d.tschlatscher@proxmox.com>

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 <d.tschlatscher@proxmox.com>
> ---
> 
> 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) = @_;





  reply	other threads:[~2023-01-16 15:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-05 10:08 [pve-devel] [PATCH common/qemu-server/manager v4] fix #3502: VM start timeout config parameter Daniel Tschlatscher
2023-01-05 10:08 ` [pve-devel] [PATCH common v4 1/6] VM start timeout config parameter in backend Daniel Tschlatscher
2023-01-16 15:38   ` Thomas Lamprecht [this message]
2023-01-05 10:08 ` [pve-devel] [PATCH qemu-server v4 2/6] expose VM start timeout config setting in API Daniel Tschlatscher
2023-01-05 10:08 ` [pve-devel] [PATCH qemu-server v4 3/6] await and kill lingering KVM thread when VM start reaches timeout Daniel Tschlatscher
2023-01-05 10:08 ` [pve-devel] [PATCH qemu-server v4 4/6] re-check if VM is running and PID for KILL after timeout Daniel Tschlatscher
2023-01-05 10:08 ` [pve-devel] [PATCH qemu-server v4 5/6] make the timeout value editable when the VM is locked Daniel Tschlatscher
2023-01-05 10:08 ` [pve-devel] [PATCH manager v4 6/6] VM start Timeout "Options" parameter in the GUI Daniel Tschlatscher

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=32281fd9-db24-044e-2b72-51b2cd188f51@proxmox.com \
    --to=t.lamprecht@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