From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robert Ho Subject: [PATCH OSSTEST 11/12] Changes on test step of debain hvm guest install Date: Wed, 11 Feb 2015 17:52:20 +0800 Message-ID: <1423648341-203755-12-git-send-email-robert.hu@intel.com> References: <1423648341-203755-1-git-send-email-robert.hu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1423648341-203755-1-git-send-email-robert.hu@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, ian.campbell@citrix.com, ian.jackson@eu.citrix.com, jfehlig@suse.com, Robert Ho , longtaox.pang@intel.com List-Id: xen-devel@lists.xenproject.org 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