Bug 1017133

Summary: Allocation issues when extending stripes with lower stripe number and using 100%FREE argument
Product: Red Hat Enterprise Linux 6 Reporter: Nenad Peric <nperic>
Component: lvm2Assignee: Alasdair Kergon <agk>
Status: CLOSED NOTABUG QA Contact: Cluster QE <mspqa-list>
Severity: low Docs Contact:
Priority: low    
Version: 6.5CC: agk, dwysocha, heinzm, jbrassow, msnitzer, prajnoha, prockai, thornber, zkabelac
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-14 22:35:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Nenad Peric 2013-10-09 09:58:32 UTC
Description of problem:

If you try to extend a striped LV using a -l100% argument and a stripe argument whith different size than original LV (smaller), LV will get extended on disks which were maybe not expected. 


How reproducible:

Create LV  and then increase its size by stripe number that is lower:

vgcreate vg /dev/sd{a..c}1

lvcreate -i 3 -L1G -n stripe vg
lvextend -i 1 -l100%FREE vg/stripe

Extension will take other PV's as well, making more than one stripe. 
The %FREE calculation is taken into account before considering number of stripes, and the stripes are then doubled to accomodate the stripe size request:

Before extension:

[root@virt-011 ~]# pvs 
  PV         VG         Fmt  Attr PSize  PFree 
  /dev/sda1  vg         lvm2 a--   9.99g  9.66g
  /dev/sdb1  vg         lvm2 a--   9.99g  9.66g
  /dev/sdc1  vg         lvm2 a--   9.99g  9.66g

After extension:

[root@virt-011 ~]# lvextend -i 1 -l100%FREE vg/stripe
  Extending logical volume stripe to 28.97 GiB
  Logical volume stripe successfully resized
[root@virt-011 ~]# pvs 
  PV         VG         Fmt  Attr PSize  PFree 
  /dev/sda1  vg         lvm2 a--   9.99g     0 
  /dev/sdb1  vg         lvm2 a--   9.99g     0 
  /dev/sdc1  vg         lvm2 a--   9.99g  1.01g


Should a lvextend with smaller number of stripes take the rest of PVs (creating more stripe 'copies' spread out accross PVs in LV)?

Comment 3 Alasdair Kergon 2013-10-14 22:30:36 UTC
OK - this seems to work correctly for me.

Try -l+100%FREE

Without the + it takes the amount of free space then uses that as the absolute size the final volume should be - so you are left with 1G (the original size) unused.

More examples in the man pages perhaps!