From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Jackson Subject: [OSSTEST PATCH 13/26] selecthost: Support nested hosts (guests which are also hosts) Date: Fri, 25 Sep 2015 20:15:09 +0100 Message-ID: <1443208522-24905-5-git-send-email-ian.jackson@eu.citrix.com> References: <1443181028-22705-1-git-send-email-ian.jackson@eu.citrix.com> <1443208522-24905-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZfYTX-0001e5-T6 for xen-devel@lists.xenproject.org; Fri, 25 Sep 2015 19:16:08 +0000 In-Reply-To: <1443208522-24905-1-git-send-email-ian.jackson@eu.citrix.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.xenproject.org Cc: Robert Ho , Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org We introduce a new syntax: instead of a hostname (which might appear in a command line argument to a ts-* script and hence be passed to selecthost, or which might be in a runvar), we now support :. Such `hosts' (let us refer to such a thing as an L1, although in principle further nesting may be possible) are expected to be dynamically created. So they do not have flags and properties in the configuration (or in an Executive instance's database). The IP address is determined dynamically from the leases file. If the L1 is not running, then no IP address may be found. This is not an error. Users of this facility will need to make sure that ts-* scripts which are unaware of the L1's special status are only invoked when it is known that the L1 is up and has obtained its IP address. `Power cycling' the L1 will be done by VM control operations in the L0; this will come in a subsequent patch. `Serial access' to the L1 guest will likewise need to be done via the console arrangements in L0. Signed-off-by: Ian Jackson --- v14: New patch --- Osstest/TestSupport.pm | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index 8f0122c..9b10602 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -801,6 +801,7 @@ sub power_state ($$) { #---------- host selection and properties ---------- +sub selecthost ($); sub selecthost ($) { my ($ident) = @_; # must be run outside transaction @@ -815,8 +816,12 @@ sub selecthost ($) { # which means ignore except for logging purposes etc. # and use # - # uis which means use that host (and all + # can be which means use that host (and all # its flags and properties from the configuration and database) + # OR + # can be : meaning use the + # Xen domain name on the host specified by + # , which is an as above. my $name; if ($ident =~ m/=/) { @@ -832,6 +837,7 @@ sub selecthost ($) { Ident => $ident, Name => $name, TcpCheckPort => 22, + NestingLevel => 0, Info => [], }; if (defined $job) { @@ -839,6 +845,35 @@ sub selecthost ($) { $c{DebianSuite}); } + #----- handle hosts which are themselves guests (nested) ----- + + if ($name =~ s/^(.*)://) { + my $parentname = $1; + my $parent = selecthost($parentname); + my $child = selectguest($name,$parent); + $child->{Ident} = $ho->{Ident}; + $child->{Info} = [ "in", $parent->{Name}, @{ $parent->{Info} } ]; + $child->{NestingLevel} = $parent->{NestingLevel}+1; + + # $child->{Power} = 'guest'; todo + power_cycle_host_setup($child); + + $child->{Properties}{Serial} = 'noop'; # todo + serial_host_setup($child); + + my $msg = "L$child->{NestingLevel} host $child->{Ident}:"; + $msg .= " guest $child->{Guest} (@{ $child->{Info} })"; + $msg .= " $child->{Ether}"; + + my $err = guest_check_ip($child); + $msg .= " ".(defined $err ? " $err" : $child->{Ip}); + + logm($msg); + + # all the rest of selecthost is wrong for this case + return $child; + } + #----- calculation of the host's properties ----- $ho->{Properties} = { }; -- 1.7.10.4