Bug 976104
| Summary: | lvconvert should convert to the raid1 segtype by default if mirror_segtype_default set to raid1 | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Jonathan Earl Brassow <jbrassow> | ||||||
| Component: | lvm2 | Assignee: | Jonathan Earl Brassow <jbrassow> | ||||||
| Status: | CLOSED ERRATA | QA Contact: | Cluster QE <mspqa-list> | ||||||
| Severity: | medium | Docs Contact: | |||||||
| Priority: | unspecified | ||||||||
| Version: | 6.4 | CC: | agk, bubrown, dwysocha, heinzm, jbrassow, msnitzer, nperic, prajnoha, prockai, thornber, tlavigne, vincent, xiaoli, zkabelac | ||||||
| Target Milestone: | rc | ||||||||
| Target Release: | --- | ||||||||
| Hardware: | Unspecified | ||||||||
| OS: | Unspecified | ||||||||
| Whiteboard: | |||||||||
| 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.
|
Story Points: | --- | ||||||
| Clone Of: | 841445 | Environment: | |||||||
| Last Closed: | 2013-11-21 23:25:38 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: | 841445 | ||||||||
| Bug Blocks: | |||||||||
| Attachments: |
|
||||||||
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
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
}
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
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... code and tests fixed in upstream commit:
commit 098896fb2905cd02d02b7271be489e32d86c073d
Author: Jonathan Brassow <jbrassow>
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.
[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 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 |
Created attachment 763161 [details] Upstream commit that resolves this issue commit a6d13308ec0baca9a5bd48f80d02e5c71a54287f Author: Jonathan Brassow <jbrassow> 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.