All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Ho <robert.hu@intel.com>
To: xen-devel@lists.xen.org
Cc: wei.liu2@citrix.com, ian.campbell@citrix.com,
	ian.jackson@eu.citrix.com, jfehlig@suse.com,
	Robert Ho <robert.hu@intel.com>,
	longtaox.pang@intel.com
Subject: [PATCH OSSTEST 12/12] Changes to test step of xen install
Date: Wed, 11 Feb 2015 17:52:21 +0800	[thread overview]
Message-ID: <1423648341-203755-13-git-send-email-robert.hu@intel.com> (raw)
In-Reply-To: <1423648341-203755-1-git-send-email-robert.hu@intel.com>

 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

  parent reply	other threads:[~2015-02-11  9:52 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-11  9:52 [PATCH OSSTEST 00/12] Add nested xen on xen test case Robert Ho
2015-02-11  9:52 ` [PATCH OSSTEST 01/12] Add support of parsing grub which has 'submenu' primitive Robert Ho
2015-02-11 14:44   ` Ian Jackson
2015-02-12  2:01     ` Hu, Robert
2015-02-12 10:13       ` Wei Liu
2015-02-12 18:32         ` Ian Jackson
2015-02-13  7:07           ` Hu, Robert
2015-02-13  6:25         ` Hu, Robert
2015-02-12  4:23     ` Ian Campbell
2015-02-11  9:52 ` [PATCH OSSTEST 02/12] Increase boot timer to accomodate to nest test Robert Ho
2015-02-11 14:47   ` Ian Jackson
2015-02-13  8:13     ` Hu, Robert
2015-02-13 11:41       ` Ian Jackson
2015-02-11  9:52 ` [PATCH OSSTEST 03/12] Designate vif device model to e1000 Robert Ho
2015-02-11 14:49   ` Ian Jackson
2015-02-13  8:32     ` Hu, Robert
2015-02-11  9:52 ` [PATCH OSSTEST 04/12] Just some indentation adustments Robert Ho
2015-02-11 14:50   ` Ian Jackson
2015-02-11  9:52 ` [PATCH OSSTEST 05/12] Add and expose some testsupport APIs Robert Ho
2015-02-11 14:54   ` Ian Jackson
2015-02-13  8:23     ` Hu, Robert
2015-03-04  6:21     ` Pang, LongtaoX
2015-02-11  9:52 ` [PATCH OSSTEST 06/12] Manipulate $ho IP assignment for nest L2 situation Robert Ho
2015-02-11 14:58   ` Ian Jackson
2015-02-13  8:37     ` Hu, Robert
2015-02-11  9:52 ` [PATCH OSSTEST 07/12] For hvm guest configuration, config console to 'hvc0' Robert Ho
2015-02-11 17:03   ` Ian Jackson
2015-02-13  7:31     ` Hu, Robert
2015-02-11  9:52 ` [PATCH OSSTEST 08/12] Add test job for nest test case Robert Ho
2015-02-11 17:02   ` Ian Jackson
2015-02-11  9:52 ` [PATCH OSSTEST 09/12] Add build hvm job for nested test use Robert Ho
2015-02-11 17:04   ` Ian Jackson
2015-02-11  9:52 ` [PATCH OSSTEST 10/12] Compose the main body of test-nested test job Robert Ho
2015-02-11 17:07   ` Ian Jackson
2015-02-13  7:14     ` Hu, Robert
2015-02-11  9:52 ` [PATCH OSSTEST 11/12] Changes on test step of debain hvm guest install Robert Ho
2015-02-12 18:16   ` Ian Jackson
2015-02-13  6:47     ` Hu, Robert
2015-02-13 12:02       ` Ian Jackson
2015-02-15  9:43         ` Hu, Robert
2015-02-16 10:16           ` Wei Liu
2015-02-17  0:45             ` Hu, Robert
2015-02-17 10:37               ` Wei Liu
2015-02-17 10:46                 ` Wei Liu
2015-03-04  9:02                   ` Pang, LongtaoX
2015-02-17 11:24             ` Ian Jackson
2015-02-11  9:52 ` Robert Ho [this message]
2015-02-11 17:17   ` [PATCH OSSTEST 12/12] Changes to test step of xen install Ian Jackson
2015-02-12 18:20   ` Ian Jackson
2015-02-13  7:03     ` Hu, Robert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1423648341-203755-13-git-send-email-robert.hu@intel.com \
    --to=robert.hu@intel.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jfehlig@suse.com \
    --cc=longtaox.pang@intel.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.