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

[Xen-devel] [PATCH OSSTEST 12/12] Changes to test step of xen install



 This patch accomodates ts-xen-install to nested L1 xen
 installation usage. Its change is relatively simpler than
 ts-debain-hvm-install. We simply alter '$ho' usage to 'w_ho', which is
 assigned to '$ho' in original L0 installation context, while assigned to
 '$gho' in L1 Xen installation context. Other subroutines keeps unchanged. The
 main procedure of L1 context installation is similar to native L0
 installations: 1. install necessary packages 2. extract built xen dist and
 kernel dist tarballs 3. But we skip forbidden() for L1 xen installation 4.
 then adjustconfig() 5. setup init daemons 6. then uncomment 'nestedhvm' in L1
 configuration and sync to disk 7. ready to reboot L1 normal guest to get into
 a nested Xen environment 8. wait until the L1 Xen boot up.

---
 ts-xen-install | 126 ++++++++++++++++++++++++++++++++++++---------------------
 1 file changed, 79 insertions(+), 47 deletions(-)

diff --git a/ts-xen-install b/ts-xen-install
index 4d34d1f..6248157 100755
--- a/ts-xen-install
+++ b/ts-xen-install
@@ -28,39 +28,45 @@ use Osstest::CXFabric;
 my $checkmode= 0;
 
 tsreadconfig();
-
+our $w_ho;
 our @hos;
