Bug 1228369

Summary: [RFE] new %POOLFREE and %POOL options of "lvresize -l" which related to lvm thin pool
Product: [Community] LVM and device-mapper Reporter: Martin Bukatovic <mbukatov>
Component: lvm2Assignee: Zdenek Kabelac <zkabelac>
lvm2 sub component: Thin Provisioning QA Contact: cluster-qe <cluster-qe>
Status: NEW --- Docs Contact:
Severity: low    
Priority: unspecified CC: agk, cmarthal, heinzm, jbrassow, msnitzer, prajnoha, thornber, zkabelac
Version: 2.02.169Keywords: FutureFeature
Target Milestone: ---Flags: rule-engine: lvm-technical-solution?
rule-engine: lvm-test-coverage?
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Martin Bukatovic 2015-06-04 18:49:16 UTC
Description of problem
======================

I propose to create new "% options" of lvm -l,--extents option which would be
used with lvm thin volumes and be relative to the thin pool the thin volume
belongs to (instead of the volume group of the thin pool).

Proposed options are:

 * %POOL would be absolute percentage of the lvm thin pool
 * %POOLFREE would be percentage of the remaining space in lvm thin pool

For example
===========

-l200%POOL

would be 2 times the size of thin pool this thin volume is created in

-l50%POOLFREE

would be half the the size of the remaining free space in the thin pool 
of a thin volume

lvresize -l+50%POOLFREE /dev/vg_foo/lv_thinvol

would extend the virtual size of given thin volume by the number described
above

Comment 2 Corey Marthaler 2015-06-11 17:27:32 UTC
Will there be any upper limit to this? Or will it behave like the current '+100%FREE' wrt thin volumes?


[root@host-120 ~]# lvextend -l+10000%FREE snapper_thinp/origin
  Size of logical volume snapper_thinp/origin changed from 1.00 GiB (256 extents) to 12.01 TiB (3147856 extents).
  Logical volume origin successfully resized
[root@host-120 ~]# lvextend -l+10000%FREE snapper_thinp/origin
  Size of logical volume snapper_thinp/origin changed from 12.01 TiB (3147856 extents) to 24.02 TiB (6295456 extents).
  Logical volume origin successfully resized
[root@host-120 ~]# lvextend -l+10000%FREE snapper_thinp/origin
  Size of logical volume snapper_thinp/origin changed from 24.02 TiB (6295456 extents) to 36.02 TiB (9443056 extents).
  Logical volume origin successfully resized


[root@host-120 ~]# lvs -a -o +devices
  LV              VG            Attr       LSize   Pool Origin Data%  Meta%  Devices
  POOL            snapper_thinp twi---t---   2.00g             0.02   0.98   POOL_tdata(0)
  [POOL_tdata]    snapper_thinp Twi-ao----   2.00g                           /dev/sdd1(1)
  [POOL_tmeta]    snapper_thinp ewi-ao----   4.00m                           /dev/sdf1(0)
  [lvol0_pmspare] snapper_thinp ewi-------   4.00m                           /dev/sdd1(0)
  origin          snapper_thinp Vwi-a-t---  36.02t POOL        0.00

Comment 3 Martin Bukatovic 2015-06-11 19:48:16 UTC
Since there is no upper limit for thin volume size when you specify it's
virtual size in bytes or extents, it would make more sense to have no limits
there as well.

Comment 4 Corey Marthaler 2022-03-17 18:10:57 UTC
Out of curiosity, will this ever be supported for VDO either?

[root@hayes-01 ~]# lvcreate --yes --type linear -n vdo_pool_808558  -L 5.1G vdo_sanity  
  Rounding up size to full physical extent 5.10 GiB
  Wiping vdo signature on /dev/vdo_sanity/vdo_pool_808558.
  Logical volume "vdo_pool_808558" created.
[root@hayes-01 ~]# lvconvert --yes --type vdo-pool -n vdo_lv -V 100%POOL vdo_sanity/vdo_pool_808558
  Can't parse size argument.
  Invalid argument for --virtualsize: 100%POOL
  Error during parsing of command line.


kernel-4.18.0-367.el8    BUILT: Thu Feb 10 14:33:16 CST 2022
lvm2-2.03.14-3.el8    BUILT: Tue Jan  4 14:54:16 CST 2022
lvm2-libs-2.03.14-3.el8    BUILT: Tue Jan  4 14:54:16 CST 2022