xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: ian.jackson@eu.citrix.com
Cc: Ian Campbell <ian.campbell@citrix.com>, xen-devel@lists.xen.org
Subject: [PATCH OSSTEST v2 09/15] distros: add support for installing Debian PV guests via d-i, flight and jobs
Date: Mon, 28 Apr 2014 11:41:30 +0100	[thread overview]
Message-ID: <1398681696-2773-9-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1398681672.29700.55.camel@kazak.uk.xensource.com>

This patch introduces ts-debian-di-install which can install Debian from a
netboot (PXE) debian installer image. By default it installs from the d-i image
used by osstest (using the special Xen PV guest enabled flavour where
necessary) but it can also install the current release versions from Squeeze
onwards (up to and including Sid) and the d-i daily builds. This is controlled
by runvars {Guest}_diver = osstest|current and {Guest}_dist = squeeze|...|sid.
The resulting guests boot the distro kernel using pygrub (pvgrub will follow).

The distros flights differ substantially from the existing flights. Introduce
make-distros-flight using the functionality previously refactored into
mfi-common. The new flight tests all versions of Debian from Squeeze onward as
an amd64, i386 and armhf guests (armhf from Jessie onwards only) using the
usual smoke tests.

Add the new cases to sg-run-job

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 make-distros-flight  | 101 +++++++++++++++++++++++++++++++
 sg-run-job           |  11 ++++
 ts-debian-di-install | 167 +++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 279 insertions(+)
 create mode 100755 make-distros-flight
 create mode 100755 ts-debian-di-install

diff --git a/make-distros-flight b/make-distros-flight
new file mode 100755
index 0000000..abc24ff
--- /dev/null
+++ b/make-distros-flight
@@ -0,0 +1,101 @@
+#!/bin/bash
+
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2009-2013 Citrix 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/>.
+
+
+set -e
+
+branch=$1
+xenbranch=$2
+blessing=$3
+buildflight=$4
+
+flight=`./cs-flight-create $blessing $branch`
+
+. ap-common
+. cri-common
+. mfi-common
+
+defsuite=`getconfig DebianSuite`
+defguestsuite=`getconfig GuestDebianSuite`
+
+if [ x$buildflight = x ]; then
+
+  if [ "x$BUILD_LVEXTEND_MAX" != x ]; then
+     BUILD_RUNVARS+=" build_lvextend_max=$BUILD_LVEXTEND_MAX "
+  fi
+
+  WANT_XEND=false REVISION_LINUX_OLD=disable
+
+  create_build_jobs
+
+else
+
+  bfi=$buildflight.
+
+fi
+
+job_create_test_filter_callback () {
+  if [ "$xenarch" = "i386" ]; then return 1; fi
+  return 0
+}
+
+test_matrix_branch_filter_callback () {
+    :
+}
+
+test_do_one_netboot () {
+  job_create_test test-$xenarch$kern-$dom0arch-$domU-$dist-netboot \
+    test-debian-di xl $xenarch $dom0arch                        \
+      kernbuildjob=${bfi}build-$dom0arch-$kernbuild             \
+      debian_arch=$domU                                         \
+      debian_dist=$dist                                         \
+      debian_method=netboot                                     \
+      debian_diver=current                                      \
+      all_hostflags=$most_hostflags
+}
+
+test_matrix_do_one () {
+  case ${xenarch} in
+  amd64) domUarches="amd64 i386";;
+  armhf) domUarches="armhf";;
+  esac
+
+  for domU in $domUarches ; do
+    for dist in squeeze wheezy jessie sid daily ; do
+      case ${domU}_${dist} in
+      armhf_squeeze) continue;; # No armhf in Squeeze
+      armhf_wheezy) continue;; # No armhf guest support in Wheezy
+      *) ;;
+      esac
+
+      test_do_one_netboot
+
+    done
+
+  done
+}
+
+test_matrix_iterate
+
+echo $flight
+
+# Local variables:
+# mode: sh
+# sh-basic-offset: 2
+# indent-tabs-mode: nil
+# End:
diff --git a/sg-run-job b/sg-run-job
index 3d44331..789315a 100755
--- a/sg-run-job
+++ b/sg-run-job
@@ -246,6 +246,17 @@ proc run-job/test-debian {} {
     test-guest debian
 }
 
