Bug 1255503

Summary: '--cachepolicy' is documented in both lvconvert and lvchange yet either doesn't work or does but isn't supposed to
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 ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: agk, heinzm, jbrassow, msnitzer, prajnoha, tlavigne, zkabelac
Version: 7.2Keywords: Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: lvm2-2.02.129-1.el7 Doc Type: Enhancement
Doc Text:
Cache support has been extended with support for changing cachepolicy together with cachesetting for individual policies. Options --cachepolicy and --cachesettings are now supported with lvconvert and lvchange command.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 12:47:36 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-08-20 18:45:44 UTC
Description of problem:
This is a continuation from bug 1255171#c3.

# This works, but apparently isn't supposed to.
lvchange(8)
       --cachepolicy policy, --cachesettings key=value
              Only applicable to cached LVs; see also lvmcache(7). Sets the cache policy and its associated tunable settings. In most use-cases, default values should be adequate.


# This is supposed to work but doesn't?
lvconvert(8)
       --cachepolicy policy
              Only applicable to cached LVs; see also lvmcache(7). Sets the cache policy. mq is the basic policy name. sqm is more advanced version available in newer kernels.

** Both lvcreate(8) and lvconvert(8) have this "sqm" typo that needs to be fixed. **


[root@host-109 ~]# lvs
  LV            VG            Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  display_cache cache_sanity  -wi-a-----   4.00g                                                    

[root@host-109 ~]# lvcreate -L 12M -n pool_meta cache_sanity /dev/sda1
  Logical volume "pool_meta" created.
[root@host-109 ~]# lvcreate -L 4G -n pool cache_sanity /dev/sda1
  Logical volume "pool" created.

# Can't use --cachepolicy here
[root@host-109 ~]# lvconvert --yes --cachepolicy smq --type cache-pool --cachemode writethrough -c 64 --poolmetadata cache_sanity/pool_meta cache_sanity/pool
lvconvert: unrecognized option '--cachepolicy'
  Error during parsing of command line.

[root@host-109 ~]# lvconvert --yes --type cache-pool --cachemode writethrough -c 64 --poolmetadata cache_sanity/pool_meta cache_sanity/pool
  WARNING: Converting logical volume cache_sanity/pool and cache_sanity/pool_meta to pool's data and metadata volumes.
  THIS WILL DESTROY CONTENT OF LOGICAL VOLUME (filesystem etc.)
  Converted cache_sanity/pool to cache pool.

[root@host-109 ~]# lvs -a -o +devices
  LV              VG            Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert Devices       
  display_cache   cache_sanity  -wi-a-----   4.00g                                                     /dev/sdd1(0)  
  [lvol0_pmspare] cache_sanity  ewi-------  12.00m                                                     /dev/sdc1(0)  
  pool            cache_sanity  Cwi---C---   4.00g                                                     pool_cdata(0) 
  [pool_cdata]    cache_sanity  Cwi-------   4.00g                                                     /dev/sda1(3)  
  [pool_cmeta]    cache_sanity  ewi-------  12.00m                                                     /dev/sda1(0)  

# Can't use --cachepolicy here
[root@host-109 ~]# lvconvert --yes --cachepolicy smq --type cache --cachepool cache_sanity/pool cache_sanity/display_cache
lvconvert: unrecognized option '--cachepolicy'
  Error during parsing of command line.

[root@host-109 ~]# lvconvert --yes --type cache --cachepool cache_sanity/pool cache_sanity/display_cache
  Logical volume cache_sanity/display_cache is now cached.
[root@host-109 ~]# lvs -a -o +devices
  LV                    VG            Attr       LSize   Pool   Origin                Data%  Meta%  Move Log Cpy%Sync Convert Devices               
  display_cache         cache_sanity  Cwi-a-C---   4.00g [pool] [display_cache_corig] 0.00   4.39            100.00           display_cache_corig(0)
  [display_cache_corig] cache_sanity  owi-aoC---   4.00g                                                                      /dev/sdd1(0)          
  [lvol0_pmspare]       cache_sanity  ewi-------  12.00m                                                                      /dev/sdc1(0)          
  [pool]                cache_sanity  Cwi---C---   4.00g                              0.00   4.39            100.00           pool_cdata(0)         
  [pool_cdata]          cache_sanity  Cwi-ao----   4.00g                                                                      /dev/sda1(3)          
  [pool_cmeta]          cache_sanity  ewi-ao----  12.00m                                                                      /dev/sda1(0)          

# Can't use --cachepolicy here
[root@host-109 ~]# lvconvert --yes --cachepolicy smq cache_sanity/display_cache
lvconvert: unrecognized option '--cachepolicy'




Version-Release number of selected component (if applicable):
3.10.0-306.el7.x86_64
lvm2-2.02.128-1.el7    BUILT: Tue Aug 18 03:45:17 CDT 2015
lvm2-libs-2.02.128-1.el7    BUILT: Tue Aug 18 03:45:17 CDT 2015
lvm2-cluster-2.02.128-1.el7    BUILT: Tue Aug 18 03:45:17 CDT 2015
device-mapper-1.02.105-1.el7    BUILT: Tue Aug 18 03:45:17 CDT 2015
device-mapper-libs-1.02.105-1.el7    BUILT: Tue Aug 18 03:45:17 CDT 2015
device-mapper-event-1.02.105-1.el7    BUILT: Tue Aug 18 03:45:17 CDT 2015
device-mapper-event-libs-1.02.105-1.el7    BUILT: Tue Aug 18 03:45:17 CDT 2015
device-mapper-persistent-data-0.5.5-1.el7    BUILT: Thu Aug 13 09:58:10 CDT 2015
cmirror-2.02.128-1.el7    BUILT: Tue Aug 18 03:45:17 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.128-1.el7    BUILT: Tue Aug 18 03:45:17 CDT 2015

Comment 2 Zdenek Kabelac 2015-08-24 08:20:13 UTC
Missing part of cache enhancement for lvconvert - upstreamed via this commit:

https://www.redhat.com/archives/lvm-devel/2015-August/msg00165.html

Comment 4 Corey Marthaler 2015-10-08 13:54:47 UTC
Checked that --cachepolicy does now work with both lvchange and lvconvert. Marking this bug verified in the latest rpms. However two bug regarding --cachepolicy still currently exist in 7.2 (bug 1269677 and bug 1269679).


3.10.0-319.el7.x86_64
lvm2-2.02.130-2.el7    BUILT: Tue Sep 15 07:15:40 CDT 2015
lvm2-libs-2.02.130-2.el7    BUILT: Tue Sep 15 07:15:40 CDT 2015
lvm2-cluster-2.02.130-2.el7    BUILT: Tue Sep 15 07:15:40 CDT 2015
device-mapper-1.02.107-2.el7    BUILT: Tue Sep 15 07:15:40 CDT 2015
device-mapper-libs-1.02.107-2.el7    BUILT: Tue Sep 15 07:15:40 CDT 2015
device-mapper-event-1.02.107-2.el7    BUILT: Tue Sep 15 07:15:40 CDT 2015
device-mapper-event-libs-1.02.107-2.el7    BUILT: Tue Sep 15 07:15:40 CDT 2015
device-mapper-persistent-data-0.5.5-1.el7    BUILT: Thu Aug 13 09:58:10 CDT 2015
cmirror-2.02.130-2.el7    BUILT: Tue Sep 15 07:15:40 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.130-2.el7    BUILT: Tue Sep 15 07:15:40 CDT 2015

Comment 5 errata-xmlrpc 2015-11-19 12:47:36 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://rhn.redhat.com/errata/RHBA-2015-2147.html