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

[Xen-devel] [OSSTEST PATCH 13/26] selecthost: Support nested hosts (guests which are also hosts)



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
<hostspec>:<domname>.

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 <Ian.Jackson@xxxxxxxxxxxxx>
---
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 <ident> except for logging purposes etc.
     # and use <hostspec>
     #
-    # <hostspec> uis <hostname> which means use that host (and all
+    # <hostspec> can be <hostname> which means use that host (and all
     # its flags and properties from the configuration and database)
+    # OR
+    # <hostspec> can be <parent_identspec>:<domname> meaning use the
+    # Xen domain name <domname> on the host specified by
+    # <parent_identspec>, which is an <identspec> 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 ? "<no-ip> $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


_______________________________________________
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®.