All of lore.kernel.org
 help / color / mirror / Atom feed
From: "longtao.pang" <longtaox.pang@intel.com>
To: xen-devel@lists.xen.org
Cc: wei.liu2@citrix.com, longtaox.pang@intel.com,
	Ian.Jackson@eu.citrix.com, Ian.Campbell@citrix.com,
	robert.hu@intel.com
Subject: [OSSTEST Nested PATCH v9 7/9] Add new script to customize nested test configuration
Date: Sat,  2 May 2015 14:28:16 +0800	[thread overview]
Message-ID: <1430548098-5233-8-git-send-email-longtaox.pang@intel.com> (raw)
In-Reply-To: <1430548098-5233-1-git-send-email-longtaox.pang@intel.com>

From: "longtao.pang" <longtaox.pang@intel.com>

1. In this script, make some appropriate runvars which selecthost would
recognise.
2. Prepare the configurations for installing L2 guest VM.
3. Create a lv disk in L0 and hot-attach it to L1, need to restart L1 to
make the block disk to be recognized by L1 system, then using this disk
to create a VG that used for installing L2.

Signed-off-by: longtao.pang <longtaox.pang@intel.com>
---
Changes in v9:
1. For L1, identical its ident and guestname as 'nestedl1'.
2. Reuse Ian Campbell's v5_patch[04,05,06] to avoid duplicated codes
about 'ssh host keys' and 'overlays' when installing nested guest VM.
3. Refactor LV disk creating for L2 guest.
---
 ts-nested-setup |   66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100755 ts-nested-setup

diff --git a/ts-nested-setup b/ts-nested-setup
new file mode 100755
index 0000000..566186c
--- /dev/null
+++ b/ts-nested-setup
@@ -0,0 +1,66 @@
+#!/usr/bin/perl -w
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2015 Intel Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+use strict qw(vars);
+use DBI;
+use Osstest;
+use Osstest::Debian;
+use Osstest::TestSupport;
+
+tsreadconfig();
+# Pass L0's ident and L1's guestname
+our ($l0_ident,$l1_gn) = @ARGV;
+our ($l0,$l1) = ts_get_host_guest($l0_ident,$l1_gn);
+
+guest_check_ip($l1);
+# L1 guest's ident is same as guestname
+our $l1_ident = $l1->{Guest};
+
+store_runvar($l1_ident,$l1->{Guest});
+store_runvar("${l1_ident}_ip",$l1->{Ip});
+
+# Since Ian Campbell's v5_patch[04,05,06] has a bug that the
+# 'preseed/late_command' are unavailable, so add below line here to
+# make HTTP URL entry available in sources.list for L1 hvm guest.
+# Onece the bug is fiexed, this line code could be removed.
+target_cmd_root($l1, "sed -i 's/^deb *cdrom/#&/g' /etc/apt/sources.list");
+target_cmd_root($l1, "update-rc.d osstest-confirm-booted start 99 2 .");
+
+# Inside L0, create storage lv, attach this lv to L1, and then inside L1 using the storage for installing L2
+my $vgname = $l1->{Vg};
+my $guest_storage_lv_name = "${l1_ident}_guest_storage";
+my $guest_storage_lv_size = guest_var($l1,'guest_storage_size',undef);
+my $guest_storage_lvdev = "/dev/${vgname}/${guest_storage_lv_name}";
+
+target_cmd_root($l0, <<END);
+    lvremove -f $guest_storage_lvdev ||:
+    lvcreate -L ${guest_storage_lv_size}M -n $guest_storage_lv_name $vgname
+    dd if=/dev/zero of=$guest_storage_lvdev count=10
+    xl block-attach $l1->{Name} ${guest_storage_lvdev},raw,sdb,rw
+END
+# This is probably a bug here, if we use 'xvdx' as block 'dev'
+# after installing xen and boot into xen kernel, the disk will not be
+# recognized by OS. Also, if we use 'sde' instead of 'sdb' as block 'dev',
+# after installing xen and boot into xen kernel, the disk will be recognized
+# as 'sdb' not 'sde', so we will have to use 'sdb' here.
+
+target_install_packages_norec($l1, qw(lvm2 rsync genisoimage));
+# After block-attach lvdev to L1, need to reboot L1 to make the attach
+# to take effect. I think this is a bug for kernel.
+target_reboot($l1);
+# Create a vg in L1 guest and vg name is ${l1_gn}-disk
+target_cmd_root($l1, "pvcreate /dev/xvdb && vgcreate ${l1_gn}-disk /dev/xvdb");
-- 
1.7.10.4

  parent reply	other threads:[~2015-05-02  6:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-02  6:28 [OSSTEST Nested PATCH v9 0/9] Introduction of netsted HVM test job longtao.pang
2015-05-02  6:28 ` [OSSTEST Nested PATCH v9 1/9] parsing grub which has 'submenu' primitive longtao.pang
2015-05-06 11:36   ` Ian Campbell
2015-05-02  6:28 ` [OSSTEST Nested PATCH v9 2/9] Changes to support '/boot' leading paths of kernel, xen, in grub longtao.pang
2015-05-06 10:41   ` Ian Campbell
2015-05-02  6:28 ` [OSSTEST Nested PATCH v9 3/9] Refactor installation of overlays for guest used longtao.pang
2015-05-06 10:49   ` Ian Campbell
2015-05-02  6:28 ` [OSSTEST Nested PATCH v9 4/9] Edit some APIs in TestSupport.pm for nested test longtao.pang
2015-05-06 10:55   ` Ian Campbell
2015-05-02  6:28 ` [OSSTEST Nested PATCH v9 5/9] Move the codes about memory size setting into prep() longtao.pang
2015-05-06 10:57   ` Ian Campbell
2015-05-02  6:28 ` [OSSTEST Nested PATCH v9 6/9] Changes on test step of Debian hvm guest install longtao.pang
2015-05-06 11:03   ` Ian Campbell
2015-05-02  6:28 ` longtao.pang [this message]
2015-05-06 11:36   ` [OSSTEST Nested PATCH v9 7/9] Add new script to customize nested test configuration Ian Campbell
2015-05-07  7:42     ` Pang, LongtaoX
2015-05-07  9:16       ` Ian Campbell
2015-05-02  6:28 ` [OSSTEST Nested PATCH v9 8/9] Compose the main recipe of nested test job longtao.pang
2015-05-06 11:04   ` Ian Campbell
2015-05-02  6:28 ` [OSSTEST Nested PATCH v9 9/9] Add test job for nest test case longtao.pang
2015-05-06 11:07   ` Ian Campbell

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=1430548098-5233-8-git-send-email-longtaox.pang@intel.com \
    --to=longtaox.pang@intel.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=robert.hu@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.