All of lore.kernel.org
 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: [OSSTEST v6 20/24] Add testing of non-LVM/phy disk backends.
Date: Wed, 6 May 2015 10:56:49 +0100	[thread overview]
Message-ID: <1430906213-30108-20-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1430905605.2660.187.camel@citrix.com>

xen-create-image makes this tricky to do since it is rather LVM
centric. Now that we have the ability to install from d-i it's
possible to arrange fairly easily that they use non-LVM disk backend
arrangements.

Here we add support to the test script and infra and create a bunch of
new jobs testing the cross product of {xl,libvirt} x {raw,qcow2,vhd}.

The test scripts are modified such that when constructing a domain
with a non-LVM diskfmt runvar:
 - the LVM device is slightly enlarged to account for file format
   headers (1M should be plenty).
 - the LVM device will have an ext3 filesystem created on it instead
   of being used as a phy device for the guest. Reusing the LVM volume
   in this way means we don't need to do more storage management in
   dom0 (i.e. arranging for / to be large enough, or managing a
   special "images" LV)
 - the relevant type of container is created within the filesystem
   using the appropriate tool.
 - New properties Disk{fmt,spec} are added to all $gho, containing
   the format used for the root disk and the xl diskspec to load it.
     - lvm backed guests use a xend/xm compatible spec, everything
       else uses the improved xl syntax which libvirt also supports.
       We won't test non-LVM on xend.
 - New properties Disk{mnt,img} are added to $gho which are not using
   LVM. These contain the mount point to use (configurable via
   OSSTEST_CONFIG and runvars) and the full path (including mount
   point) to the image itself.
 - When starting or stopping a guest we arrange for the filesystem to
   be (u)mounted.
     - The prepearation when starting a guest copes gracefully with
       the disk already being prepared.
     - Hooks are called from guest_create() and guest_destroy() to
       manipulate the disk as needed.

Using standalong-generate-dump-flight-runvars a representative set of
runvars is:

xen-unstable               test-amd64-amd64-xl-qcow2                 all_hostflags               arch-amd64,arch-xen-amd64,suite-wheezy,purpose-test
xen-unstable               test-amd64-amd64-xl-qcow2                 arch                        amd64
xen-unstable               test-amd64-amd64-xl-qcow2                 buildjob                    build-amd64
xen-unstable               test-amd64-amd64-xl-qcow2                 debian_arch                 amd64
xen-unstable               test-amd64-amd64-xl-qcow2                 debian_bootloader           pygrub
xen-unstable               test-amd64-amd64-xl-qcow2                 debian_diskfmt              qcow2
xen-unstable               test-amd64-amd64-xl-qcow2                 debian_dist                 wheezy
xen-unstable               test-amd64-amd64-xl-qcow2                 debian_method               netboot
xen-unstable               test-amd64-amd64-xl-qcow2                 kernbuildjob                build-amd64-pvops
xen-unstable               test-amd64-amd64-xl-qcow2                 kernkind                    pvops
xen-unstable               test-amd64-amd64-xl-qcow2                 toolstack                   xl
xen-unstable               test-amd64-amd64-xl-qcow2                 xenbuildjob                 build-amd64

Compared to test-amd64-amd64-pygrub (which is the most similar job) and
normalising the test name the difference is:
 xen-unstable               test-amd64-amd64-SUFFIX                   all_hostflags               arch-amd64,arch-xen-amd64,suite-wheezy,purpose-test
 xen-unstable               test-amd64-amd64-SUFFIX                   arch                        amd64
 xen-unstable               test-amd64-amd64-SUFFIX                   buildjob                    build-amd64
 xen-unstable               test-amd64-amd64-SUFFIX                   debian_arch                 amd64
 xen-unstable               test-amd64-amd64-SUFFIX                   debian_bootloader           pygrub
