From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robert Ho Subject: [OSSTest Nested v12 19/21] Selecthost uses dynamic IP address if the host is not configured static IP. Date: Fri, 28 Aug 2015 23:08:08 +0800 Message-ID: <1440774490-16725-20-git-send-email-robert.hu@intel.com> References: <1440774490-16725-1-git-send-email-robert.hu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1440774490-16725-1-git-send-email-robert.hu@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, robert.hu@intel.com Cc: wei.liu2@citrix.com, Ian.Jackson@eu.citrix.com, ian.campbell@citrix.com, di.zheng@intel.com, gordon.jin@intel.com List-Id: xen-devel@lists.xenproject.org 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 --- 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