From mboxrd@z Thu Jan 1 00:00:00 1970 From: "longtao.pang" Subject: [OSSTEST Nested PATCH v9 4/9] Edit some APIs in TestSupport.pm for nested test Date: Sat, 2 May 2015 14:28:13 +0800 Message-ID: <1430548098-5233-5-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" 1. If vif model is defined for guest, use it in guest's configuration 2. In L2 installation context, its host (L1) shall not have a static IP but stored in runvar in L1 installation before; use this stored runvar IP. Signed-off-by: longtao.pang --- Changes in v9: 1. Refactor 'selecthost' to set L1 guest's IpAddr for nested job. 2. Change $vifmodel to a reasonable format. 3. Refactor 'prepareguest' to use a specific disksize for nested L1 guest. --- Osstest/TestSupport.pm | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index 1bde67d..2d7ecc0 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -865,13 +865,17 @@ sub selecthost ($) { serial_host_setup($ho); $ho->{IpStatic} = get_host_property($ho,'ip-addr'); - if (!defined $ho->{IpStatic}) { - my $ip_packed= gethostbyname($ho->{Fqdn}); - die "$ho->{Fqdn} ?" unless $ip_packed; - $ho->{IpStatic}= inet_ntoa($ip_packed); - die "$ho->{Fqdn} ?" unless defined $ho->{IpStatic}; + if (defined $r{"${ident}_ip"}) { + $ho->{Ip} = $r{"${ident}_ip"}; + } else { + if (!defined $ho->{IpStatic}) { + my $ip_packed= gethostbyname($ho->{Fqdn}); + die "$ho->{Fqdn} ?" unless $ip_packed; + $ho->{IpStatic}= inet_ntoa($ip_packed); + die "$ho->{Fqdn} ?" unless defined $ho->{IpStatic}; + } + $ho->{Ip}= $ho->{IpStatic}; } - $ho->{Ip}= $ho->{IpStatic}; #----- tftp ----- @@ -1513,14 +1517,15 @@ sub prepareguest ($$$$$$) { store_runvar("${gn}_hostname", $hostname); store_runvar("${gn}_tcpcheckport", $tcpcheckport); store_runvar("${gn}_boot_timeout", $boot_timeout); + my $gho= selectguest($gn, $ho); + store_runvar("${gn}_domname", $gho->{Name}); + #if we have defined guest specific disksize, override it + $mb = guest_var($gho,'disksize',$mb); if (defined $mb) { store_runvar("${gn}_disk_lv", $r{"${gn}_hostname"}.'-disk'); } - my $gho= selectguest($gn, $ho); - store_runvar("${gn}_domname", $gho->{Name}); - if (defined $mb) { store_runvar("${gn}_vg", ''); if (!length $r{"${gn}_vg"}) { @@ -1548,11 +1553,13 @@ sub prepareguest_part_xencfg ($$$$$) { my $oncrash= $xopts->{OnCrash} || 'preserve'; my $vcpus= guest_var($gho, 'vcpus', $xopts->{DefVcpus} || 2); my $xoptcfg= $xopts->{ExtraConfig}; + my $vif= guest_var($gho, 'vifmodel',''); + my $vifmodel= $vif ? ",model=$vif" : ''; $xoptcfg='' unless defined $xoptcfg; my $xencfg= <{Ether}' ] +vif = [ 'type=ioemu,mac=$gho->{Ether}${vifmodel}' ] # on_poweroff = '$onpoweroff' on_reboot = '$onreboot' -- 1.7.10.4