Signed-off-by: Tim Marx <t.marx@proxmox.com>
use PVE::QMPClient;
use PVE::QemuConfig;
-use PVE::QemuServer::Helpers qw(min_version);
+use PVE::QemuServer::Helpers qw(min_version config_aware_timeout);
use PVE::QemuServer::Cloudinit;
use PVE::QemuServer::Machine;
use PVE::QemuServer::Memory;
my $cpuunits = defined($conf->{cpuunits}) ? $conf->{cpuunits}
: $defaults->{cpuunits};
- my $start_timeout = ($conf->{hugepages} || $is_suspended) ? 300 : 30;
+ my $start_timeout = config_aware_timeout($conf, $is_suspended);
my %run_params = (
timeout => $statefile ? undef : $start_timeout,
umask => 0077,
use base 'Exporter';
our @EXPORT_OK = qw(
min_version
+config_aware_timeout
);
my $nodename = PVE::INotify::nodename();
return 0;
}
+sub config_aware_timeout {
+ my ($config, $is_suspended) = @_;
+ my $memory = $config->{memory};
+ my $timeout = 30;
+
+ # Based on user reported startup time for vm with 512GiB @ 4-5 minutes
+ if (defined($memory) && $memory > 30720) {
+ $timeout = int($memory/1024);
+ }
+
+ if ($is_suspended && $timeout < 300) {
+ $timeout = 300;
+ }
+
+ if ($config->{hugepages} && $timeout < 150) {
+ $timeout = 150;
+ }
+
+ return $timeout;
+}
+
1;