From: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server 1/2] fix #3502: VM start timeout config parameter
Date: Tue, 21 Jun 2022 17:20:24 +0200 [thread overview]
Message-ID: <20220621152026.496514-1-d.tschlatscher@proxmox.com> (raw)
It was already possible to set the timeout parameter for the VM config
via the API. However, the value was not considered when the function
config_aware_timeout() was called.
Now, if the timeout parameter is set, it will override the heuristic
calculation of the VM start timeout.
During testing I found a problem where really big values (10^20)+
would be converted to scientific notation, which means they no longer
pass the integer type check. To get around this, I set the maximum
value for the timeout to 2,680,000 seconds, which is around 31 days.
This I'd wager, is an upper limit in which nobody should realistically
run into.
Signed-off-by: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
---
PVE/API2/Qemu.pm | 1 +
PVE/QemuServer.pm | 7 +++++++
PVE/QemuServer/Helpers.pm | 3 +++
3 files changed, 11 insertions(+)
diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index a824657..d0a4eaa 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -2494,6 +2494,7 @@ __PACKAGE__->register_method({
description => "Wait maximal timeout seconds.",
type => 'integer',
minimum => 0,
+ maximum => 2680000,
default => 'max(30, vm memory in GiB)',
optional => 1,
},
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index e9aa248..81a7f6d 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -713,6 +713,13 @@ EODESCR
description => "Some (read-only) meta-information about this guest.",
optional => 1,
},
+ timeout => {
+ optional => 1,
+ type => 'integer',
+ description => 'The maximum timeout to wait for a VM to start',
+ minimum => 0,
+ maximum => 2680000,
+ }
};
my $cicustom_fmt = {
diff --git a/PVE/QemuServer/Helpers.pm b/PVE/QemuServer/Helpers.pm
index c10d842..c26d0dc 100644
--- a/PVE/QemuServer/Helpers.pm
+++ b/PVE/QemuServer/Helpers.pm
@@ -142,6 +142,9 @@ sub version_cmp {
sub config_aware_timeout {
my ($config, $is_suspended) = @_;
+
+ return $config->{timeout} if defined($config->{timeout});
+
my $memory = $config->{memory};
my $timeout = 30;
--
2.30.2
next reply other threads:[~2022-06-21 15:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-21 15:20 Daniel Tschlatscher [this message]
2022-06-21 15:20 ` [pve-devel] [PATCH manager 2/2] VM start Timeout "Options" parameter in the GUI Daniel Tschlatscher
2022-06-21 15:20 ` [pve-devel] [PATCH qemu-server 1/1] make the timeout value editable when the VM is locked Daniel Tschlatscher
2022-06-21 15:52 ` [pve-devel] [PATCH qemu-server 1/2] fix #3502: VM start timeout config parameter Thomas Lamprecht
2022-06-21 15:59 ` Thomas Lamprecht
2022-06-22 12:57 ` 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=20220621152026.496514-1-d.tschlatscher@proxmox.com \
--to=d.tschlatscher@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