generic/108: tolerate old lvm utility versions
authorIlya Dryomov <idryomov@gmail.com>
Thu, 24 Aug 2017 12:48:26 +0000 (14:48 +0200)
committerEryu Guan <eguan@redhat.com>
Fri, 25 Aug 2017 08:00:57 +0000 (16:00 +0800)
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

lvm2 commit 4b6e3b5e5ea6 ("allocation: Allow approximate
allocation when specifying size in percent") made '-l 100%FREE'
possible when creating RAID LVs or setting number of stripes.

Fix it by setting the size to allocate to 100M, which is enough for
the test with 128M scsi_debug device.

[eguan: update commit log a bit to mention the lvm2 commit that
changed the lvcreate behavior]

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
tests/generic/108

index 1525dfb64a4755b8a44ba6af4dea970786147b8c..0caec7d02d728c8f1b64019e16e946b56cf5ab64 100755 (executable)
@@ -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
 $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
        >>$seqres.full 2>&1
 # wait for lv creation to fully complete
 $UDEV_SETTLE_PROG >>$seqres.full 2>&1