+proc install-guest-debian-di {} {
+    run-ts . = ts-debian-di-install
+    run-ts . = ts-guest-start + debian
+}
+
+proc need-hosts/test-debian-di {} { return host }
+proc run-job/test-debian-di {} {
+    install-guest-debian-di
+    test-guest debian
+}
+
 proc need-hosts/test-freebsd {} { return host }
 proc run-job/test-freebsd {} {
     run-ts . = ts-freebsd-install
diff --git a/ts-debian-di-install b/ts-debian-di-install
new file mode 100755
index 0000000..a71a336
--- /dev/null
+++ b/ts-debian-di-install
@@ -0,0 +1,167 @@
+#!/usr/bin/perl -w
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2009-2013 Citrix 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();
+
+our ($whhost,$gn) = @ARGV;
+$whhost ||= 'host';
+$gn ||= 'debian';
+
+our $ho= selecthost($whhost);
+
+our $ram_mb=    512;
+our $disk_mb= 10000;
+
+our $guesthost= "$gn.guest.osstest";
+our $gho;
+
+sub prep () {
+    target_install_packages_norec($ho, qw(lvm2));
+
+    $gho= prepareguest($ho, $gn, $guesthost, 22,
+                       $disk_mb, 40);
+
+    prepareguest_part_lvmdisk($ho, $gho, $disk_mb);
+
+    target_cmd_root($ho, "umount $gho->{Lvdev} ||:");
+}
+
+sub setup_netboot($$$)
+{
+    my ($didir, $arch, $suite) = @_;
+
+    my $di_ver= $r{"$gho->{Guest}_diver"} || "osstest";
+
+    if ( $di_ver eq "osstest" ) {
+	my $di_path = $c{TftpPath}.'/'.$ho->{Tftp}{DiBase}.'/'.$r{arch}.'/'.$c{TftpDiVersion}.'-'.$ho->{Suite};
+
+	my $netboot_kernel = "$di_path/vmlinuz-xen";
+	my $netboot_initrd = "$di_path/initrd.gz-xen";
+
+	target_putfile_root($ho, 60, $netboot_kernel, "$didir/kernel_${suite}_${arch}");
+	target_putfile_root($ho, 60, $netboot_initrd, "$didir/initrd_${suite}_${arch}");
+
+	store_runvar("$gho->{Guest}_netboot_kernel", $netboot_kernel);
+	store_runvar("$gho->{Guest}_netboot_initrd", $netboot_initrd);
+    } else {
+	my $mirror = "http://$c{DebianMirrorHost}/$c{DebianMirrorSubpath}";
+
+	my $di_url = $suite eq "daily" ?
+	    "http://d-i.debian.org/daily-images/$arch/daily/netboot/xen" :
+	    "$mirror/dists/$suite/main/installer-$arch/$di_ver/images/netboot/xen";
+
+	my $netboot_kernel = "$di_url/vmlinuz";
+	my $netboot_initrd = "$di_url/initrd.gz";
+
+	target_fetchurl($ho, $netboot_kernel, "$didir/kernel_${suite}_${arch}");
+	target_fetchurl($ho, $netboot_initrd, "$didir/initrd_${suite}_${arch}");
+
+	store_runvar("$gho->{Guest}_netboot_kernel", $netboot_kernel);
+	store_runvar("$gho->{Guest}_netboot_initrd", $netboot_initrd);
+    }
+
+    return <<END;
+kernel      = "$didir/kernel_${suite}_${arch}"
+ramdisk     = "$didir/initrd_${suite}_${arch}"
+END
+}
+sub ginstall () {
+    my $arch= $r{"$gho->{Guest}_arch"};
+    my $method= $r{"$gho->{Guest}_method"};
+
+    target_cmd_root($ho, <<END);
+rm -rf /root/di
+mkdir /root/di
+END
+
+    my ($method_cfg, $ps_url, $extra_disk);
+
+    if ( $method eq "netboot" )
+    {
+	my $suite= $r{"$gho->{Guest}_dist"};
+	logm("$method $suite/$arch");
+
+	$method_cfg = setup_netboot("/root/di", $arch, $suite);
+
+	$suite = "sid" if $suite eq "daily";
+
+	$ps_url = preseed_create_guest($gho, '', Suite=>$suite);
+
+	$extra_disk = "";
+    }
+    else
+    {
+	die "$method";
+    }
+
+    my $cmdline = join(" ", (
+			   "debian-installer/exit/always_halt=true",
+			   "--",
+			   "console=hvc0",
+			   "auto-install/enable=true",
+			   "hostname=$gho->{Name}",
+			   "domain=$c{TestHostDomain}",
+			   "url=$ps_url",
+			   "DEBIAN_FRONTEND=text",
+			   "netcfg/dhcp_timeout=150",
+			   "netcfg/choose_interface=eth0",
+		       ));
+
+    my %install_xopts = (
+	OnPowerOff => "preserve"
+    );
+
+    prepareguest_part_xencfg($ho, $gho, $ram_mb, \%install_xopts, <<END);
+$method_cfg
+extra       = "$cmdline"
+#
+disk        = [
+            $extra_disk 'phy:$gho->{Lvdev},xvda,w'
+            ]
+END
+
+    my $cmd= toolstack()->{Command}." create ".
+        $r{ $gho->{Guest}.'_'. toolstack()->{CfgPathVar} };
+    target_cmd_root($ho, $cmd, 300);
+
+    guest_checkrunning($ho, $gho) or die "$gho->{Name} not running";
+
+    guest_await_shutdown($ho,$gho,2000);
+    guest_destroy($ho,$gho);
+
+    my $blcfg = <<END;
+bootloader = "pygrub"
+END
+
+    prepareguest_part_xencfg($ho, $gho, $ram_mb, {}, <<END);
+$blcfg
+#
+disk        = [
+            'phy:$gho->{Lvdev},xvda,w'
+            ]
+END
+    return;
+}
+
+prep();
+ginstall();
-- 
1.9.0

  parent reply	other threads:[~2014-04-28 10:41 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-28 10:41 [PATCH OSSTEST v2 00/15] add distro domU testing flight Ian Campbell
2014-04-28 10:41 ` [PATCH OSSTEST v2 01/15] cr-external-linux: remove Ian Campbell
2014-05-02 11:19   ` Ian Jackson
2014-04-28 10:41 ` [PATCH OSSTEST v2 02/15] Build against liblzma to support .xz compressed kernels Ian Campbell
2014-05-02 11:19   ` Ian Jackson
2014-04-28 10:41 ` [PATCH OSSTEST v2 03/15] mg-debian-installer-update: grab Xen PV domU capable images too Ian Campbell
2014-05-02 11:22   ` Ian Jackson
2014-04-28 10:41 ` [PATCH OSSTEST v2 04/15] TestSupport: Add helper to fetch a URL on a host Ian Campbell
2014-05-02 11:25   ` Ian Jackson
2014-05-02 12:16     ` Ian Campbell
2014-04-28 10:41 ` [PATCH OSSTEST v2 05/15] TestSupport: Add helper to wait for a guest to shutdown Ian Campbell
2014-05-02 11:24   ` Ian Jackson
2014-04-28 10:41 ` [PATCH OSSTEST v2 06/15] TestSupport: allow overring of on_* in prepareguest_part_xencfg Ian Campbell
2014-05-02 11:26   ` Ian Jackson
2014-04-28 10:41 ` [PATCH OSSTEST v2 07/15] TestSupport: allow caller of prepareguest_part_xencfg to specify viftype Ian Campbell
2014-05-02 11:28   ` Ian Jackson
2014-05-02 12:21     ` Ian Campbell
2014-04-28 10:41 ` [PATCH OSSTEST v2 08/15] Debian: add preseed_create_guest helper Ian Campbell
2014-05-02 11:33   ` Ian Jackson
2014-05-02 12:23     ` Ian Campbell
2014-04-28 10:41 ` Ian Campbell [this message]
2014-05-02 11:46   ` [PATCH OSSTEST v2 09/15] distros: add support for installing Debian PV guests via d-i, flight and jobs Ian Jackson
2014-05-02 12:28     ` Ian Campbell
2014-05-02 14:14       ` Ian Jackson
2014-05-02 15:19         ` Ian Campbell
2014-04-28 10:41 ` [PATCH OSSTEST v2 10/15] distros: support booting Debian PV (d-i installed) guests with pvgrub Ian Campbell
2014-05-02 13:03   ` Ian Jackson
2014-05-02 13:18     ` Ian Campbell
2014-05-02 14:18       ` Ian Jackson
2014-05-02 15:22         ` Ian Campbell
2014-05-02 15:40           ` Ian Jackson
2014-04-28 10:41 ` [PATCH OSSTEST v2 11/15] distros: attempt pvgrub support for PV Wheezy too Ian Campbell
2014-05-02 13:11   ` Ian Jackson
2014-05-02 13:20     ` Ian Campbell
2014-05-02 14:19       ` Ian Jackson
2014-05-02 15:23         ` Ian Campbell
2014-04-28 10:41 ` [PATCH OSSTEST v2 12/15] distros: support PV guest install from Debian netinst media Ian Campbell
2014-05-02 14:01   ` Ian Jackson
2014-05-02 14:07     ` Ian Campbell
2014-05-02 14:20       ` Ian Jackson
2014-04-28 10:41 ` [PATCH OSSTEST v2 13/15] Test pygrub and pvgrub on the regular flights Ian Campbell
2014-05-02 14:02   ` Ian Jackson
2014-05-02 14:07     ` Ian Campbell
2014-04-28 10:41 ` [PATCH OSSTEST v2 14/15] distros: add branch infrastructure Ian Campbell
2014-05-02 14:04   ` Ian Jackson
2014-05-02 14:09     ` Ian Campbell
2014-05-02 14:30       ` Ian Jackson
2014-05-02 15:25         ` Ian Campbell
2014-04-28 10:41 ` [PATCH OSSTEST v2 15/15] distros: Run a flight over the weekend Ian Campbell
2014-05-02 14:05   ` Ian Jackson
2014-04-28 11:30 ` [PATCH OSSTEST v2 00/15] add distro domU testing flight Fabio Fantoni
2014-04-28 11:32   ` Ian Campbell
2014-04-28 12:59     ` Fabio Fantoni
2014-05-15  9:14 ` Ian Campbell
2014-05-16 17:08   ` Ian Jackson
2014-05-19  9:02     ` 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=1398681696-2773-9-git-send-email-ian.campbell@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).