Bug 1143753

Summary: LVM cache: 'lvs' is unable to print the cachemode
Product: Red Hat Enterprise Linux 7 Reporter: Jonathan Earl Brassow <jbrassow>
Component: lvm2Assignee: David Teigland <teigland>
lvm2 sub component: Cache Logical Volumes QA Contact: Cluster QE <mspqa-list>
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: unspecified CC: agk, cmarthal, heinzm, jbrassow, msnitzer, prajnoha, zkabelac
Version: 7.1   
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: lvm2-2.02.112-1.el7 Doc Type: Bug Fix
Doc Text:
No Documentation Needed
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 13:09:30 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: 1119326    
Attachments:
Description Flags
broken patch none

Description Jonathan Earl Brassow 2014-09-17 22:18:38 UTC
It is possible to set a cachepool to use "writeback" or "writethrough" cache mode, but it is not possible to get that information from 'lvs' (e.g. 'lvs -o cachemode').

Comment 1 Jonathan Earl Brassow 2014-09-17 22:19:54 UTC
Created attachment 938655 [details]
broken patch

here is an untested and partially written patch for this issue.  If it is helpful to you, great.

Comment 4 David Teigland 2014-10-02 16:56:47 UTC
    cache: include cache mode in vg metadata and display
    
    The cache mode of a new cache pool is always explicitly
    included in the vg metadata.  If a cache mode is not
    specified on the command line, the cache mode is taken
    from lvm.conf allocation/cache_pool_cachemode, which
    defaults to "writethrough".
    
    The cache mode can be displayed with lvs -o+cachemode.

Comment 6 Corey Marthaler 2015-01-22 22:00:16 UTC
Fixed verified in the latest rpms.

3.10.0-223.el7.x86_64
lvm2-2.02.115-2.el7    BUILT: Thu Jan 22 06:09:14 CST 2015
lvm2-libs-2.02.115-2.el7    BUILT: Thu Jan 22 06:09:14 CST 2015
lvm2-cluster-2.02.115-2.el7    BUILT: Thu Jan 22 06:09:14 CST 2015
device-mapper-1.02.93-2.el7    BUILT: Thu Jan 22 06:09:14 CST 2015
device-mapper-libs-1.02.93-2.el7    BUILT: Thu Jan 22 06:09:14 CST 2015
device-mapper-event-1.02.93-2.el7    BUILT: Thu Jan 22 06:09:14 CST 2015
device-mapper-event-libs-1.02.93-2.el7    BUILT: Thu Jan 22 06:09:14 CST 2015
device-mapper-persistent-data-0.4.1-2.el7    BUILT: Wed Nov 12 12:39:46 CST 2014
cmirror-2.02.115-2.el7    BUILT: Thu Jan 22 06:09:14 CST 2015



# WRITETHROUGH
lvcreate -L 4G -n corigin cache_sanity /dev/sde1
lvcreate -L 2G -n display_cache cache_sanity /dev/sdd1
lvcreate -L 12M -n display_cache_meta cache_sanity /dev/sdd1
lvconvert --yes --type cache-pool --cachemode writethrough -c 64 --poolmetadata cache_sanity/display_cache_meta cache_sanity/display_cache
lvconvert --yes --type cache --cachepool cache_sanity/display_cache cache_sanity/corigin
[root@host-114 ~]# lvs -a -o +devices,cachemode
 LV                    Attr       LSize   Pool            Origin          Data% Meta% Cpy%Sync Devices                Cachemode
 corigin               Cwi-a-C---   4.00g [display_cache] [corigin_corig] 0.02  2.31  0.00     corigin_corig(0)       writethrough
 [corigin_corig]       owi-aoC---   4.00g                                                      /dev/sde1(0)
 [display_cache]       Cwi---C---   2.00g                                 0.02  2.31  0.00     display_cache_cdata(0) writethrough
 [display_cache_cdata] Cwi-ao----   2.00g                                                      /dev/sdd1(0)
 [display_cache_cmeta] ewi-ao----  12.00m                                                      /dev/sdd1(512)
 [lvol0_pmspare]       ewi-------  12.00m                                                      /dev/sdb1(0)



# WRITEBACK
lvcreate -L 4G -n corigin cache_sanity /dev/sdb1
lvcreate -L 2G -n display_cache cache_sanity /dev/sdc1
lvcreate -L 12M -n display_cache_meta cache_sanity /dev/sdc1
lvconvert --yes --type cache-pool --cachemode writeback -c 32 --poolmetadata cache_sanity/display_cache_meta cache_sanity/display_cache
lvconvert --yes --type cache --cachepool cache_sanity/display_cache cache_sanity/corigin
[root@host-114 ~]# lvs -a -o +devices,cachemode
 LV                    Attr       LSize   Pool            Origin          Data% Meta% Cpy%Sync Devices                Cachemode
 corigin               Cwi-a-C---   4.00g [display_cache] [corigin_corig] 0.01  4.39  0.00     corigin_corig(0)       writeback
 [corigin_corig]       owi-aoC---   4.00g                                                      /dev/sdb1(0)
 [display_cache]       Cwi---C---   2.00g                                 0.01  4.39  0.00     display_cache_cdata(0) writeback
 [display_cache_cdata] Cwi-ao----   2.00g                                                      /dev/sdc1(0)
 [display_cache_cmeta] ewi-ao----  12.00m                                                      /dev/sdc1(512)
 [lvol0_pmspare]       ewi-------  12.00m                                                      /dev/sdb1(1024)

Comment 8 errata-xmlrpc 2015-03-05 13:09:30 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-0513.html