Bug 1800349

Summary: provide non zero error code when attempting to convert to writecache using a non linear pool
Product: Red Hat Enterprise Linux 8 Reporter: Corey Marthaler <cmarthal>
Component: lvm2Assignee: LVM and device-mapper development team <lvm-team>
lvm2 sub component: Cache Logical Volumes QA Contact: cluster-qe <cluster-qe>
Status: CLOSED ERRATA Docs Contact:
Severity: low    
Priority: unspecified CC: agk, heinzm, jbrassow, mcsontos, msnitzer, pasik, prajnoha, teigland, zkabelac
Version: 8.2   
Target Milestone: rc   
Target Release: 8.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: lvm2-2.03.08-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-28 16:59: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:
Embargoed:

Description Corey Marthaler 2020-02-06 22:24:20 UTC
Description of problem:
Create a dm-cache pool and a linear logical volume, then attempt to convert the linear to wirtecache using cache pool device
Creating cache POOL.
lvcreate --type cache-pool -n CPOOL -L5G writecache_sanity /dev/sdf1
Creating linear volume.
lvcreate -L1G -n linear writecache_sanity /dev/sdg1
Create writecached volume by combining the cache pool (fast) and origin (slow) volumes


[root@hayes-02 ~]# lvs -a -o +devices
  LV              VG                Attr       LSize Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert Devices       
  CPOOL           writecache_sanity Cwi---C--- 5.00g                                                     CPOOL_cdata(0)
  [CPOOL_cdata]   writecache_sanity Cwi------- 5.00g                                                     /dev/sdf1(4)  
  [CPOOL_cmeta]   writecache_sanity ewi------- 8.00m                                                     /dev/sdf1(2)  
  linear          writecache_sanity -wi-a----- 1.00g                                                     /dev/sdg1(0)  
  [lvol0_pmspare] writecache_sanity ewi------- 8.00m                                                     /dev/sdf1(0)  
[root@hayes-02 ~]# lvconvert --yes --type writecache --cachevol writecache_sanity/CPOOL writecache_sanity/linear
  LV writecache_sanity/CPOOL must be linear to use as a writecache.
[root@hayes-02 ~]# echo $?
0



Version-Release number of selected component (if applicable):
kernel-4.18.0-173.el8    BUILT: Fri Jan 24 06:02:03 CST 2020
lvm2-2.03.07-1.el8    BUILT: Mon Dec  2 00:09:32 CST 2019
lvm2-libs-2.03.07-1.el8    BUILT: Mon Dec  2 00:09:32 CST 2019
device-mapper-1.02.167-1.el8    BUILT: Mon Dec  2 00:09:32 CST 2019
device-mapper-libs-1.02.167-1.el8    BUILT: Mon Dec  2 00:09:32 CST 2019
device-mapper-event-1.02.167-1.el8    BUILT: Mon Dec  2 00:09:32 CST 2019
device-mapper-event-libs-1.02.167-1.el8    BUILT: Mon Dec  2 00:09:32 CST 2019

Comment 3 Corey Marthaler 2020-02-20 20:50:42 UTC
Fix verified in the latest rpms.

kernel-4.18.0-179.el8    BUILT: Fri Feb 14 17:03:01 CST 2020
lvm2-2.03.08-1.el8    BUILT: Tue Feb 11 07:40:33 CST 2020
lvm2-libs-2.03.08-1.el8    BUILT: Tue Feb 11 07:40:33 CST 2020
lvm2-dbusd-2.03.08-1.el8    BUILT: Tue Feb 11 07:42:51 CST 2020
lvm2-lockd-2.03.08-1.el8    BUILT: Tue Feb 11 07:40:33 CST 2020
device-mapper-1.02.169-1.el8    BUILT: Tue Feb 11 07:40:33 CST 2020
device-mapper-libs-1.02.169-1.el8    BUILT: Tue Feb 11 07:40:33 CST 2020
device-mapper-event-1.02.169-1.el8    BUILT: Tue Feb 11 07:40:33 CST 2020
device-mapper-event-libs-1.02.169-1.el8    BUILT: Tue Feb 11 07:40:33 CST 2020



# Cache pool attempt
[root@hayes-02 ~]# lvcreate --type cache-pool -n CPOOL -L5G writecache_sanity /dev/sdf1
  Logical volume "CPOOL" created.
[root@hayes-02 ~]# lvcreate -L1G -n linear writecache_sanity /dev/sdk1
  Logical volume "linear" created.
[root@hayes-02 ~]# lvconvert --yes --type writecache --cachevol writecache_sanity/CPOOL writecache_sanity/linear
  LV writecache_sanity/CPOOL must be linear to use as a writecache.
[root@hayes-02 ~]# echo $?
5
[root@hayes-02 ~]# lvremove -f writecache_sanity
  Logical volume "CPOOL" successfully removed
  Logical volume "linear" successfully removed


# Mirror create attempts
[root@hayes-02 ~]# lvcreate  --type mirror -m 1 -n cworigin -L 500M writecache_sanity
  Logical volume "cworigin" created.
[root@hayes-02 ~]# lvcreate  --type linear -n linear_pool -L 500M writecache_sanity
  Logical volume "linear_pool" created.

[root@hayes-02 ~]# lvconvert --yes --type writecache --cachevol writecache_sanity/cworigin writecache_sanity/linear_pool
  LV writecache_sanity/cworigin must be linear to use as a writecache.
[root@hayes-02 ~]# echo $?
5
[root@hayes-02 ~]# lvconvert --yes --type writecache --cachevol writecache_sanity/linear_pool writecache_sanity/cworigin
  Command on LV writecache_sanity/cworigin does not accept LV type mirror.
  Command not permitted on LV writecache_sanity/cworigin.
[root@hayes-02 ~]# echo $?
5

[root@hayes-02 ~]# lvremove -f /dev/writecache_sanity/linear_pool
  Logical volume "linear_pool" successfully removed
[root@hayes-02 ~]# lvremove -f /dev/writecache_sanity/cworigin
  Logical volume "cworigin" successfully removed


# Raid1 create attempts
[root@hayes-02 ~]# lvcreate  --type raid1 -m 1 -L 2G -n cworigin writecache_sanity /dev/sdp1 /dev/sdk1
  Logical volume "cworigin" created.
[root@hayes-02 ~]# lvcreate  -L 2G -n POOL writecache_sanity /dev/sdf1 /dev/sdc1
  Logical volume "POOL" created.

[root@hayes-02 ~]# lvconvert --yes --type writecache --cachevol writecache_sanity/cworigin writecache_sanity/POOL
  LV writecache_sanity/cworigin must be linear to use as a writecache.
[root@hayes-02 ~]# echo $?
5
#(This one should actually work)
[root@hayes-02 ~]# lvconvert --yes --type writecache --cachevol writecache_sanity/POOL writecache_sanity/cworigin
  Logical volume writecache_sanity/cworigin now has write cache.
[root@hayes-02 ~]# echo $?
0

Comment 5 errata-xmlrpc 2020-04-28 16:59:23 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, 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/RHEA-2020:1881