From: Wei Liu Subject: [PATCH V2 2/2] ts-debian-hvm-install: fix guest memory size Date: Mon, 14 Apr 2014 16:31:56 +0100 Message-ID: <1397489516-4988-3-git-send-email-wei.liu2@citrix.com> References: <1397489516-4988-1-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1397489516-4988-1-git-send-email-wei.liu2@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Wei Liu , ian.jackson@eu.citrix.com, ian.campbell@citrix.com List-Id: xen-devel@lists.xenproject.org If the host has more than 5G free memory, change guest memory size to 5G to catch any error that triggers by crossing 4G boundary. Otherwise guest memory size is set to 768 MB (taken from ts-redhat-install) which should be a safe value to run this testcase on every host. Signed-off-by: Wei Liu --- ts-debian-hvm-install | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ts-debian-hvm-install b/ts-debian-hvm-install index 1b58108..8289ffb 100755 --- a/ts-debian-hvm-install +++ b/ts-debian-hvm-install @@ -32,7 +32,8 @@ $gn ||= 'ovmf'; our $ho= selecthost($whhost); -our $ram_mb= 6000; +# guest memory size will be set based on host free memory, see below +our $ram_mb= 0; our $disk_mb= 10000; our $guesthost= "$gn.guest.osstest"; @@ -166,6 +167,18 @@ sub prep () { }); } +# If host has >5G free memory, create a guest with 5G memory to catch any error +# that triggers cross 4G boundary +my $host_freemem_mb = host_get_free_memory($ho, $toolstack); +my $ram_minslop = 100; +my $ram_lots = 5000; +if ($host_freemem_mb > $ram_lots + $ram_minslop) { + $ram_mb = $ram_lots; +} else { + $ram_mb = 768; +} +logm("Host has $host_freemem_mb MB free memory, setting guest memory size to $ram_mb MB"); + if (!$stage) { prep(); guest_create($gho,$toolstack); -- 1.7.10.4