From mboxrd@z Thu Jan 1 00:00:00 1970 From: "longtao.pang" Subject: [OSSTEST Nested PATCH v9 5/9] Move the codes about memory size setting into prep() Date: Sat, 2 May 2015 14:28:14 +0800 Message-ID: <1430548098-5233-6-git-send-email-longtaox.pang@intel.com> References: <1430548098-5233-1-git-send-email-longtaox.pang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1430548098-5233-1-git-send-email-longtaox.pang@intel.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.liu2@citrix.com, longtaox.pang@intel.com, Ian.Jackson@eu.citrix.com, Ian.Campbell@citrix.com, robert.hu@intel.com List-Id: xen-devel@lists.xenproject.org From: "longtao.pang" Move the codes about memory size setting from outside into prep(), where these $ram_mb operations are only used; and in next patch, for L2 guest installation, $ram_mb will be override by a runvar value, which needs $gho in scope. Signed-off-by: longtao.pang --- ts-debian-hvm-install | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/ts-debian-hvm-install b/ts-debian-hvm-install index 0085d82..fd28abc 100755 --- a/ts-debian-hvm-install +++ b/ts-debian-hvm-install @@ -149,6 +149,18 @@ sub prep () { target_putfilecontents_root_stash($ho, 10, preseed(), $preseed_file_path); + # If host has >8G free memory, create a guest with 4G memory to catch + # any error that triggers cross 4G boundary + my $host_freemem_mb = host_get_free_memory($ho); + my $ram_minslop = 100; + my $ram_lots = 5000; + if ($host_freemem_mb > $ram_lots * 2 + $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"); + more_prepareguest_hvm($ho,$gho, $ram_mb, $disk_mb, OnReboot => 'preserve', Bios => $r{bios}, @@ -166,18 +178,6 @@ sub prep () { }); } -# If host has >8G free memory, create a guest with 4G memory to catch -# any error that triggers cross 4G boundary -my $host_freemem_mb = host_get_free_memory($ho); -my $ram_minslop = 100; -my $ram_lots = 5000; -if ($host_freemem_mb > $ram_lots * 2 + $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); -- 1.7.10.4