Bug 976104 - lvconvert should convert to the raid1 segtype by default if mirror_segtype_default set to raid1
Summary: lvconvert should convert to the raid1 segtype by default if mirror_segtype_de...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: lvm2
Version: 6.4
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Jonathan Earl Brassow
QA Contact: Cluster QE
URL:
Whiteboard:
Depends On: 841445
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-06-19 22:42 UTC by Jonathan Earl Brassow
Modified: 2018-02-23 14:19 UTC (History)
14 users (show)

Fixed In Version: lvm2-2.02.100-4.el6
Doc Type: Bug Fix
Doc Text:
Previously, when converting a linear logical volume to a mirror logical volume, the prefered mirror segment type set in the configuration file was not always honored. This has been corrected and the conversion will now properly use the segment type set by 'mirror_segtype_default' in the lvm configuration file, /etc/lvm/lvm.conf.
Clone Of: 841445
Environment:
Last Closed: 2013-11-21 23:25:38 UTC


Attachments (Terms of Use)
Upstream commit that resolves this issue (3.50 KB, patch)
2013-06-19 22:56 UTC, Jonathan Earl Brassow
no flags Details | Diff
Verbose lvconvert (142.89 KB, text/x-log)
2013-08-14 12:18 UTC, Nenad Peric
no flags Details


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:1704 normal SHIPPED_LIVE lvm2 bug fix and enhancement update 2013-11-20 21:52:01 UTC

Comment 1 Jonathan Earl Brassow 2013-06-19 22:56:48 UTC
Created attachment 763161 [details]
Upstream commit that resolves this issue

commit a6d13308ec0baca9a5bd48f80d02e5c71a54287f
Author: Jonathan Brassow <jbrassow@redhat.com>
Date:   Wed Jun 19 17:50:10 2013 -0500

    RAID/MIRROR: Honor mirror_segtype_default when upconverting linear LVs
    
    If the user would upconvert a linear LV to a mirror without specifying
    the segment type ("--type mirror" vs "--type raid1"), the "mirror"
    segment type would be chosen without consulting the 'default_mirror_segtype'
    setting in lvm.conf.  This is now used as the basis for determining
    which should be used if left unspecified.

Comment 3 Nenad Peric 2013-08-14 11:38:24 UTC
Unfortunately, this does not seem to work:

[root@tardis-01 ~]# grep segtype /etc/lvm/lvm.conf
    # 'mirror_segtype_default' defines which segtype will be used when the
    mirror_segtype_default = "raid1"
    # 'raid10_segtype_default' determines the segment types used by default
    raid10_segtype_default = "mirror"
[root@tardis-01 ~]# lvcreate -n simple_lv mirror -L 250M
  Rounding up size to full physical extent 252.00 MiB
  Logical volume "simple_lv" created
[root@tardis-01 ~]# lvconvert -m1 mirror/simple_lv
  mirror/simple_lv: Converted: 0.0%
  mirror/simple_lv: Converted: 100.0%

[root@tardis-01 ~]# lvs -a mirror/simple_lv -o +segtype
  LV        VG     Attr       LSize   Pool Origin Data%  Move Log            Cpy%Sync Convert Type  
  simple_lv mirror mwi-a-m--- 252.00m                         simple_lv_mlog   100.00         mirror

Comment 4 Nenad Peric 2013-08-14 12:18:18 UTC
Created attachment 786524 [details]
Verbose lvconvert

Some additional info:

[root@tardis-01 ~]# lvm dumpconfig --mergedconfig global
global {
	umask=63
	test=0
	units="h"
	si_unit_consistency=1
	activation=1
	proc="/proc"
	locking_type=1
	wait_for_locks=1
	fallback_to_clustered_locking=1
	fallback_to_local_locking=1
	locking_dir="/var/lock/lvm"
	prioritise_write_locks=1
	abort_on_internal_errors=0
	detect_internal_vg_cache_corruption=0
	metadata_read_only=0
	mirror_segtype_default="raid1"
	raid10_segtype_default="mirror"
	use_lvmetad=1
}

