]> xenbits.xensource.com Git - people/liuw/osstest.git/commitdiff
distros: support booting Debian PV (d-i installed) guests with pvgrub.
authorIan Campbell <ian.campbell@citrix.com>
Wed, 8 Jul 2015 12:30:52 +0000 (13:30 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 23 Jul 2015 14:36:59 +0000 (15:36 +0100)
This requires the use of the pv-grub-menu package which is in Jessie
onwards.  (it is in wheezy-backports which is the subject of a
subsequent patch).

The bootloader to use is specified via a runvar {Guest}_bootloader.

Adjust make-distros-flight to use pvgrub for some subset of i386 and
amd64 guests to get coverage.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Osstest.pm
Osstest/Debian.pm
make-distros-flight
ts-debian-di-install

index 6535401036b0d8595174e95219b1083a82379f95..8f97dd258ae4f22b072cf476e2f932c4817bfa21 100644 (file)
@@ -39,6 +39,7 @@ BEGIN {
                       db_begin_work db_prepare
                       ensuredir get_filecontents_core_quiet system_checked
                       nonempty visible_undef show_abs_time
+                      %arch_debian2xen %arch_xen2debian
                       );
     %EXPORT_TAGS = ( );
 
@@ -54,6 +55,12 @@ scalar *main::DEBUG;
 # declaration prevents `Name "main::DEBUG" used only once'
 # scalar prevents `useless use of a variable in void context'
 
+our %arch_debian2xen = qw(i386 x86_32
+                         amd64 x86_64
+                         armhf armhf);
+our %arch_xen2debian;
+$arch_xen2debian{$arch_debian2xen{$_}} = $_ foreach keys %arch_debian2xen;
+
 #---------- static default config settings ----------
 
 our %c = qw(
index 2d49ff8f6997dcbf16955734bf361d8642c88d5b..1edf49fc8f3d2e7bed258d15efd88a329c0ac835 100644 (file)
@@ -867,7 +867,9 @@ sub preseed_create_guest ($$;@) {
 
     my $suite= $xopts{Suite} || $c{DebianSuite};
 
-    my $preseed_file= preseed_base($ho, $suite, $sfx, '', %xopts);
+    my $extra_packages = "pv-grub-menu" if $xopts{PvMenuLst};
+
+    my $preseed_file= preseed_base($ho, $suite, $sfx, $extra_packages, %xopts);
     $preseed_file.= (<<END);
 d-i     partman-auto/method             string regular
 d-i     partman-auto/choose_recipe \\
index bdca7d14aba790f21513369a77df718822e4dcfc..c19e3ba574fcbdf260a112c1ce2da08071078e06 100755 (executable)
@@ -90,6 +90,11 @@ test_do_one_netboot () {
     *) ;;
   esac
 
+  stripy bootloader pvgrub pygrub \
+    "$xenarch" "amd64" \
+    "$dom0arch" "i386" \
+    "$domU" "amd64" \
+
   case $domU in
     i386|amd64)
       diurl="$diurl/xen";;
@@ -97,8 +102,20 @@ test_do_one_netboot () {
       diurl="$diurl/debian-installer/arm64";;
   esac
 
+  case ${dom0arch}_${domU}_${gsuite} in
+    arm*_arm*_*) bootloader="pygrub";; # no pvgrub for arm
+
+    # Needs a menu.lst, not present in Squeeze+ due to switch to grub2,
+    # workedaround in Jessie+ with pv-grub-menu package.
+    *_squeeze) bootloader="pygrub";;
+    *_wheezy) bootloader="pygrub";;
+
+    # pv-grub-x86_64.gz is not built by 32-bit dom0 userspace build.
+    i386_amd64_*) bootloader="pygrub";;
+  esac
+
   job_create_test                                               \
-   test-$xenarch$kern-$dom0arch-$domU-$gver-netboot-pygrub      \
+   test-$xenarch$kern-$dom0arch-$domU-$gver-netboot-$bootloader \
     test-debian-di xl $xenarch $dom0arch                        \
       kernbuildjob=${bfi}build-$dom0arch-$kernbuild             \
       debian_arch=$domU                                         \
@@ -106,6 +123,7 @@ test_do_one_netboot () {
       debian_method=netboot                                     \
       debian_netboot_kernel="$diurl/vmlinuz"                    \
       debian_netboot_ramdisk="$diurl/initrd.gz"                 \
+      debian_bootloader=$bootloader                             \
       all_hostflags=$most_hostflags
 }
 
index 08019a9dcb1140ecb235c4c87d6d413c617283a4..a59194a50a59e926625a930bbafb9e2fd2e61725 100755 (executable)
 #      Debian arch to install.
 # - <gident>_method:
 #      Install method, currently only "netboot".
+# - <gident>_bootloader:
+#      The PV bootloader to use when booting the guest. One of
+#      "pvgrub" or "pygrub". Default is "pygrub".
 #
 # For method="netboot":
 #
 #  - <gident>_netboot_kernel:
-#       URL of the kernel to boot
+#       URL of the kernel to boot.
 #  - <gident>_netboot_ramdisk:
-#       URL of the ramdisk to boot
+#       URL of the ramdisk to boot.
 #
 #    If neither kernel nor ramdisk are specified then the current
 #    TftpDiVersion of d-i will be used, and the runvars will be set to
@@ -107,6 +110,8 @@ sub ginstall () {
     my $method= $r{"$gho->{Guest}_method"};
 
     my $tmpdir= "/root/$flight-$job-di";
+    my $bl= $r{"$gho->{Guest}_bootloader"};
+
     target_cmd_root($ho, <<END);
 rm -rf $tmpdir
 mkdir $tmpdir
@@ -121,7 +126,7 @@ END
 
        $method_cfg = setup_netboot($tmpdir, $arch, $suite);
 
-       $ps_url = preseed_create_guest($gho, '', Suite=>$suite);
+       $ps_url = preseed_create_guest($gho, '', Suite=>$suite, PvMenuLst=>($bl eq "pvgrub"));
 
        $extra_disk = "";
     }
@@ -162,7 +167,12 @@ END
     guest_await_shutdown($ho,$gho,3600);
     guest_destroy($gho);
 
-    my $blcfg = <<END;
+    my $xenarch = $arch_debian2xen{$arch};
+    my $pvgrub = "/usr/local/lib/xen/boot/pv-grub-$xenarch.gz";
+    my $blcfg = $bl eq "pvgrub" ? <<END : <<END;
+kernel = "$pvgrub"
+extra = "(hd0,0)/boot/grub/menu.lst"
+END
 bootloader = "pygrub"
 END