Bug 865850

Summary: LVM RAID: Sync state of RAID 4/5/6 not displayed by 'lvs' (or anything else)
Product: Red Hat Enterprise Linux 6 Reporter: Jonathan Earl Brassow <jbrassow>
Component: lvm2Assignee: Jonathan Earl Brassow <jbrassow>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 6.3CC: agk, cmarthal, coughlan, dwysocha, heinzm, jbrassow, msnitzer, nperic, prajnoha, prockai, thornber, zkabelac
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: lvm2-2.02.98-2.el6 Doc Type: Bug Fix
Doc Text:
Previously, the degree to which RAID 4/5/6 logical volumes had completed their initial array synchronization (i.e. initial parity calculations) was not printed in the output of the 'lvs' command. This information is now printed under a heading that has been changed from "Copy%" to "Cpy%Sync". Users can request the "Cpy%Sync" information directly via 'lvs' with either of the following options: ~> lvs -o copy_percent ~> lvs -o sync_percent
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 08:14: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:

Description Jonathan Earl Brassow 2012-10-12 15:55:23 UTC
RAID 4/5/6 go through an initialization phase to do initial parity calculations.  This is similar to mirror or RAID1/10 initialization/synchronization phases.  The mirror, pvmove volumes and RAID1/10 print their progress to the 'copy_percent' field.  This has not seemed appropriate for RAID 4/5/6 - "copy" doesn't really apply.

There either needs to be a new field or the copy_percent field should encompase both and the header name should change.

Comment 3 Jonathan Earl Brassow 2012-10-24 02:24:34 UTC
Changes committed upstream (unit tests are shown in commit messages):

*** PLEASE NOTE: 2 CHECK-INS COMPOSE THIS FIX  ***

commit e1917809477c4850cc1094121001d61a2b70ef26
Author: Jonathan Brassow <jbrassow>
Date:   Tue Oct 23 21:19:27 2012 -0500

    RAID:  Make RAID 4/5/6 display sync status under heading s/Copy%/Cpy%Sync
    
    The heading 'Copy%' is specific to PVMOVE volumes, but can be generalized
    to apply to LVM mirrors also.  It is a bit awkward to use 'Copy%' for
    RAID 4/5/6, however - 'Sync%' would be more appropriate.  This is why
    RAID 4/5/6 have not displayed their sync status by any means available to
    'lvs' yet.
    
    Example (old):
    [root@hayes-02 lvm2]# lvs vg
      LV      VG   Attr      LSize  Pool Origin Data%  Move Log Cpy%Sy Convert
      lv    vg   -wi-a----  1.00g
      raid1 vg   rwi-a-r--  1.00g                             100.00
      raid4 vg   rwi-a-r--  1.01g
      raid5 vg   rwi-a-r--  1.01g
      raid6 vg   rwi-a-r--  1.01g
    
    This patch changes the heading to 'Cpy%Sync' and allows RAID 4/5/6 to print
    their sync percent in this field.
    
    Example (new):
    [root@hayes-02 lvm2]# lvs vg
      LV    VG   Attr      LSize Pool Origin Data%  Move Log Cpy%Sync Convert
      lv    vg   -wi-a---- 1.00g
      raid1 vg   rwi-a-r-- 1.00g                               100.00
      raid4 vg   rwi-a-r-- 1.01g                               100.00
      raid5 vg   rwi-a-r-- 1.01g                               100.00
      raid6 vg   rwi-a-r-- 1.01g                               100.00

commit 6db461e3b0d3fbc394fe2ed2a7d6a3c070453874
Author: Jonathan Brassow <jbrassow>
Date:   Tue Oct 23 20:33:54 2012 -0500

    mirror/raid:  Move 'copy_percent' to common code (mirror.c -> lv_manip.c)
    
    The 'copy_percent' function takes the 'extents_copied' field from each
    segment in an LV to create the numerator for the ratio that is to
    become the copy_percent.  (Otherwise known as the 'sync' percent for
    non-pvmove uses, like mirror LVs and RAID LVs.)  This function safely
    works on RAID - not just mirrors - so it is better to have it in
    lv_manip.c rather than mirror.c.
    
    There's a lot of different functions that do a lot of different things
    in lv_manip.c, so I placed the function near a function in lv_manip.c
    that it was close to in metadata-exported.h.  Different placement in the
    file or a different name for the function may be useful.

