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 11/12] Changes on test step of debain hvm guest install
Date: Wed, 11 Feb 2015 17:52:20 +0800	[thread overview]
Message-ID: <1423648341-203755-12-git-send-email-robert.hu@intel.com> (raw)
In-Reply-To: <1423648341-203755-1-git-send-email-robert.hu@intel.com>

 This patch is to make ts-debian-hvm-install accomodate
 to nested L1 and L2 guest installation context. 1. Add an input param
 'nested' to indicate which installation    context is. and manipulating 'gn'
 accordingly. 2. increase disk size to accomodate to nested test requirment.
 3. increase root partition size in preseed generation. 4. in L2 installation
 context, need to explicitly get its MAC    address from run var. 5. in hvm
 guest configuration file, add '#nestedhvm=1', which will    later be
 uncommented by guest_editconfig_cd() after xen installed    in L1, and about
 to boot into a nested xen environment. 6. in L1 installation context, assign
 more memory to it; since it    acts as a nested hypervisor anyway. 7.
 allocate a vg (vollum group) from L0 disk space, and attach it    it to L1,
 used dedicatedly for L2 disk space. 8. In L1 installation context, need to
 store some run vars ( its IP,    name, ident), so that in later L2
 installation context, can fetch    these information. 9. In L2 installation,
 after it's created, installed and reboot    successfully, we then power it
 off.

---
 ts-debian-hvm-install | 63 +++++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 53 insertions(+), 10 deletions(-)

diff --git a/ts-debian-hvm-install b/ts-debian-hvm-install
index 37eade2..e905698 100755
--- a/ts-debian-hvm-install
+++ b/ts-debian-hvm-install
@@ -28,22 +28,30 @@ if (@ARGV && $ARGV[0] =~ m/^--stage(\d+)$/) { $stage=$1; shift @ARGV; }
 
 defined($r{bios}) or die "Need to define which bios to use";
 
-our ($whhost,$gn) = @ARGV;
+our ($whhost,$gn,$nested) = @ARGV;
 $whhost ||= 'host';
-$gn ||= 'debianhvm';
-
+$nested ||= '';
+our $guesthost;
+our $L1_IP;
+if ($nested eq 'nested_L1') {
+    $gn ||= 'nested';
+    $guesthost ||= "$gn.l1.osstest";
+} elsif ($nested eq 'nested_L2') {
+    $whhost = 'L1_host';
+    $gn ||= 'nested2';
+    $guesthost ||= "$gn.l2.osstest";
+} else {
+    $gn ||= 'debianhvm';
+    $guesthost= "$gn.guest.osstest";
+}
 our $ho= selecthost($whhost);
-
+our $disk_mb= 15000;
 # guest memory size will be set based on host free memory, see below
 our $ram_mb;
-our $disk_mb= 10000;
-
-our $guesthost= "$gn.guest.osstest";
 our $gho;
 
 our $toolstack= toolstack()->{Command};
 
-
 sub preseed () {
 
     my $preseed_file = preseed_base('wheezy','',());
@@ -63,7 +71,7 @@ d-i partman-auto/expert_recipe string \\
                         use_filesystem{ } filesystem{ vfat } \\
                         mountpoint{ /boot/efi } \\
                 . \\
-                5000 50 5000 ext4 \\
+                10000 50 10000 ext4 \\
                         method{ format } format{ } \\
                         use_filesystem{ } filesystem{ ext4 } \\
                         mountpoint{ / } \\
@@ -135,6 +143,7 @@ sub prep () {
     $gho= prepareguest($ho, $gn, $guesthost, 22,
                        $disk_mb + 1,
                        200);
+    $gho->{"${gn}_ether"} = select_ether($ho,"${gn}_ether") if $nested eq 'nested_L2';
     my $base = "/root/$flight.$job.$gn-";
     my $newiso= $base . "newiso";
     my $emptydir= $base . "empty-dir";
@@ -155,6 +164,7 @@ sub prep () {
     more_prepareguest_hvm($ho,$gho, $ram_mb, $disk_mb,
                           OnReboot => 'preserve',
                           Bios => $r{bios},
+                          ExtraConfig => '#nestedhvm=1',
                           PostImageHook => sub {
         my $cmds = iso_copy_content_from_image($gho, $newiso);
         $cmds .= prepare_initrd($initrddir,$newiso,$preseed_file_path);
@@ -176,11 +186,28 @@ my $ram_minslop = 100;
 my $ram_lots = 5000;
 if ($host_freemem_mb > $ram_lots * 2 + $ram_minslop) {
     $ram_mb = $ram_lots;
+} elsif ($nested eq 'nested_L1') {
+    $ram_mb = 3072;
 } else {
     $ram_mb = 768;
 }
 logm("Host has $host_freemem_mb MB free memory, setting guest memory size to $ram_mb MB");
 
+if ($nested eq 'nested_L2') {
+    my $L2_disk_mb = 20000;
+    my $L0= selecthost($r{'L0_Ident'});
+    my $vg = $L0->{Name};
+    $vg .= ".$c{TestHostDomain}" if ($L0->{Suite} =~ m/lenny/);
+    my $L1_domname = $r{"$ho->{Name}_domname"};
+    target_cmd_root($L0, "lvremove -f /dev/${vg}/${gn} ||:");
+    target_cmd_root($L0, "lvcreate -L ${L2_disk_mb}M -n ${gn} ${vg}");
+    target_cmd_root($L0, "dd if=/dev/zero of=/dev/${vg}/${gn} count=10");
+    target_cmd_root($L0, "xl block-attach $L1_domname /dev/${vg}/${gn},raw,sdb,rw");
+    target_install_packages_norec($ho, qw(lvm2 rsync genisoimage));
+    target_reboot($ho);
+    target_cmd_root($ho, "pvcreate /dev/sdb && vgcreate ${gn}_vg /dev/sdb");
+}
+
 if (!$stage) {
     prep();
     guest_create($gho,$toolstack);
@@ -192,7 +219,23 @@ if ($stage<2) {
     guest_destroy($ho,$gho);
 }
 
-guest_editconfig_nocd($gho,$emptyiso);
+if ($nested) {
+    guest_editconfig_cd($gho);
+} else {
+    guest_editconfig_nocd($gho,$emptyiso);
+}
 guest_create($gho,$toolstack);
 guest_await_dhcp_tcp($gho,300);
 guest_check_up($gho);
+
+if ($nested eq 'nested_L2') {
+    target_cmd_root($gho, "init 0");
+    target_await_down($gho,60);
+    target_ping_check_down($gho);
+}
+if ($nested eq 'nested_L1') {
+    store_runvar("L1_host", $gn);
+    store_runvar("L1_IP", $gho->{Ip});
+    store_runvar("L0_Ident", $whhost);
+    target_cmd_root($gho, "mkdir -p /home/osstest/.ssh && cp /root/.ssh/authorized_keys /home/osstest/.ssh/");
+}
-- 
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 ` Robert Ho [this message]
2015-02-12 18:16   ` [PATCH OSSTEST 11/12] Changes on test step of debain hvm guest install 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 ` [PATCH OSSTEST 12/12] Changes to test step of xen install Robert Ho
2015-02-11 17:17   ` 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-12-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.