Bug 1251280

Summary: RFE: enable thin pool extension with cached _tdata volume
Product: Red Hat Enterprise Linux 7 Reporter: Corey Marthaler <cmarthal>
Component: lvm2Assignee: Zdenek Kabelac <zkabelac>
lvm2 sub component: Cache Logical Volumes QA Contact: cluster-qe <cluster-qe>
Status: CLOSED DUPLICATE Docs Contact:
Severity: medium    
Priority: unspecified CC: agk, cluster-qe, heinzm, jbrassow, lmiksik, msnitzer, pasik, prajnoha, prockai, rbednar, thornber, zkabelac
Version: 7.2Keywords: FutureFeature
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
This bug will require the release notes to be changed to remove reference to bug 1371597 when fixed.
Story Points: ---
Clone Of: 1233909
: 1371597 (view as bug list) Environment:
Last Closed: 2017-10-30 12:52:40 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: 1233909    
Bug Blocks: 1371597    

Description Corey Marthaler 2015-08-06 21:38:37 UTC
+++ This bug was initially created as a clone of Bug #1233909 +++

Description of problem:
This is a standard regression check for automatic pool extension, however with the thin pool tdata stacked on a cached volume.


SCENARIO - [verify_auto_extension_of_full_thin_snap]
Create a thin snapshot and then fill it past the auto extend threshold

Enabling thin_pool_autoextend_threshold

    # Setting thin_pool_autoextend_threshold to 100 disables automatic
    # extensions. The minimum value is 50 (A setting below 50 will be treated
    # as 50).

    thin_pool_autoextend_threshold = 70
    thin_pool_autoextend_percent = 20


Making cache volume to be used as thin pool data volume
Converting *cached* volume to thin pool data device
lvcreate   --zero n -L 1G -n POOL snapper_thinp /dev/sda1
  WARNING: Logical volume snapper_thinp/POOL not zeroed.
lvcreate  -L 1G -n cpool snapper_thinp /dev/sdb1
lvcreate  -L 12M -n cpool_meta snapper_thinp /dev/sdb1

Create cache pool volume by combining the cache data and cache metadata (fast) volumes
lvconvert --yes --type cache-pool --poolmetadata snapper_thinp/cpool_meta snapper_thinp/cpool
  WARNING: Converting logical volume snapper_thinp/cpool and snapper_thinp/cpool_meta to pool's data and metadata volumes.
  THIS WILL DESTROY CONTENT OF LOGICAL VOLUME (filesystem etc.)

Create cached volume by combining the cache pool (fast) and origin (slow) volumes
lvconvert --yes --type cache --cachepool snapper_thinp/cpool snapper_thinp/POOL

Making linear volume to be used as thin pool meta volume
lvcreate   --zero n -L 4M -n meta snapper_thinp /dev/sda1
  WARNING: Logical volume snapper_thinp/meta not zeroed.

Create thin pool volume by combining the cached thin data and meta volumes
lvconvert --thinpool snapper_thinp/POOL --poolmetadata meta --yes
  WARNING: Converting logical volume snapper_thinp/POOL and snapper_thinp/meta to pool's data and metadata volumes.
  THIS WILL DESTROY CONTENT OF LOGICAL VOLUME (filesystem etc.)


Making origin volume
lvcreate  --virtualsize 1G -T snapper_thinp/POOL -n origin

Making snapshot of origin volume
lvcreate  -K -s /dev/snapper_thinp/origin -n auto_extension

[root@host-118 ~]# lvs -a -o +devices
  LV                 Attr       LSize   Pool    Origin             Data%  Meta% Cpy%Sync Devices
  POOL               twi-aotz--   1.00g                            0.00   1.07           POOL_tdata(0)
  [POOL_tdata]       Cwi-aoC---   1.00g [cpool] [POOL_tdata_corig] 0.03   1.89  0.00     POOL_tdata_corig(0)
  [POOL_tdata_corig] owi-aoC---   1.00g                                                  /dev/sda1(0)
  [POOL_tmeta]       ewi-ao----   4.00m                                                  /dev/sda1(256)
  auto_extension     Vwi-a-tz-k   1.00g POOL    origin             0.00
  [cpool]            Cwi---C---   1.00g                            0.03   1.89  0.00     cpool_cdata(0)
  [cpool_cdata]      Cwi-ao----   1.00g                                                  /dev/sdb1(0)
  [cpool_cmeta]      ewi-ao----  12.00m                                                  /dev/sdb1(256)
  [lvol0_pmspare]    ewi-------  12.00m                                                  /dev/sdb1(259)
  origin             Vwi-a-tz--   1.00g POOL                       0.00

Filling snapshot /dev/snapper_thinp/auto_extension
dd if=/dev/zero of=/dev/snapper_thinp/auto_extension bs=1M count=723

