diff mbox

generic/108: tolerate old lvm utility versions

Message ID 1503578906-11387-1-git-send-email-idryomov@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ilya Dryomov Aug. 24, 2017, 12:48 p.m. UTC
lvm utility in Ubuntu 14.04 LTS treats -l 100%FREE as a hard number and
not as an approximate upper limit.  With ~5G scratch partition and ~128M
scsi_debug device, vg_108 is 1279+31=1310 extents long, but only 31*2=62
can be allocated with -i 2:

  # lvm lvcreate -i 2 -I 4m -l 100%FREE -n lv_108 vg_108
  Insufficient suitable allocatable extents for logical volume lv_108: 1248 more required

Set the size to allocate to 100M.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
---
 tests/generic/108 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eryu Guan Aug. 25, 2017, 5:31 a.m. UTC | #1
On Thu, Aug 24, 2017 at 02:48:26PM +0200, Ilya Dryomov wrote:
> lvm utility in Ubuntu 14.04 LTS treats -l 100%FREE as a hard number and
> not as an approximate upper limit.  With ~5G scratch partition and ~128M

I just looked for an Ubuntu 14.04 LTS box and confirmed lvcreate does
support '-l 100%FREE'. Even on distributions as old as RHEL6 support
this usage too. Perpahs there were other things went wrong in your test
environment?

Thanks,
Eryu

> scsi_debug device, vg_108 is 1279+31=1310 extents long, but only 31*2=62
> can be allocated with -i 2:
> 
>   # lvm lvcreate -i 2 -I 4m -l 100%FREE -n lv_108 vg_108
>   Insufficient suitable allocatable extents for logical volume lv_108: 1248 more required
> 
> Set the size to allocate to 100M.
> 
> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
> ---
>  tests/generic/108 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/generic/108 b/tests/generic/108
> index 1525dfb64a47..0caec7d02d72 100755
> --- a/tests/generic/108
> +++ b/tests/generic/108
> @@ -74,7 +74,7 @@ $LVM_PROG pvcreate -f $SCSI_DEBUG_DEV $SCRATCH_DEV >>$seqres.full 2>&1
>  $LVM_PROG vgcreate -f $vgname $SCSI_DEBUG_DEV $SCRATCH_DEV >>$seqres.full 2>&1
>  # We use yes pipe instead of 'lvcreate --yes' because old version of lvm
>  # (like 2.02.95 in RHEL6) don't support --yes option
> -yes | $LVM_PROG lvcreate -i 2 -I 4m -l 100%FREE -n $lvname $vgname \
> +yes | $LVM_PROG lvcreate -i 2 -I 4m -L 100m -n $lvname $vgname \
>  	>>$seqres.full 2>&1
>  # wait for lv creation to fully complete
>  $UDEV_SETTLE_PROG >>$seqres.full 2>&1
> -- 
> 2.4.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ilya Dryomov Aug. 25, 2017, 6:29 a.m. UTC | #2
On Fri, Aug 25, 2017 at 7:31 AM, Eryu Guan <eguan@redhat.com> wrote:
> On Thu, Aug 24, 2017 at 02:48:26PM +0200, Ilya Dryomov wrote:
>> lvm utility in Ubuntu 14.04 LTS treats -l 100%FREE as a hard number and
>> not as an approximate upper limit.  With ~5G scratch partition and ~128M
>
> I just looked for an Ubuntu 14.04 LTS box and confirmed lvcreate does
> support '-l 100%FREE'. Even on distributions as old as RHEL6 support
> this usage too. Perpahs there were other things went wrong in your test
> environment?

The syntax is supported, but the semantics are different.  Compare
lvcreate(8) man pages on Ubuntu 14.04 LTS and something more recent:

"When expressed as a percentage, the number is treated as an
approximate upper  limit  for the total  number  of  physical  extents
to be allocated (including extents used by any mirrors, for example)."

In the example I gave, '-l 100%FREE' translates to 1310 PEs on Trusty
vs ~60 PEs on a recent Fedora.

Thanks,

                Ilya
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eryu Guan Aug. 25, 2017, 7:58 a.m. UTC | #3
On Fri, Aug 25, 2017 at 08:29:06AM +0200, Ilya Dryomov wrote:
> On Fri, Aug 25, 2017 at 7:31 AM, Eryu Guan <eguan@redhat.com> wrote:
> > On Thu, Aug 24, 2017 at 02:48:26PM +0200, Ilya Dryomov wrote:
> >> lvm utility in Ubuntu 14.04 LTS treats -l 100%FREE as a hard number and
> >> not as an approximate upper limit.  With ~5G scratch partition and ~128M
> >
> > I just looked for an Ubuntu 14.04 LTS box and confirmed lvcreate does
> > support '-l 100%FREE'. Even on distributions as old as RHEL6 support
> > this usage too. Perpahs there were other things went wrong in your test
> > environment?
> 
> The syntax is supported, but the semantics are different.  Compare
> lvcreate(8) man pages on Ubuntu 14.04 LTS and something more recent:
> 
> "When expressed as a percentage, the number is treated as an
> approximate upper  limit  for the total  number  of  physical  extents
> to be allocated (including extents used by any mirrors, for example)."
> 
> In the example I gave, '-l 100%FREE' translates to 1310 PEs on Trusty
> vs ~60 PEs on a recent Fedora.

Ah, I got what you mean now. It seems a behavior change introduced by
lvm2 commit 4b6e3b5e5ea6 ("allocation: Allow approximate allocation when
specifying size in percent").

Then this patch looks fine to me (I probably will update the commit log
a bit to mention this lvm behavior change). Thanks!

Eryu
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/tests/generic/108 b/tests/generic/108
index 1525dfb64a47..0caec7d02d72 100755
--- a/tests/generic/108
+++ b/tests/generic/108
@@ -74,7 +74,7 @@  $LVM_PROG pvcreate -f $SCSI_DEBUG_DEV $SCRATCH_DEV >>$seqres.full 2>&1
 $LVM_PROG vgcreate -f $vgname $SCSI_DEBUG_DEV $SCRATCH_DEV >>$seqres.full 2>&1
 # We use yes pipe instead of 'lvcreate --yes' because old version of lvm
 # (like 2.02.95 in RHEL6) don't support --yes option
-yes | $LVM_PROG lvcreate -i 2 -I 4m -l 100%FREE -n $lvname $vgname \
+yes | $LVM_PROG lvcreate -i 2 -I 4m -L 100m -n $lvname $vgname \
 	>>$seqres.full 2>&1
 # wait for lv creation to fully complete
 $UDEV_SETTLE_PROG >>$seqres.full 2>&1