+xen-unstable               test-amd64-amd64-SUFFIX                   debian_diskfmt              qcow2
 xen-unstable               test-amd64-amd64-SUFFIX                   debian_dist                 wheezy
 xen-unstable               test-amd64-amd64-SUFFIX                   debian_method               netboot
 xen-unstable               test-amd64-amd64-SUFFIX                   kernbuildjob                build-amd64-pvops
 xen-unstable               test-amd64-amd64-SUFFIX                   kernkind                    pvops
 xen-unstable               test-amd64-amd64-SUFFIX                   toolstack                   xl
 xen-unstable               test-amd64-amd64-SUFFIX                   xenbuildjob                 build-amd64

These are added to the following flights:
  +libvirt
  +linux-3.0
  +linux-3.10
  +linux-3.14
  +linux-3.4
  +linux-arm-xen
  +linux-linus
  +linux-mingo-tip-master
  +linux-next
  +osstest
  +qemu-mainline
  +qemu-upstream-4.3-testing
  +qemu-upstream-4.4-testing
  +qemu-upstream-unstable
  +seabios
  +xen-4.0-testing
  +xen-4.1-testing
  +xen-4.2-testing
  +xen-4.3-testing
  +xen-4.4-testing
  +xen-unstable

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
v6: Use bs=1MB (=1*1000) when creating the raw images instead of bs=1M
    (=1*1024), this matches the units used by lvcreate's -L option and
    therefore arranges that the imaage actually fits.
v5: Assume 100MB/s dd from /dev/zero when creating a raw disk image
    Allow 10M of slack on filesystem for raw, qcow and vhd. 1M wasn't
    enough in practice for raw.