Comment 5 Jonathan Earl Brassow 2013-09-25 20:08:23 UTC
Why is this not triggered by the test suite?  These tests are in there:

FROM lvconvert-mirror.sh:
# convert from linear to 2-way mirror ("mirror" default type)
lvcreate -aey -l2 -n $lv1 $vg "$dev1"
lvconvert -i1 -m+1 $vg/$lv1 "$dev2" "$dev3:0-1" \
        --config 'global { mirror_segtype_default = "mirror" }'
lvs --noheadings -o attr $vg/$lv1 | grep '^m*'
lvremove -ff $vg

# convert from linear to 2-way mirror (override "raid1" default type)
lvcreate -aey -l2 -n $lv1 $vg "$dev1"
lvconvert -i1 --type mirror -m+1 $vg/$lv1 "$dev2" "$dev3:0-1" \
        --config 'global { mirror_segtype_default = "raid1" }'
lvs --noheadings -o attr $vg/$lv1 | grep '^m*'
lvremove -ff $vg


FROM lvconvert-raid.sh:
###########################################
# Linear to RAID1 conversion ("raid1" default segtype)
###########################################
lvcreate -aey -l 2 -n $lv1 $vg
lvconvert -m 1 $vg/$lv1 \
        --config 'global { mirror_segtype_default = "raid1" }'
lvs --noheadings -o attr $vg/$lv1 | grep '^r*'
lvremove -ff $vg

###########################################
# Linear to RAID1 conversion (override "mirror" default segtype)
###########################################
lvcreate -aey -l 2 -n $lv1 $vg
lvconvert --type raid1 -m 1 $vg/$lv1 \
        --config 'global { mirror_segtype_default = "mirror" }'
lvs --noheadings -o attr $vg/$lv1 | grep '^r*'
lvremove -ff $vg

Comment 6 Jonathan Earl Brassow 2013-09-25 20:54:16 UTC
It is the '*' in the grep expression - they are matching no matter what.

Changing:
lvs --noheadings -o attr $vg/$lv1 | grep '^r*'
to
lvs --noheadings -o attr $vg/$lv1 | grep '^r'

will fix the tests...

Comment 7 Jonathan Earl Brassow 2013-09-26 03:34:51 UTC
code and tests fixed in upstream commit:

commit 098896fb2905cd02d02b7271be489e32d86c073d
Author: Jonathan Brassow <jbrassow@redhat.com>
Date:   Wed Sep 25 22:25:43 2013 -0500

    mirror/RAID: Honor mirror_segtype_default when converting from linear
    
    1) When converting from an x-way mirror/raid1 to a y-way mirror/raid1,
    the default behaviour should be to stay the same segment type.
    
    2) When converting from linear to mirror or raid1, the default behaviour
    should honor the mirror_segtype_default.
    
    3) When converting and the '--type' argument is specified, the '--type'
    argument should be honored.
    
    catch such conditions, but errors in the tests caused the issue to go
    unnoticed.  The code has been fixed to perform #2 properly, the tests
    have been corrected to properly test for #2, and a few other tests
    were changed to explicitly specify the '--type mirror' when necessary.

Comment 10 Nenad Peric 2013-10-03 13:27:06 UTC
[root@virt-013 yum.repos.d]# lvcreate -L1G -n linear vg
  Logical volume "linear" created

[root@virt-013 yum.repos.d]# lvconvert -m1 vg/linear

[root@virt-013 yum.repos.d]# lvs -o+segtype
  LV      VG         Attr       LSize   Pool Origin Data%  Move Log Cpy%Sync Convert Type  
  linear  vg         rwi-a-r---   1.00g                                18.75         raid1 


Marking verified with: lvm2-2.02.100-4.el6.x86_64

Comment 11 errata-xmlrpc 2013-11-21 23:25:38 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-1704.html


Note You need to log in before you can comment on or make changes to this bug.