From: Ian Campbell Subject: [PATCH OSSTEST v7 05/15] distros: support PV guest install from Debian netinst media. Date: Wed, 27 May 2015 14:45:13 +0100 Message-ID: <1432734323-14128-5-git-send-email-ian.campbell@citrix.com> References: <1432734277.14664.229.camel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1432734277.14664.229.camel@citrix.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: ian.jackson@eu.citrix.com Cc: Ian Campbell , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org The netinst media are iso images containing a base Debian install and some (image size dependent) additional tasks. On x86 the "multiarch" iso flavour contains a Xen capable kernel for both i386 and amd64 so use that. This adds support for two classes of ISO, the CD sized ones which are built nightly and the DVD sized ones which are built weekly. The images are downloaded using jigdo which sources the majority of the data from a local Debian mirror, for this reason I have not worried about the fact that the i386 and amd64 tests are downloading the same thing (adding a specific download job would require finding up to 4GB of scratch space for each flight). The ISOs booted using pygrub which can extract the kernel and initrd from a ISO image. The resulting guests are also booted with pygrub since the pv-grub-menu package is not available on the ISO images and we have pvgrub coverage from the netboot tests. This is configured from make*flight using runvars: - _netinst_baseurl: Base URL of directory containing the netinst jigdo images. - _netinst_filere: Regular expression to match actual file within baseurl to use (without .jigdo suffix) _netinst_kernel: Path to kernel within the netinst image _netinst_ramdisk Path to ramdisk within the netinst image Signed-off-by: Ian Campbell --- v7: Use {Guest}_suite not {Guest}_dist as runvar to choose version. Use shorter lined method for $arch_props definition Switch to flight-per-suite model Handle lack of both $c{DebianMirrorProxy} and $c{HttpProxy} Construct URLs in make-distros-flight v4: Support http_proxy in jigdo download v3: - Indent jigdo-lite script line to improve readability - Wrap bootloader_args - Fetch URL on target, to get a timeout. Use wget since that is arranged to be present. - include bootloader in test name. --- Osstest/Debian.pm | 7 ++++-- make-distros-flight | 54 ++++++++++++++++++++++++++++++++++++++++++++ ts-debian-di-install | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 123 insertions(+), 2 deletions(-) diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm index 0975e73..30b1b3a 100644 --- a/Osstest/Debian.pm +++ b/Osstest/Debian.pm @@ -623,8 +623,6 @@ sub preseed_base ($$$$;@) { preseed_hook_overlay($ho, $sfx, $c{OverlayLocal}, 'overlay-local.tar'); my $preseed = <<"END"; -d-i mirror/suite string $suite - d-i debian-installer/locale string en_GB d-i console-keymaps-at/keymap select gb d-i keyboard-configuration/xkb-keymap string en_GB @@ -696,6 +694,11 @@ END d-i clock-setup/ntp-server string $ntpserver END + # For CDROM the suite is part of the image + $preseed .= <{Lvdev} ||:"); } +sub setup_netinst($$$) +{ + my ($didir, $arch, $cd) = @_; + + target_install_packages($ho, qw(jigdo-file)); + + my $baseurl = $r{ "$gho->{Guest}_netinst_baseurl" }; + my $filere = $r{ "$gho->{Guest}_netinst_filere" }; + my $kernel = $r{ "$gho->{Guest}_netinst_kernel" }; + my $ramdisk = $r{ "$gho->{Guest}_netinst_ramdisk" }; + + die "params" unless $baseurl && $filere && $kernel && $ramdisk; + + my $filebase; + + # Use the MD5SUMs file as an index + logm("Fetch index from $baseurl/MD5SUMS"); + my $idx = target_cmd_output_root($ho, "wget --quiet -O - $baseurl/MD5SUMS"); + foreach (split /\n/, $idx) { + m/^[0-9a-f]{32} ($filere)\.iso$/ or next; + $filebase = $1; + last; + } + + die unless $filebase; + + logm("Downloading $baseurl/$filebase.jigdo"); + my $netinst_jigdo = "$baseurl/$filebase.jigdo"; + # Jigdo uses wget internally, and so obeys $http_proxy. This seems + # simpler than the advice at + # https://www.debian.org/CD/jigdo-cd/#faq which is to edit + # ~/.jigdo-lite and change the wgetOpts setting. + my $useproxy = $c{DebianMirrorProxy} // $c{HttpProxy} // ''; + my $cmd = ''; + $cmd .= <{Guest}_netinst_jigdo", $netinst_jigdo); + + return (<{Guest}_cd"}; + + logm("$method $cd/$arch"); + + ($method_cfg,$extra_disk) = setup_netinst($tmpdir, $arch, $cd); + + $ps_url = preseed_create_guest($gho, '', CDROM=>1); + } else { die "$method"; -- 2.1.4