[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH OSSTEST 4/6] ts-freebsd-install: Use $gho->{Lvdev} instead of target_guest_lv_name



On Thu, 2015-10-01 at 11:45 +0100, Ian Campbell wrote:
> On Tue, 2015-09-29 at 10:44 +0100, Ian Campbell wrote:
> > prepareguest has already assigned this so we should use it instead of
> > replicating (perhaps wrongly since target_guest_lv_name and
> > target_choose_vg can behave differently if multiple vgs are present).
> 
> This is wrong in practice because
>     kpartx -a /dev/some-vg/some-device
> produces /dev/mapper/some--vg-some--device1 etc but not /dev/some-vg/some
> -device1.
> 
> The right fix probably involves lv_dev_mapper($gho-{Vg}, "$gho->{Lv}3")
> instead.
> 
> I'm in two minds about having guest_find_lv use lv_dev_mapper to populate
> $gho->{Lvdev} in the first place as an alternative fix though.

I decided I liked this route more. It's as yet untested other than "perl 
-c", but I have inserted the patch below before this one.

commit 9ba9a4f1d3fb7f01a1c76e9bff9f4b23187d855b
Author: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date:   Fri Oct 2 10:31:13 2015 +0100

    TestSupport: Use lv_dev_mapper in guest_find_lv
    
    This has the effect of switching $gho->{Lvdev} from /dev/$VG/$LV to
    /dev/mapper/$VG-$LV (where $VG and $LV have an s/-/--/ transformation
    applied).
    
    The two paths point to the samedevice and most call sites don't care
    about the distinction. Some places which use "kpartx $dev" to Lvdev
    expect to be able to append a partition number to $dev, while kpartx
    only creates the /dev/mapper form, meaning such places cannot use
    Lvdev. By making this switch we allow these places (such as
    ts-freebsd-install) to use kpartx.
    
    The only other place I'm aware of which requires one form or the other
    is the Debian initramfs code which expects root=/dev/mapper/vg-lv and
    does not accept /dev/vg/lv. However this is already handled correctly.
    
    Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index c55b847..1365ee5 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -1382,7 +1382,7 @@ sub guest_find_lv ($) {
     $gho->{Vg}= $r{"${gn}_vg"};
     $gho->{Lv}= $r{"${gn}_disk_lv"};
     $gho->{Lvdev}= (defined $gho->{Vg} && defined $gho->{Lv})
-        ? '/dev/'.$gho->{Vg}.'/'.$gho->{Lv} : undef;
+        ? lv_dev_mapper($gho->{Vg},$gho->{Lv}) : undef;
 }
 
 sub guest_find_diskimg($)


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.