Bug 1299061

Summary: lvs seg_pe_ranges incorrect for RAID LV
Product: [Fedora] Fedora Reporter: Tony Asleson <tasleson>
Component: lvm2Assignee: Alasdair Kergon <agk>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 23CC: agk, bmarzins, bmr, dwysocha, heinzm, jbrassow, jonathan, lvm-team, msnitzer, prajnoha, prockai, zkabelac
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: lvm2-2.02.150-2.fc24.x86_64 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-08-01 09:17:52 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:
Attachments:
Description Flags
ouput from -vvvv none

Description Tony Asleson 2016-01-15 20:47:03 UTC
Description of problem:

The seg_pe_ranges are incorrect for a RAID LV.

# lvs -a -o name,seg_pe_ranges
  LV              PE Ranges
  [lvol0_pmspare] /dev/sdb:129-129
  r5              r5_rimage_0:0-255 r5_rimage_1:0-255 r5_rimage_2:0-255
  [r5_rimage_0]   /dev/sdb:1-128
  [r5_rimage_1]   /dev/sdc:1-128
  [r5_rimage_2]   /dev/sdd:2-129
  [r5_rmeta_0]    /dev/sdb:0-0
  [r5_rmeta_1]    /dev/sdc:0-0
  [r5_rmeta_2]    /dev/sdd:1-1
  tp              tp_tdata:0-255
  [tp_tdata]      /dev/sdb:130-385
  [tp_tmeta]      /dev/sde:0-0

Version-Release number of selected component (if applicable):
NA

How reproducible:
Always

Steps to Reproduce:
1. Create a raid5 LV (lvcreate --size 1G --type raid5 -n testing some_vg
2. Query LV (lvs -a -o name,seg_pe_ranges)

Actual results:
see above

Expected results:

For this specific case we would expect:
r5              r5_rimage_0:0-127 r5_rimage_1:0-127 r5_rimage_2:0-127

Additional info:

Comment 1 Tony Asleson 2016-01-15 22:00:20 UTC
LVM version:     2.02.132(2) (2015-09-22)
Library version: 1.02.115-git (2015-12-14)
Driver version:  4.33.0

Comment 2 Tony Asleson 2016-01-15 22:03:25 UTC
Created attachment 1115300 [details]
ouput from -vvvv

I didn't have the same configuration when I collected this debug, but the issue is the same, just different values.

Comment 3 Alasdair Kergon 2016-01-15 22:25:59 UTC
It's 132.  Before looking at this any further, please try to reproduce on a newer release.  (This code was touched in release 133 - let's at least eliminate those changes.)

Comment 4 Tony Asleson 2016-01-15 22:32:12 UTC
[root@localhost lvm-dubstep]# /home/tasleson/projects/lvm2/tools/lvm version
  LVM version:     2.02.139(2)-git (2015-12-14)
  Library version: 1.02.115-git (2015-12-14)
  Driver version:  4.33.0
[root@localhost lvm-dubstep]# /home/tasleson/projects/lvm2/tools/lvm lvcreate -L1G --type raid5 -n r5 test
  Rounding size 1.00 GiB (256 extents) up to stripe boundary size 1.01 GiB (258 extents).
  Logical volume "r5" created.   
[root@localhost lvm-dubstep]# /home/tasleson/projects/lvm2/tools/lvm lvs -a -o name,seg_pe_ranges
  LV            PE Ranges                                                              
  r5            r5_rimage_0:0-257 r5_rimage_1:0-257 r5_rimage_2:0-257 r5_rimage_3:0-257
  [r5_rimage_0] /dev/sdb:1-86                                                          
  [r5_rimage_1] /dev/sdc:1-86                                                          
  [r5_rimage_2] /dev/sdd:1-86                                                          
  [r5_rimage_3] /dev/sde:1-86                                                          
  [r5_rmeta_0]  /dev/sdb:0-0                                                           
  [r5_rmeta_1]  /dev/sdc:0-0                                                           
  [r5_rmeta_2]  /dev/sdd:0-0                                                           
  [r5_rmeta_3]  /dev/sde:0-0   

Is this new enough?

Comment 5 Alasdair Kergon 2016-01-18 22:12:29 UTC
It was reporting the size of the segment - which is correct for a PV but not necessarily correct when stacked over an LV.
I've changed this to report the size of the LV underneath.

https://www.redhat.com/archives/lvm-devel/2016-January/msg00067.html
https://git.fedorahosted.org/cgit/lvm2.git/commit/?id=a3f484f812bfb89063fbc25e378f34cacd50bf7d

But I've not tested this thoroughly and perhaps there still exist some other stacks where this is wrong.

Comment 6 Zdenek Kabelac 2016-01-19 08:33:02 UTC
IMHO such function should always report  PE ranges.

Names of LV are not really PE - so the reporting function should be simply
calculating join set of PE ranges  (as the name of field suggest)

Currently reported LV name in this field is IMHO plain bug.

Comment 7 Tony Asleson 2016-01-19 19:28:18 UTC
(In reply to Zdenek Kabelac from comment #6)
> IMHO such function should always report  PE ranges.
> 
> Names of LV are not really PE - so the reporting function should be simply
> calculating join set of PE ranges  (as the name of field suggest)
> 
> Currently reported LV name in this field is IMHO plain bug.

I agree with this.  

seg_pe_ranges = "Ranges of Physical Extents of underlying devices in command line format."

Additionally, the PE Ranges when expressed as LV ranges only list those areas that are data areas which don't include the metadata area, thus it's incomplete.

Comment 8 Mike McCune 2016-03-28 22:11:59 UTC
This bug was accidentally moved from POST to MODIFIED via an error in automation, please see mmccune with any questions