Comment 4 Jonathan Earl Brassow 2012-10-24 02:31:00 UTC
QA test requirements:

1) Show that 'lvs' outputs the sync% for RAID1/4/5/6/10, mirror, and pvmove
2) Show that 'lvs -o +sync_percent' is another way to get the sync %'age  (the default way is to use the legacy 'lvs -o copy_percent', which is a default column in 'lvs' output).

Comment 6 Nenad Peric 2013-01-28 13:17:13 UTC
(07:14:25) [root@r6-node01:~]$ lvs -o +sync_percent,devices
  LV      VG       Attr      LSize Pool Origin Data%  Move Log         Cpy%Sync Convert Cpy%Sync Devices                                                 
  lv_root VolGroup -wi-ao--- 7.54g                                                               /dev/vda2(0)                                            
  lv_swap VolGroup -wi-ao--- 1.97g                                                               /dev/vda2(1930)                                         
  mirror  vg       mwi-a-m-- 1.95g                         mirror_mlog    68.40            68.40 mirror_mimage_0(0),mirror_mimage_1(0),mirror_mimage_2(0)

(07:14:29) [root@r6-node01:~]$ lvs -a -o+devices
  LV                VG       Attr      LSize Pool Origin Data%  Move Log         Cpy%Sync Convert Devices                                                 
  lv_root           VolGroup -wi-ao--- 7.54g                                                      /dev/vda2(0)                                            
  lv_swap           VolGroup -wi-ao--- 1.97g                                                      /dev/vda2(1930)                                         
  mirror            vg       mwi-a-m-- 1.95g                         mirror_mlog    72.20         mirror_mimage_0(0),mirror_mimage_1(0),mirror_mimage_2(0)
  [mirror_mimage_0] vg       Iwi-aom-- 1.95g                                                      /dev/sda1(0)                                            
  [mirror_mimage_1] vg       Iwi-aom-- 1.95g                                                      /dev/sdb1(0)                                            
  [mirror_mimage_2] vg       Iwi-aom-- 1.95g                                                      /dev/sdc1(0)                                            
  [mirror_mlog]     vg       lwi-aom-- 4.00m                                                      /dev/sde1(0)   



lvs omits device desply when using the option +sync_percent.
Why can't it display it the same as without +sync_percent?

Comment 7 Nenad Peric 2013-01-28 13:22:43 UTC
Disregard the comment.. I have missed -a.
Sorry. 

I need a coffee.. 

Marking this BZ verified with lvm2-2.02.98-8.el6.x86_64


(07:01:35) [root@r6-node01:~]$ lvs -o +sync_percent
  LV       VG       Attr      LSize   Pool Origin Data%  Move Log Cpy%Sync Convert Cpy%Sync
  lv_root  VolGroup -wi-ao---   7.54g                                                      
  lv_swap  VolGroup -wi-ao---   1.97g                                                      
  raid4_lv bigvg    rwi-a-r-- 800.00m                                27.50            27.50

(07:02:19) [root@r6-node01:~]$ lvs -o +sync_percent
  LV       VG       Attr      LSize   Pool Origin Data%  Move Log Cpy%Sync Convert Cpy%Sync
  lv_root  VolGroup -wi-ao---   7.54g                                                      
  lv_swap  VolGroup -wi-ao---   1.97g                                                      
  raid4_lv bigvg    rwi-a-r-- 800.00m                               100.00           100.00
  raid5_lv bigvg    rwi-a-r-- 804.00m                                17.41            17.41


(07:04:22) [root@r6-node01:~]$ lvs -o +sync_percent
  LV        VG       Attr      LSize   Pool Origin Data%  Move Log Cpy%Sync Convert Cpy%Sync
  lv_root   VolGroup -wi-ao---   7.54g                                                      
  lv_swap   VolGroup -wi-ao---   1.97g                                                      
  raid10_lv bigvg    rwi-a-r-- 804.00m                               100.00           100.00
  raid1_lv  bigvg    rwi-a-r-- 800.00m                                 8.00             8.00
  raid4_lv  bigvg    rwi-a-r-- 800.00m                               100.00           100.00
  raid5_lv  bigvg    rwi-a-r-- 804.00m                               100.00           100.00
  raid6_lv  bigvg    rwi-a-r-- 804.00m                                75.62            75.62

Comment 8 errata-xmlrpc 2013-02-21 08:14: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.

http://rhn.redhat.com/errata/RHBA-2013-0501.html