]> xenbits.xensource.com Git - people/liuw/osstest.git/commitdiff
Edit some APIs in TestSupport.pm for nested test
authorlongtao.pang <longtaox.pang@intel.com>
Wed, 13 May 2015 03:36:39 +0000 (11:36 +0800)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 22 May 2015 13:38:16 +0000 (14:38 +0100)
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 <longtaox.pang@intel.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- resolved conflict with addition of ${viftype}, made
         ${vifmodel} a prefix rather than postfix thing for
         consistency with ${viftype}. ]

Osstest/TestSupport.pm

index abb319509e401cccc06f6da32f79cd10b1172244..1f3bab24b5963f0fb2ff05821500902f19f11f00 100644 (file)
@@ -879,13 +879,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 -----
 
@@ -1528,13 +1532,15 @@ sub prepareguest ($$$$$$) {
     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, use 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"}) {
@@ -1562,12 +1568,14 @@ sub prepareguest_part_xencfg ($$$$$) {
     my $oncrash= $xopts->{OnCrash} || 'preserve';
     my $vcpus= guest_var($gho, 'vcpus', $xopts->{DefVcpus} || 2);
     my $viftype= $xopts->{VifType} ? "type=$xopts->{VifType}," : "";
+    my $vif= guest_var($gho, 'vifmodel','');
+    my $vifmodel= $vif ? "model=$vif," : '';
     my $xoptcfg= $xopts->{ExtraConfig};
     $xoptcfg='' unless defined $xoptcfg;
     my $xencfg= <<END;
 name        = '$gho->{Name}'
 memory = ${ram_mb}
-vif         = [ '${viftype}mac=$gho->{Ether}' ]
+vif         = [ '${viftype}${vifmodel}mac=$gho->{Ether}' ]
 #
 on_poweroff = '$onpoweroff'
 on_reboot   = '$onreboot'