[root@host-118 ~]# lvs -a -o +devices
  LV                 Attr       LSize   Pool    Origin             Data%  Meta% Cpy%Sync Devices
  POOL               twi-aotz--   1.00g                            70.61  10.06          POOL_tdata(0)
  [POOL_tdata]       Cwi-aoC---   1.00g [cpool] [POOL_tdata_corig] 0.03   1.89  0.00     POOL_tdata_corig(0)
  [POOL_tdata_corig] owi-aoC---   1.00g                                                  /dev/sda1(0)
  [POOL_tmeta]       ewi-ao----   4.00m                                                  /dev/sda1(256)
  auto_extension     Vwi-a-tz-k   1.00g POOL    origin             70.61
  [cpool]            Cwi---C---   1.00g                            0.03   1.89  0.00     cpool_cdata(0)
  [cpool_cdata]      Cwi-ao----   1.00g                                                  /dev/sdb1(0)
  [cpool_cmeta]      ewi-ao----  12.00m                                                  /dev/sdb1(256)
  [lvol0_pmspare]    ewi-------  12.00m                                                  /dev/sdb1(259)
  origin             Vwi-a-tz--   1.00g POOL                       0.00


Jun 19 11:45:29 host-118 lvm[2642]: Internal error: _alloc_init called for non-virtual segment with no disk space.
Jun 19 11:45:29 host-118 lvm[2642]: Failed to extend thin snapper_thinp-POOL-tpool.
Jun 19 11:45:39 host-118 lvm[2642]: Internal error: _alloc_init called for non-virtual segment with no disk space.
Jun 19 11:45:39 host-118 lvm[2642]: Failed to extend thin snapper_thinp-POOL-tpool.
Jun 19 11:45:49 host-118 lvm[2642]: Internal error: _alloc_init called for non-virtual segment with no disk space.
Jun 19 11:45:49 host-118 lvm[2642]: Failed to extend thin snapper_thinp-POOL-tpool.
Jun 19 11:45:59 host-118 lvm[2642]: Internal error: _alloc_init called for non-virtual segment with no disk space.
Jun 19 11:45:59 host-118 lvm[2642]: Failed to extend thin snapper_thinp-POOL-tpool.
[...]

[root@host-118 ~]# pvs
  PV         VG            Fmt  Attr PSize  PFree 
  /dev/sda1  snapper_thinp lvm2 a--  24.99g 23.99g
  /dev/sdb1  snapper_thinp lvm2 a--  24.99g 23.97g
  /dev/sdc1  snapper_thinp lvm2 a--  24.99g 24.99g
  /dev/sdd1  snapper_thinp lvm2 a--  24.99g 24.99g
  /dev/sde1  snapper_thinp lvm2 a--  24.99g 24.99g
  /dev/sdf1  snapper_thinp lvm2 a--  24.99g 24.99g
  /dev/sdh1  snapper_thinp lvm2 a--  24.99g 24.99g


Version-Release number of selected component (if applicable):
2.6.32-563.el6.x86_64

lvm2-2.02.118-3.el6    BUILT: Wed Jun 17 09:40:21 CDT 2015
lvm2-libs-2.02.118-3.el6    BUILT: Wed Jun 17 09:40:21 CDT 2015
lvm2-cluster-2.02.118-3.el6    BUILT: Wed Jun 17 09:40:21 CDT 2015
udev-147-2.62.el6    BUILT: Thu Apr 23 05:44:37 CDT 2015
device-mapper-1.02.95-3.el6    BUILT: Wed Jun 17 09:40:21 CDT 2015
device-mapper-libs-1.02.95-3.el6    BUILT: Wed Jun 17 09:40:21 CDT 2015
device-mapper-event-1.02.95-3.el6    BUILT: Wed Jun 17 09:40:21 CDT 2015
device-mapper-event-libs-1.02.95-3.el6    BUILT: Wed Jun 17 09:40:21 CDT 2015
device-mapper-persistent-data-0.3.2-1.el6    BUILT: Fri Apr  4 08:43:06 CDT 2014
cmirror-2.02.118-3.el6    BUILT: Wed Jun 17 09:40:21 CDT 2015


How reproducible:
Everytime

--- Additional comment from Corey Marthaler on 2015-06-19 16:39:21 EDT ---

Looks like any extension attempt fails.

[root@host-117 ~]# lvextend -L +1G snapper_thinp/resize
  Internal error: _alloc_init called for non-virtual segment with no disk space.

--- Additional comment from Zdenek Kabelac on 2015-06-22 06:42:31 EDT ---

In general resize of cached volume is a problem.

For now - user needs to drop caching,  resize LV and cache LV again.

Better logic which will integrate and eventually avoids cache dropping needs to be developed first.

So this is RFE and it cannot be regression as this has never worked.

Comment 1 Corey Marthaler 2015-08-06 21:39:55 UTC
Cloning for rhel7...

