Bug 1247386

Summary: lvcreate and lvchange need '--cachepolicy' validity checks
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 WONTFIX Docs Contact:
Severity: low    
Priority: low CC: agk, heinzm, jbrassow, msnitzer, prajnoha, zkabelac
Version: 7.2Keywords: Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-12-15 07:35:41 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 2015-07-27 21:00:30 UTC
Description of problem:
[root@host-109 ~]# lvcreate --cachepolicy smq --type cache-pool -L 2G -n pool1 vg
  Logical volume "pool1" created.
[root@host-109 ~]# lvcreate --cachepolicy cleaner --type cache-pool -L 2G -n pool2 vg
  Logical volume "pool2" created.
[root@host-109 ~]# lvcreate --cachepolicy garbage --type cache-pool -L 2G -n pool3 vg
  Logical volume "pool3" created.
[root@host-109 ~]# lvcreate --cachepolicy fake --type cache-pool -L 2G -n pool4 vg
  Logical volume "pool4" created.

[root@host-109 ~]# lvs -a -o +devices
  LV              VG  Attr       LSize    Devices        
  [lvol0_pmspare] vg  ewi-------   8.00m  /dev/sda1(0)   
  pool1           vg  Cwi---C---   2.00g  pool1_cdata(0) 
  [pool1_cdata]   vg  Cwi-------   2.00g  /dev/sda1(4)   
  [pool1_cmeta]   vg  ewi-------   8.00m  /dev/sda1(2)   
  pool2           vg  Cwi---C---   2.00g  pool2_cdata(0) 
  [pool2_cdata]   vg  Cwi-------   2.00g  /dev/sda1(518) 
  [pool2_cmeta]   vg  ewi-------   8.00m  /dev/sda1(516) 
  pool3           vg  Cwi---C---   2.00g  pool3_cdata(0) 
  [pool3_cdata]   vg  Cwi-------   2.00g  /dev/sda1(1032)
  [pool3_cmeta]   vg  ewi-------   8.00m  /dev/sda1(1030)
  pool4           vg  Cwi---C---   2.00g  pool4_cdata(0) 
  [pool4_cdata]   vg  Cwi-------   2.00g  /dev/sda1(1546)
  [pool4_cmeta]   vg  ewi-------   8.00m  /dev/sda1(1544)

# change the pool to be used in the convert to a fake policy
[root@host-109 ~]# lvchange --cachepolicy fake vg/pool1
  Logical volume "pool1" changed.
[root@host-109 ~]# lvcreate -L 200M -n origin1 vg
  Logical volume "origin1" created.
[root@host-109 ~]# lvconvert --yes --type cache --cachepool vg/pool1 vg/origin1
  device-mapper: reload ioctl on (253:2) failed: Invalid argument
  Failed to lock logical volume vg/origin1.


[root@host-109 ~]# lvcreate --cachepolicy smq --type cache-pool -L 2G -n pool5 vg
  Logical volume "pool5" created.
[root@host-109 ~]# lvcreate -L 200M -n origin2 vg
  Logical volume "origin2" created.
[root@host-109 ~]# lvconvert --yes --type cache --cachepool vg/pool5 vg/origin2
  Logical volume vg/origin2 is now cached.

# attempt to change the policy of an existing valid one
[root@host-109 ~]# lvchange --cachepolicy fake vg/origin2
  device-mapper: reload ioctl on (253:2) failed: Invalid argument
  Failed to lock logical volume vg/origin2.

[ 1732.044604] device-mapper: cache-policy: unknown policy type
[ 1732.045245] device-mapper: table: 253:2: cache: Error creating cache's policy
[ 1732.046035] device-mapper: ioctl: error adding target to table



Version-Release number of selected component (if applicable):
3.10.0-296.el7.x86_64
lvm2-2.02.125-2.el7    BUILT: Fri Jul 10 03:42:29 CDT 2015
lvm2-libs-2.02.125-2.el7    BUILT: Fri Jul 10 03:42:29 CDT 2015
lvm2-cluster-2.02.125-2.el7    BUILT: Fri Jul 10 03:42:29 CDT 2015
device-mapper-1.02.102-2.el7    BUILT: Fri Jul 10 03:42:29 CDT 2015
device-mapper-libs-1.02.102-2.el7    BUILT: Fri Jul 10 03:42:29 CDT 2015
device-mapper-event-1.02.102-2.el7    BUILT: Fri Jul 10 03:42:29 CDT 2015
device-mapper-event-libs-1.02.102-2.el7    BUILT: Fri Jul 10 03:42:29 CDT 2015
device-mapper-persistent-data-0.5.4-1.el7    BUILT: Fri Jul 17 08:56:22 CDT 2015
cmirror-2.02.125-2.el7    BUILT: Fri Jul 10 03:42:29 CDT 2015

Comment 1 Zdenek Kabelac 2015-08-24 08:25:58 UTC
We could try better here - however the idea behind cache policies is to let user create his own policy module - so lvm2 allows arbitrary policy name - not just 'mq' or 'smq'

But we may possibly hook some extra module test for policy name - I'll check with Joe what are the limits for policy names.

Comment 4 RHEL Program Management 2020-12-15 07:35:41 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.