v4: new patch
---
 Osstest/TestSupport.pm | 97 ++++++++++++++++++++++++++++++++++++++++++++++++--
 make-flight            | 16 +++++++++
 ts-debian-di-install   | 10 ++----
 ts-guest-start         |  1 -
 4 files changed, 114 insertions(+), 10 deletions(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index b3d85d6..a979223 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -89,7 +89,8 @@ BEGIN {
                       target_var target_var_prefix
                       selectguest prepareguest more_prepareguest_hvm
                       guest_var guest_var_commalist
-                      prepareguest_part_lvmdisk prepareguest_part_xencfg
+                      prepareguest_part_lvmdisk prepareguest_part_diskimg
+                      prepareguest_part_xencfg
                       guest_umount_lv guest_await guest_await_dhcp_tcp
                       guest_checkrunning guest_check_ip guest_find_ether
                       guest_find_domid guest_check_up guest_check_up_quick
@@ -97,6 +98,7 @@ BEGIN {
                       guest_await_shutdown guest_await_destroy guest_destroy
                       guest_vncsnapshot_begin guest_vncsnapshot_stash
 		      guest_check_remus_ok guest_editconfig
+                      guest_prepare_disk guest_unprepare_disk
                       host_involves_pcipassthrough host_get_pcipassthrough_devs
                       toolstack guest_create
 
@@ -1319,6 +1321,7 @@ sub selectguest ($$) {
     }
     logm("guest: using $gn on $gho->{Host}{Name}");
     guest_find_lv($gho);
+    guest_find_diskimg($gho);
     guest_find_ether($gho);
     guest_find_tcpcheckport($gho);
     dhcp_watch_setup($ho,$gho);
@@ -1334,6 +1337,22 @@ sub guest_find_lv ($) {
         ? '/dev/'.$gho->{Vg}.'/'.$gho->{Lv} : undef;
 }
 
+sub guest_find_diskimg($)
+{
+    my ($gho) = @_;
+    $gho->{Diskfmt} = $r{"$gho->{Guest}_diskfmt"} // "lvm";
+    $gho->{Diskspec} = "phy:$gho->{Lvdev},xvda,w";
+
+    return if $gho->{Diskfmt} eq "lvm";
+
+    my $mntroot = get_host_property($gho->{Host}, "DiskImageMount",
+			    $c{DiskImageMount} // "/var/lib/xen/images");
+
+    $gho->{Diskmnt} = "$mntroot/$gho->{Guest}";
+    $gho->{Diskimg} = "$gho->{Diskmnt}/disk.$gho->{Diskfmt}";
+    $gho->{Diskspec} = "format=$gho->{Diskfmt},vdev=xvda,target=$gho->{Diskimg}";
+}
+
 sub guest_find_ether ($) {
     my ($gho) = @_;
     $gho->{Ether}= $r{"$gho->{Guest}_ether"};
@@ -1373,6 +1392,7 @@ sub guest_destroy ($) {
     my ($gho) = @_;
     my $ho = $gho->{Host};
     toolstack($ho)->destroy($gho);
+    guest_unprepare_disk($gho);
 }
 
 sub guest_await_destroy ($$) {
@@ -1384,9 +1404,32 @@ sub guest_await_destroy ($$) {
 sub guest_create ($) {
     my ($gho) = @_;
     my $ho = $gho->{Host};
+    guest_prepare_disk($gho);
     toolstack($ho)->create($gho);
 }
 
+sub guest_prepare_disk ($) {
+    my ($gho) = @_;
+
+    guest_umount_lv($gho->{Host}, $gho);
+
+    return if $gho->{Diskfmt} eq "lvm";
+
+    target_cmd_root($gho->{Host}, <<END);
+mkdir -p $gho->{Diskmnt}
+mount $gho->{Lvdev} $gho->{Diskmnt};
+END
+}
+
+sub guest_unprepare_disk ($) {
+    my ($gho) = @_;
+    return if $gho->{Diskfmt} eq "lvm";
+    target_cmd_root($gho->{Host}, <<END);
+umount $gho->{Lvdev} || :
+END
+}
+
+
 
 sub target_choose_vg ($$) {
     my ($ho, $mbneeded) = @_;
@@ -1518,6 +1561,7 @@ sub prepareguest ($$$$$$) {
     }
 
     guest_find_lv($gho);
+    guest_find_diskimg($gho);
     guest_find_ether($gho);
     guest_find_tcpcheckport($gho);
     return $gho;
@@ -1528,7 +1572,56 @@ sub prepareguest_part_lvmdisk ($$$) {
     target_cmd_root($ho, "lvremove -f $gho->{Lvdev} ||:");
     target_cmd_root($ho, "lvcreate -L ${disk_mb}M -n $gho->{Lv} $gho->{Vg}");
     target_cmd_root($ho, "dd if=/dev/zero of=$gho->{Lvdev} count=10");
-}    
+}
+
+sub make_vhd ($$$) {
+    my ($ho, $gho, $disk_mb) = @_;
+    target_cmd_root($ho, "vhd-util create -n $gho->{Rootimg} -s $disk_mb");
+}
+sub make_qcow2 ($$$) {
+    my ($ho, $gho, $disk_mb) = @_;
+    # upstream qemu's version. Seems preferable to qemu-xen-img from qemu-trad.
+    my $qemu_img = "/usr/local/lib/xen/bin/qemu-img";
+    target_cmd_root($ho, "$qemu_img create -f qcow2 $gho->{Rootimg} ${disk_mb}M");
+}
+sub make_raw ($$$) {
+    my ($ho, $gho, $disk_mb) = @_;
+    # In local tests this reported 130MB/s, so calculate a timeout assuming 100MB/s.
+    target_cmd_root($ho, "dd if=/dev/zero of=$gho->{Rootimg} bs=1MB count=${disk_mb}",
+	${disk_mb} / 100);
+}
+
+sub prepareguest_part_diskimg ($$$) {
+    my ($ho, $gho, $disk_mb) = @_;
+
+    my $diskfmt = $gho->{Diskfmt};
+    # Allow an extra 10 megabytes for image format headers
+    my $disk_overhead = $diskfmt eq "lvm" ? 0 : 10;
+
+    logm("preparing guest disks in $diskfmt format");
+
+    target_cmd_root($ho, "umount $gho->{Lvdev} ||:");
+
+    prepareguest_part_lvmdisk($ho, $gho, $disk_mb + $disk_overhead);
+
+    if ($diskfmt ne "lvm") {
+
+	$gho->{Rootimg} = "$gho->{Diskmnt}/disk.$diskfmt";
+	$gho->{Rootcfg} = "format=$diskfmt,vdev=xvda,target=$gho->{Rootimg}";
+
+	target_cmd_root($ho, <<END);
+mkfs.ext3 $gho->{Lvdev}
+mkdir -p $gho->{Diskmnt}
+mount $gho->{Lvdev} $gho->{Diskmnt}
+END
+        no strict qw(refs);
+        &{"make_$diskfmt"}($ho, $gho, $disk_mb);
+
+	target_cmd_root($ho, <<END);
+umount $gho->{Lvdev}
+END
+    }
+}
 
 sub prepareguest_part_xencfg ($$$$$) {
     my ($ho, $gho, $ram_mb, $xopts, $cfgrest) = @_;
diff --git a/make-flight b/make-flight
index 909cebe..c923f21 100755
--- a/make-flight
+++ b/make-flight
@@ -373,6 +373,22 @@ do_pv_debian_tests () {
   for xsm in $xsms ; do
     do_pv_debian_test_one libvirt '' libvirt enable_xsm=$xsm
   done
+
+  for ts in xl libvirt ; do
+
+    for fmt in raw vhd qcow2 ; do
+
+      fmt_runvar="debian_diskfmt=$fmt"
+
+      do_pv_debian_test_one $ts-$fmt '-di' $ts  \
+          debian_arch=amd64                     \
+          debian_dist=$guestsuite               \
+          debian_method=netboot                 \
+          debian_bootloader=pygrub              \
+          $fmt_runvar
+
+    done
+  done
 }
 
 test_matrix_do_one () {
diff --git a/ts-debian-di-install b/ts-debian-di-install
index 9ae3d6d..ecdb6a1 100755
--- a/ts-debian-di-install
+++ b/ts-debian-di-install
@@ -41,9 +41,7 @@ sub prep () {
     $gho= prepareguest($ho, $gn, $guesthost, 22,
                        $disk_mb, 40);
 
-    prepareguest_part_lvmdisk($ho, $gho, $disk_mb);
-
-    target_cmd_root($ho, "umount $gho->{Lvdev} ||:");
+    prepareguest_part_diskimg($ho, $gho, $disk_mb);
 }
 
 sub setup_netinst($$$)
@@ -207,14 +205,12 @@ END
 	OnPowerOff => "preserve"
     );
 
-    my $root_disk = "'phy:$gho->{Lvdev},xvda,w'";
-
     prepareguest_part_xencfg($ho, $gho, $ram_mb, \%install_xopts, <<END);
 $method_cfg
 extra       = "$cmdline"
 #
 disk        = [
-            $extra_disk $root_disk
+            $extra_disk '$gho->{Diskspec}'
             ]
 END
 
@@ -238,7 +234,7 @@ END
 $blcfg
 #
 disk        = [
-            $root_disk
+            '$gho->{Diskspec}'
             ]
 END
     return;
diff --git a/ts-guest-start b/ts-guest-start
index 1aa9e69..a434720 100755
--- a/ts-guest-start
+++ b/ts-guest-start
@@ -25,7 +25,6 @@ tsreadconfig();
 our ($ho,$gho) = ts_get_host_guest(@ARGV);
 
 sub start () {
-    guest_umount_lv($ho, $gho);
     guest_create($gho);
 }
 
-- 
2.1.4

  parent reply	other threads:[~2015-05-06  9:56 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-06  9:46 [PATCH OSSTEST v5 00/24] add distro domU testing flight Ian Campbell
2015-05-06  9:56 ` [OSSTEST v6 01/24] TestSupport: Add helper to fetch a URL on a host Ian Campbell
2015-05-12 15:08   ` Ian Jackson
2015-05-12 15:17     ` Ian Campbell
2015-05-06  9:56 ` [OSSTEST v6 02/24] TestSupport: allow caller of prepareguest_part_xencfg to specify viftype Ian Campbell
2015-05-06  9:56 ` [OSSTEST v6 03/24] create_webfile: Support use with guests as well as hosts Ian Campbell
2015-05-06  9:56 ` [OSSTEST v6 04/24] Debian: refactor code to add preseed commands to the preseed file Ian Campbell
2015-05-12 15:11   ` Ian Jackson
2015-05-06  9:56 ` [OSSTEST v6 05/24] Debian: refactor preseeding of .ssh directories Ian Campbell
2015-05-12 15:13   ` Ian Jackson
2015-05-06  9:56 ` [OSSTEST v6 06/24] Debian: Refactor installation of overlays, so it can be used for guests too Ian Campbell
2015-05-06  9:56 ` [OSSTEST v6 07/24] Debian: add preseed_create_guest helper Ian Campbell
2015-05-12 15:16   ` Ian Jackson
2015-05-12 15:22     ` Ian Campbell
2015-05-06  9:56 ` [OSSTEST v6 08/24] ts-debian-hvm-install: Only apply EFI workaround for Wheezy Ian Campbell
2015-05-12 15:17   ` Ian Jackson
2015-05-06  9:56 ` [OSSTEST v6 09/24] make-flight: Handle $BUILD_LVEXTEND_MAX in mfi-common:create_build_jobs() Ian Campbell
2015-05-06  9:56 ` [OSSTEST v6 10/24] distros: add support for installing Debian PV guests via d-i, flight and jobs Ian Campbell
2015-05-12 15:25   ` Ian Jackson
2015-05-12 15:40     ` Ian Campbell
2015-05-12 16:08       ` Ian Jackson
2015-05-06  9:56 ` [OSSTEST v6 11/24] distros: support booting Debian PV (d-i installed) guests with pvgrub Ian Campbell
2015-05-12 15:32   ` Ian Jackson
2015-05-06  9:56 ` [OSSTEST v6 12/24] distros: Support pvgrub for Wheezy too Ian Campbell
2015-05-12 15:35   ` Ian Jackson
2015-05-12 15:49     ` Ian Campbell
2015-05-06  9:56 ` [OSSTEST v6 13/24] distros: support PV guest install from Debian netinst media Ian Campbell
2015-05-12 15:52   ` Ian Jackson
2015-05-12 16:14     ` Ian Jackson
2015-05-13  9:16       ` Ian Campbell
2015-05-13  9:06     ` Ian Campbell
2015-05-14 18:01       ` Ian Jackson
2015-05-15  8:58         ` Ian Campbell
2015-05-06  9:56 ` [OSSTEST v6 14/24] Test pygrub and pvgrub on the regular flights Ian Campbell
2015-05-12 15:54   ` Ian Jackson
2015-05-13  9:11     ` Ian Campbell
2015-05-14 17:58       ` Ian Jackson
2015-05-06  9:56 ` [OSSTEST v6 15/24] distros: add branch infrastructure Ian Campbell
2015-05-12 16:03   ` Ian Jackson
2015-05-13  9:12     ` Ian Campbell
2015-05-06  9:56 ` [OSSTEST v6 16/24] distros: Run a flight over the weekend Ian Campbell
2015-05-06  9:56 ` [OSSTEST v6 17/24] Debian: Handle lack of bootloader support in d-i on ARM Ian Campbell
2015-05-06  9:56 ` [OSSTEST v6 18/24] ts-debian-di-install: Refactor root_disk specification Ian Campbell
2015-05-06  9:56 ` [OSSTEST v6 19/24] make-flight: refactor PV debian tests Ian Campbell
2015-05-06  9:56 ` Ian Campbell [this message]
2015-05-06  9:56 ` [OSSTEST v6 21/24] mfi-common: Allow make-*flight to filter the set of build jobs to include Ian Campbell
2015-05-06  9:56 ` [OSSTEST v6 22/24] make-distros-flight: don't bother building for XSM Ian Campbell
2015-05-06  9:56 ` [OSSTEST v6 23/24] distros: email only me on play flights Ian Campbell
2015-05-06  9:56 ` [OSSTEST v6 24/24] ts-debian-di-install: Use ftp.debian.org directly Ian Campbell
2015-05-06  9:57 ` [PATCH OSSTEST v5 00/24] add distro domU testing flight Ian Campbell
2015-05-12 16:06 ` Ian Jackson
2015-05-13  9:19   ` Ian Campbell
2015-05-13 16:09     ` Ian Jackson

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=1430906213-30108-20-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.