[root@harding-03 ~]# lvextend -L +1G snapper_thinp/POOL
  Internal error: _alloc_init called for non-virtual segment with no disk space.

3.10.0-302.el7.x86_64
lvm2-2.02.126-1.el7    BUILT: Tue Jul 28 11:32:33 CDT 2015
lvm2-libs-2.02.126-1.el7    BUILT: Tue Jul 28 11:32:33 CDT 2015
lvm2-cluster-2.02.126-1.el7    BUILT: Tue Jul 28 11:32:33 CDT 2015
device-mapper-1.02.103-1.el7    BUILT: Tue Jul 28 11:32:33 CDT 2015
device-mapper-libs-1.02.103-1.el7    BUILT: Tue Jul 28 11:32:33 CDT 2015
device-mapper-event-1.02.103-1.el7    BUILT: Tue Jul 28 11:32:33 CDT 2015
device-mapper-event-libs-1.02.103-1.el7    BUILT: Tue Jul 28 11:32:33 CDT 2015
device-mapper-persistent-data-0.5.4-1.el7    BUILT: Fri Jul 17 08:56:22 CDT 2015
cmirror-2.02.126-1.el7    BUILT: Tue Jul 28 11:32:33 CDT 2015
sanlock-3.2.4-1.el7    BUILT: Fri Jun 19 12:48:49 CDT 2015
sanlock-lib-3.2.4-1.el7    BUILT: Fri Jun 19 12:48:49 CDT 2015
lvm2-lockd-2.02.126-1.el7    BUILT: Tue Jul 28 11:32:33 CDT 2015

Comment 7 Corey Marthaler 2016-07-18 20:27:21 UTC
[root@host-082 ~]# lvs -a -o +devices
  LV              VG            Attr       LSize   Pool  Data% Cpy%Sync Devices
  corigin         cache_sanity  Cwi-aoC---   4.01g [pool]4.75  0.00     corigin_corig(0)
  [corigin_corig] cache_sanity  owi-aoC---   4.01g                      /dev/sdg1(0),/dev/sdf1(0),/dev/sde2(0)
  [lvol0_pmspare] cache_sanity  ewi-------  12.00m                      /dev/sdg2(343)
  [pool]          cache_sanity  Cwi---C---   4.01g                      pool_cdata(0)
  [pool_cdata]    cache_sanity  Cwi-ao----   4.01g                      /dev/sdg2(0),/dev/sdd2(0),/dev/sdd1(0)
  [pool_cmeta]    cache_sanity  ewi-ao----  12.00m                      /dev/sdg2(342),/dev/sdd2(342),/dev/sdd1(342)

[root@host-082 ~]# lvextend -L +500M /dev/cache_sanity/corigin
  Internal error: _alloc_init called for non-virtual segment with no disk space.


3.10.0-468.el7.x86_64

lvm2-2.02.160-1.el7    BUILT: Wed Jul  6 11:16:47 CDT 2016
lvm2-libs-2.02.160-1.el7    BUILT: Wed Jul  6 11:16:47 CDT 2016
lvm2-cluster-2.02.160-1.el7    BUILT: Wed Jul  6 11:16:47 CDT 2016
device-mapper-1.02.130-1.el7    BUILT: Wed Jul  6 11:16:47 CDT 2016
device-mapper-libs-1.02.130-1.el7    BUILT: Wed Jul  6 11:16:47 CDT 2016
device-mapper-event-1.02.130-1.el7    BUILT: Wed Jul  6 11:16:47 CDT 2016
device-mapper-event-libs-1.02.130-1.el7    BUILT: Wed Jul  6 11:16:47 CDT 2016
device-mapper-persistent-data-0.6.2-0.1.rc8.el7    BUILT: Wed May  4 02:56:34 CDT 2016
cmirror-2.02.160-1.el7    BUILT: Wed Jul  6 11:16:47 CDT 2016
sanlock-3.3.0-1.el7    BUILT: Wed Feb 24 09:52:30 CST 2016
sanlock-lib-3.3.0-1.el7    BUILT: Wed Feb 24 09:52:30 CST 2016
lvm2-lockd-2.02.160-1.el7    BUILT: Wed Jul  6 11:16:47 CDT 2016

Comment 8 Jonathan Earl Brassow 2016-08-30 15:13:50 UTC
this can't be a regression because we haven't been able to put cache on tpool_data before.  We don't have a forth-coming solution for this problem yet, so we will need to document this limitation in a release note.

I am cloning a "documentation only" bug to handle the release note and moving this bug to 7.4.

Comment 14 Zdenek Kabelac 2017-10-30 10:45:33 UTC
lvm2 needs to gain 'resize of cache' know-how via bug 1189111

Comment 15 Roman Bednář 2017-10-30 12:52:40 UTC

*** This bug has been marked as a duplicate of bug 1189111 ***