From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH OSSTEST 4/6] ts-freebsd-install: Use $gho->{Lvdev} instead of target_guest_lv_name Date: Fri, 2 Oct 2015 10:36:55 +0100 Message-ID: <1443778615.11707.66.camel@citrix.com> References: <1443519883.16718.23.camel@citrix.com> <1443519898-24444-4-git-send-email-ian.campbell@citrix.com> <1443696323.11707.13.camel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1443696323.11707.13.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, xen-devel@lists.xen.org Cc: Roger Pau =?ISO-8859-1?Q?Monn=E9?= List-Id: xen-devel@lists.xenproject.org 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 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 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($)