mirror of
git://git.proxmox.com/git/qemu-server.git
synced 2025-03-08 04:58:26 +03:00
add new helper to calculate timeout based on vm config
Signed-off-by: Tim Marx <t.marx@proxmox.com>
This commit is contained in:
parent
52cffab6b5
commit
2f18c84dc7
@ -41,7 +41,7 @@ use PVE::Tools qw(run_command lock_file lock_file_full file_read_firstline file_
|
||||
|
||||
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;
|
||||
@ -5541,7 +5541,7 @@ sub vm_start {
|
||||
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,
|
||||
|
@ -11,6 +11,7 @@ use PVE::ProcFSTools;
|
||||
use base 'Exporter';
|
||||
our @EXPORT_OK = qw(
|
||||
min_version
|
||||
config_aware_timeout
|
||||
);
|
||||
|
||||
my $nodename = PVE::INotify::nodename();
|
||||
@ -139,4 +140,25 @@ sub version_cmp {
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user