-
-if (@ARGV and $ARGV[0] eq '--check') {
-    $checkmode= 1;
-    shift @ARGV;
-    logm("checking builds are done...");
+our ($whhost,$gn,$nested_build) = @ARGV;
+$nested_build ||= '';
+if ($nested_build eq 'nested_build') {
+    $whhost ||= 'host';
+    $gn ||= 'nested';
 } else {
-    if (!@ARGV) {
-       push @ARGV, 'host';
-    }
-    foreach my $k (@ARGV) {
-        push @hos, selecthost($k);
+    if (@ARGV and $ARGV[0] eq '--check') {
+        $checkmode= 1;
+        shift @ARGV;
+        logm("checking builds are done...");
+    } else {
+        if (!@ARGV) {
+            push @ARGV, 'host';
+        }
+        foreach my $k (@ARGV) {
+            push @hos, selecthost($k);
+        }
     }
 }
-
 our $ho;
-
+our $gho;
+our $toolstack= toolstack()->{Command};
 my %distpath;
 
 sub packages () {
-    target_install_packages($ho,
+    target_install_packages($w_ho,
                             qw(bridge-utils vncsnapshot libaio1 libpixman-1-0
                                libsdl1.2debian libglib2.0-0 liblzma5));
-    target_install_packages($ho,
+    target_install_packages($w_ho,
                            $ho->{Suite} =~ /squeeze/ ? "libyajl1" : 
"libyajl2");
     if ($ho->{Suite} !~ m/lenny|squeeze/) {
-        target_install_packages($ho, 'libfdt1');
+        target_install_packages($w_ho, 'libfdt1');
     }
     if ($r{arch} eq 'i386') {
-       target_install_packages($ho, 'libc6-xen');
+       target_install_packages($w_ho, 'libc6-xen');
     }
-    target_install_packages($ho, @{toolstack()->{ExtraPackages}})
+    target_install_packages($w_ho, @{toolstack()->{ExtraPackages}})
         if toolstack()->{ExtraPackages};
 }
 
@@ -69,14 +75,14 @@ sub extract () {
     push @parts, 'libvirt' if $r{toolstack} eq "libvirt";
 
     foreach my $part (@parts) {
-        target_extract_jobdistpath($ho, $part, "path_${part}dist",
+        target_extract_jobdistpath($w_ho, $part, "path_${part}dist",
                                   $r{"${part}buildjob"}, \%distpath);
     }
-    target_cmd_root($ho, '/sbin/ldconfig');
+    target_cmd_root($w_ho, '/sbin/ldconfig');
 }
 
 sub adjustconfig () {
-    target_editfile_root($ho, "/etc/xen/xend-config.sxp",
+    target_editfile_root($w_ho, "/etc/xen/xend-config.sxp",
                         "xend-config.sxp", sub {
        my (@domains) = (qw(localhost localhost.localdomain),
                         ".".$c{DnsDomain}, ".".$c{TestHostDomain});
@@ -108,13 +114,13 @@ sub adjustconfig () {
                         /etc/sysconfig/xencommons
                         /etc/default/xend
                         /etc/sysconfig/xend)) {
-        next unless target_file_exists($ho, $try);
+        next unless target_file_exists($w_ho, $try);
         $trace_config_file= $try;
         last;
     }
     die unless defined $trace_config_file;
 
-    target_editfile_root($ho, $trace_config_file, sub {
+    target_editfile_root($w_ho, $trace_config_file, sub {
         my $prnow;
         $prnow= sub {
             print EO "XENCONSOLED_TRACE=guest\n" or die $!;
@@ -128,7 +134,7 @@ sub adjustconfig () {
         $prnow->();
     });
 
-    target_cmd_root($ho, 'mkdir -p /var/log/xen/console');
+    target_cmd_root($w_ho, 'mkdir -p /var/log/xen/console');
 
     setup_cxfabric($ho);
 }
@@ -136,13 +142,13 @@ sub adjustconfig () {
 sub setupboot () {
     my $xenhopt= "conswitch=x watchdog";
 
-    my $cons= get_host_property($ho, 'XenSerialConsole', 'com1');
+    my $cons= get_host_property($w_ho, 'XenSerialConsole', 'com1');
 
     if ( $cons eq "com1" ) {
        $xenhopt .= " com1=$c{Baud},8n1 console=com1,vga gdb=com1";
     } elsif ( $cons eq "dtuart" ) {
        $xenhopt .= " console=dtuart";
-       my $dtuart= get_host_property($ho, 'XenDTUARTPath', undef);
+       my $dtuart= get_host_property($w_ho, 'XenDTUARTPath', undef);
        $xenhopt .= " dtuart=$dtuart" if $dtuart;
     } else {
        logm("No Xen console device defined for host");
@@ -152,37 +158,38 @@ sub setupboot () {
     }
     my $append= $r{xen_boot_append};
     $xenhopt .= " $append" if defined $append;
-    $append = get_host_property($ho, 'xen-commandline-append', undef);
+    $append = get_host_property($w_ho, 'xen-commandline-append', undef);
     $xenhopt .= " $append" if defined $append;
 
     my @hooks;
 
-    if (host_involves_pcipassthrough($ho)) {
+    if (host_involves_pcipassthrough($w_ho)) {
         push @hooks, {
             EditBootOptions => sub {
-                my ($ho,$hopt,$kopt) = @_;
+                my ($w_ho,$hopt,$kopt) = @_;
                 $$hopt .= ' iommu=on';
                 my $hide= ' xen-pciback.hide='. join '',map { "($_->{Bdf})" }
-                    host_get_pcipassthrough_devs($ho);
+                host_get_pcipassthrough_devs($w_ho);
                 logm("pci passthrough: hiding in dom0: $hide");
                 $$kopt .= $hide;
-            }
-        };
-    }
+                }
+            };
+        }
 
     my $want_kernver = get_runvar('kernel_ver',$r{'kernbuildjob'});
-    debian_boot_setup($ho, $want_kernver, $xenhopt, \%distpath, \@hooks);
+    debian_boot_setup($w_ho, $want_kernver, $xenhopt, \%distpath, \@hooks);
 
     logm("ready to boot Xen");
 }
 
+
 our $initscripts_nobridge;
 
 sub setupinitd () {
     my $ts= toolstack();
     my $xencommons= '/etc/init.d/xencommons';
     my $have_xencommons=
-        !!target_cmd_output_root($ho, <<END);
+        !!target_cmd_output_root($w_ho, <<END);
  if test -f $xencommons && ! grep 'FOR USE WITH LIBXL' $xencommons >/dev/null
  then
    echo y
@@ -211,13 +218,13 @@ END
         $updatercd->($initd,93) if defined $initd;
         $updatercd->('xenbridge',38) if $ts->{OldSeparateBridgeInitd};
     }
-    target_cmd_root($ho, $cmd);
+    target_cmd_root($w_ho, $cmd);
 }
 
 sub nodhcp () {
-    target_editfile_root($ho, "/etc/network/interfaces",
+    target_editfile_root($w_ho, "/etc/network/interfaces",
                          "etc-network-interfaces", sub {
-        my $physif= get_host_property($ho,'interface force',undef);
+        my $physif= get_host_property($w_ho,'interface force',undef);
 
        if (!defined $physif) {
            # preread /etc/network/interfaces to figure out the interface
@@ -267,7 +274,7 @@ END
            $bridgex= '';
         }
 
-       my $routes= target_cmd_output_root($ho, "route -n");
+       my $routes= target_cmd_output_root($w_ho, "route -n");
 
        $routes =~ m/^ [0-9.]+ \s+ 0\.0\.0\.0 \s+ ([0-9.]+) \s+ \S*U\S* \s /mxi
            or die "no own local network in route ?  $routes ";
@@ -289,7 +296,7 @@ END
                 $suppress= 1;
                 print EO <<END;
 iface $iface inet static
-    address $ho->{Ip}
+    address $w_ho->{Ip}
     netmask $netmask
     gateway $gateway
 $bridgex
@@ -322,17 +329,42 @@ sub forbidden () {
 END
 }
 
-if ($checkmode) {
-    extract();
-} else {
-    die if @hos > 1;
-    $ho= $hos[0];
-    
+if ($nested_build eq 'nested_build') {
+    $ho= selecthost($whhost);
+    $gho= selectguest($gn,$ho);
+    $w_ho = $gho;
+    store_runvar("$gho->{Guest}_kernkind",$r{'kernkind'});
+    $gho->{Suite}=$ho->{Suite};
+    guest_check_ip($gho);
     packages();
     extract();
-    forbidden();
     adjustconfig();
     setupboot();
     setupinitd();
+    guest_editconfig($gho->{Host}, $gho, sub {
+        s/#nestedhvm/nestedhvm/;
+        });
+    target_cmd_root($gho,"sync");
     nodhcp();
+    logm("Ready to boot L1 Xen");
+    target_cmd_root($gho,"init 0");
+    target_await_down($gho,60);
+    guest_create($gho,$toolstack);
+    guest_await($gho, target_var($gho,'boot_timeout'));
+    guest_check_up($gho);
+} else {
+    if ($checkmode) {
+        extract();
+    } else {
+        die if @hos > 1;
+        $ho= $hos[0];
+        $w_ho = $ho;
+        packages();
+        extract();
+        forbidden();
+        adjustconfig();
+        setupboot();
+        setupinitd();
+        nodhcp();
+    }
 }
-- 
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®.