Bug 1899720

Summary: Allow thin-pool to be resized (grown) when cache is on top
Product: Red Hat Enterprise Linux 8 Reporter: Jonathan Earl Brassow <jbrassow>
Component: lvm2Assignee: Zdenek Kabelac <zkabelac>
lvm2 sub component: Thin Provisioning QA Contact: cluster-qe <cluster-qe>
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: high CC: agk, cmackows, cmarthal, heinzm, jbrassow, msnitzer, pasik, prajnoha, teigland, thornber, zkabelac
Version: 8.0   
Target Milestone: rc   
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: lvm2-2.03.12-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-09 19:45:20 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:
Embargoed:
Bug Depends On:    
Bug Blocks: 1872864    

Description Jonathan Earl Brassow 2020-11-19 20:26:41 UTC
Thin-pool needs to be expanded when over provisioning is in use and running out of backing space.  There are manual and automated ways of doing this.  Neither of these can be done if a cache is on top of a thin pool.

This should be addressed so users aren't confused (or have to remove a cache) when space gets tight.

Comment 1 Zdenek Kabelac 2021-02-08 23:57:03 UTC
Pushed support for resize of  dm-cache cached volumes with these upstream patches:

https://listman.redhat.com/archives/lvm-devel/2021-February/msg00042.html
https://listman.redhat.com/archives/lvm-devel/2021-February/msg00043.html
https://listman.redhat.com/archives/lvm-devel/2021-February/msg00045.html

tested various resize cases:

https://listman.redhat.com/archives/lvm-devel/2021-February/msg00046.html


Supports not just resize of _tdata but all other supported cached LVs.
(--type cache)

Comment 2 Zdenek Kabelac 2021-02-09 11:54:11 UTC
This also solves the problem for resize of cached thin-pools reported in bug 1876811.

Comment 4 David Teigland 2021-05-06 16:30:12 UTC
Should this bug include extending thin pool data when the data uses either cache or writecache, both of which lvm will now extend (bug 1160044)?  Or should writecache on thin pool data be handled and tested as a separate RFE?

Comment 5 Corey Marthaler 2021-05-06 17:51:38 UTC
Separate RFE would be preferred here as well.

Comment 7 David Teigland 2021-05-06 18:06:16 UTC
Created bug 1957898 for extending thin pool data using writecache, so this bug is only for extending thin pool data with cache.

Comment 10 Corey Marthaler 2021-06-10 20:51:15 UTC
Fix verified in the latest rpms. All cached stack thin pool stack extension scenarios have been finally turned on in 8.5.

kernel-4.18.0-310.el8    BUILT: Thu May 27 14:24:00 CDT 2021
lvm2-2.03.12-2.el8    BUILT: Tue Jun  1 06:55:37 CDT 2021
lvm2-libs-2.03.12-2.el8    BUILT: Tue Jun  1 06:55:37 CDT 2021


[root@hayes-02 ~]# lvcreate --yes  --profile thin-performance --zero y -L 4M -n meta snapper_thinp /dev/sdb
  Logical volume "meta" created.
[root@hayes-02 ~]# lvcreate --yes  --profile thin-performance --zero y -L 1G -n POOL snapper_thinp /dev/sdb
  Logical volume "POOL" created.
[root@hayes-02 ~]# lvcreate --yes  --zero y -L 400M -n cpool snapper_thinp /dev/sdc
  Logical volume "cpool" created.
[root@hayes-02 ~]# lvcreate --yes  --zero y -L 8M -n cpool_meta snapper_thinp /dev/sdc
  Logical volume "cpool_meta" created.
[root@hayes-02 ~]# lvconvert --yes --type cache-pool --poolmetadata snapper_thinp/cpool_meta snapper_thinp/cpool
  WARNING: Converting snapper_thinp/cpool and snapper_thinp/cpool_meta to cache pool's data and metadata volumes with metadata wiping.
  THIS WILL DESTROY CONTENT OF LOGICAL VOLUME (filesystem etc.)
  Converted snapper_thinp/cpool and snapper_thinp/cpool_meta to cache pool.
[root@hayes-02 ~]# lvs -a -o +devices
  LV              VG            Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert Devices       
  POOL            snapper_thinp -wi-a-----   1.00g                                                     /dev/sdb(1)   
  cpool           snapper_thinp Cwi---C--- 400.00m                                                     cpool_cdata(0)
  [cpool_cdata]   snapper_thinp Cwi------- 400.00m                                                     /dev/sdc(0)   
  [cpool_cmeta]   snapper_thinp ewi-------   8.00m                                                     /dev/sdc(100) 
  [lvol0_pmspare] snapper_thinp ewi-------   8.00m                                                     /dev/sdb(257) 
  meta            snapper_thinp -wi-a-----   4.00m                                                     /dev/sdb(0)   
[root@hayes-02 ~]# lvconvert --yes --type cache --cachepool snapper_thinp/cpool snapper_thinp/POOL
  Logical volume snapper_thinp/POOL is now cached.
[root@hayes-02 ~]# lvconvert --zero y --thinpool snapper_thinp/POOL --poolmetadata meta --yes
  Thin pool volume with chunk size 64.00 KiB can address at most <15.88 TiB of data.
  WARNING: Converting snapper_thinp/POOL and snapper_thinp/meta to thin pool's data and metadata volumes with metadata wiping.
  THIS WILL DESTROY CONTENT OF LOGICAL VOLUME (filesystem etc.)
  Converted snapper_thinp/POOL and snapper_thinp/meta to thin pool.
[root@hayes-02 ~]# lvs -a -o +devices
  LV                  VG            Attr       LSize   Pool          Origin             Data%  Meta%  Move Log Cpy%Sync Convert Devices             
  POOL                snapper_thinp twi-a-tz--   1.00g                                  0.00   10.94                            POOL_tdata(0)       
  [POOL_tdata]        snapper_thinp Cwi-aoC---   1.00g [cpool_cpool] [POOL_tdata_corig] 0.12   1.46            0.00             POOL_tdata_corig(0) 
  [POOL_tdata_corig]  snapper_thinp owi-aoC---   1.00g                                                                          /dev/sdb(1)         
  [POOL_tmeta]        snapper_thinp ewi-ao----   4.00m                                                                          /dev/sdb(0)         
  [cpool_cpool]       snapper_thinp Cwi---C--- 400.00m                                  0.12   1.46            0.00             cpool_cpool_cdata(0)
  [cpool_cpool_cdata] snapper_thinp Cwi-ao---- 400.00m                                                                          /dev/sdc(0)         
  [cpool_cpool_cmeta] snapper_thinp ewi-ao----   8.00m                                                                          /dev/sdc(100)       
  [lvol0_pmspare]     snapper_thinp ewi-------   8.00m                                                                          /dev/sdb(257)       
[root@hayes-02 ~]# lvextend -L +1G snapper_thinp/POOL_tdata
  Size of logical volume snapper_thinp/POOL_tdata_corig changed from 1.00 GiB (256 extents) to 2.00 GiB (512 extents).
  Logical volume snapper_thinp/POOL successfully resized.

Comment 13 errata-xmlrpc 2021-11-09 19:45:20 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (lvm2 bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:4431