From mboxrd@z Thu Jan 1 00:00:00 1970 From: "longtao.pang" Subject: [OSSTEST Nested PATCH v9 7/9] Add new script to customize nested test configuration Date: Sat, 2 May 2015 14:28:16 +0800 Message-ID: <1430548098-5233-8-git-send-email-longtaox.pang@intel.com> References: <1430548098-5233-1-git-send-email-longtaox.pang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1430548098-5233-1-git-send-email-longtaox.pang@intel.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org 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 List-Id: xen-devel@lists.xenproject.org From: "longtao.pang" 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 --- 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 . + +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, <{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