[pve-devel] [PATCH qemu-server 1/4] add new helper to calculate timeout based on vm config

Tim Marx t.marx at proxmox.com
Tue Jan 14 12:53:30 CET 2020


Signed-off-by: Tim Marx <t.marx at proxmox.com>
---
 PVE/QemuServer/Helpers.pm | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/PVE/QemuServer/Helpers.pm b/PVE/QemuServer/Helpers.pm
index fcc9392..86bf3d9 100644
--- a/PVE/QemuServer/Helpers.pm
+++ b/PVE/QemuServer/Helpers.pm
@@ -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,24 @@ sub version_cmp {
     return 0;
 }
 
+sub config_aware_timeout {
+    my ($memory, $hugepages, $is_suspended) = @_;
+    my $timeout = 30;
+
+    # Currently based on user reports
+    if (defined($memory) && $memory > 30720) {
+	$timeout = int($memory/1024);
+    }
+
+    if ($is_suspended  && $timeout < 300) {
+	$timeout = 300;
+    }
+
+    if ($hugepages && $timeout < 150) {
+	$timeout = 150;
+    }
+
+    return $timeout;
+}
+
 1;
-- 
2.20.1




More information about the pve-devel mailing list