[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [OSSTest Nested v12 19/21] Selecthost uses dynamic IP address if the host is not configured static IP.



In this patch
1. in check_ip(), we change $lstash to use {Name} key-value, rather
than {Guest}, because {Name} is both usable by $ho and $gho hash.
2. $ho->{Ether} assignment: if configured in host property, good, use
it; otherwise, try to see if runvar has the assignment (this is the
case of nested test).

Signed-off-by: Robert Ho <robert.hu@xxxxxxxxx>
---
 Osstest/DhcpWatch/leases.pm |  2 +-
 Osstest/TestSupport.pm      | 23 +++++++++++++----------
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/Osstest/DhcpWatch/leases.pm b/Osstest/DhcpWatch/leases.pm
index 9a74c40..16e67d3 100644
--- a/Osstest/DhcpWatch/leases.pm
+++ b/Osstest/DhcpWatch/leases.pm
@@ -61,7 +61,7 @@ sub check_ip ($$) {
        if (!defined $leases) { return "connect to $leasesfn: $!"; }
     }
 
-    my $lstash= "dhcpleases-$gho->{Guest}";
+    my $lstash= "dhcpleases-$gho->{Name}";
     my $inlease;
     my $props;
     my $best;
diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 06a0c57..1d1d6b1 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -875,7 +875,7 @@ sub selecthost ($) {
     $ho->{Fqdn} = get_host_property($ho,'fqdn',$defaultfqdn);
 
 
-    $ho->{Ether}= get_host_property($ho,'ether');
+    $ho->{Ether}= get_host_property($ho,'ether') || $r{"$ho->{Ident}_ether"};
     $ho->{DiskDevice}= get_host_property($ho,'disk-device');
     $ho->{Power}= get_host_property($ho,'power-method');
     if ($ho->{Ident} =~ m/l1|l2/) {
@@ -889,17 +889,20 @@ sub selecthost ($) {
     serial_host_setup($ho);
 
     $ho->{IpStatic} = get_host_property($ho,'ip-addr');
-    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;
+    if (!defined $ho->{IpStatic}) {
+       my $ip_packed= gethostbyname($ho->{Fqdn});
+       if (!$ip_packed) {
+           logm("Going to look for $ho->{Name}'s ether: $ho->{Ether}");
+           $ho->{DhcpWatch}->check_ip($ho);
+           $ho->{IpStatic}=$ho->{Ip};
+       }
+#      die "$ho->{Fqdn} ?" unless $ip_packed;
+       else {
            $ho->{IpStatic}= inet_ntoa($ip_packed);
            die "$ho->{Fqdn} ?" unless defined $ho->{IpStatic};
-        }
-        $ho->{Ip}= $ho->{IpStatic};
-    }
+           $ho->{Ip}= $ho->{IpStatic};
+       }
+    }    
 
     #----- tftp -----
 
-- 
1.8.3.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.