Bug 204136
| Summary: | lvconvert splits allocation unnecessarily | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 5 | Reporter: | Jun'ichi Nomura (Red Hat) <jnomura> | ||||
| Component: | lvm2 | Assignee: | LVM and device-mapper development team <lvm-team> | ||||
| Status: | CLOSED CURRENTRELEASE | QA Contact: | |||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | medium | ||||||
| Version: | 5.2 | CC: | agk, coughlan, dwysocha, heinzm, iannis, i-kitayama, jbrassow, lmiksik, prajnoha, prockai | ||||
| Target Milestone: | rc | ||||||
| Target Release: | --- | ||||||
| Hardware: | All | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2014-04-07 14:30:49 UTC | Type: | --- | ||||
| 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: | 1049888 | ||||||
| Attachments: |
|
||||||
Created attachment 134955 [details]
Reproducer test script
This request was previously evaluated by Red Hat Product Management for inclusion in the current Red Hat Enterprise Linux release, but Red Hat was unable to resolve it in time. This request will be reviewed for a future Red Hat Enterprise Linux release. This request was evaluated by Red Hat Product Management for inclusion in a Red Hat Enterprise Linux maintenance release. Product Management has requested further review of this request by Red Hat Engineering, for potential inclusion in a Red Hat Enterprise Linux Update release for currently deployed products. This request is not yet committed for inclusion in an Update release. Does the cling policy make any difference now? Moving that bug to RHEL5 product for future tracking of the problem. This seems to be working with lvconvert --alloc cling now:
[root@localhost ~]# lvcreate -L 400m vg /dev/sda
Logical volume "lvol0" created
[root@localhost ~]# lvcreate -L 400m vg /dev/sdb
Logical volume "lvol1" created
[root@localhost ~]# lvcreate -L 400m vg /dev/sda /dev/sdb
Logical volume "lvol2" created
[root@localhost ~]# lvdisplay --maps vg
--- Logical volume ---
LV Name /dev/vg/lvol0
VG Name vg
LV UUID zR8j42-DK1R-zLgO-ZdXK-nlVS-wg5C-TyPcob
LV Write Access read/write
LV Status available
# open 0
LV Size 400.00 MB
Current LE 100
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:2
--- Segments ---
Logical extent 0 to 99:
Type linear
Physical volume /dev/sda
Physical extents 0 to 99
--- Logical volume ---
LV Name /dev/vg/lvol1
VG Name vg
LV UUID 0T26qE-1sLk-I7Wq-goHS-23Au-rBtO-YihTl0
LV Write Access read/write
LV Status available
# open 0
LV Size 400.00 MB
Current LE 100
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:3
--- Segments ---
Logical extent 0 to 99:
Type linear
Physical volume /dev/sdb
Physical extents 0 to 99
--- Logical volume ---
LV Name /dev/vg/lvol2
VG Name vg
LV UUID 1bE3wS-b72I-iD3w-74oq-wB4S-lYBt-hjK9EH
LV Write Access read/write
LV Status available
# open 0
LV Size 1000.00 MB
Current LE 250
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:4
--- Segments ---
Logical extent 0 to 154:
Type linear
Physical volume /dev/sda
Physical extents 100 to 254
Logical extent 155 to 249:
Type linear
Physical volume /dev/sdb
Physical extents 100 to 194
[root@localhost ~]# lvremove -ff vg/lvol0
Logical volume "lvol0" successfully removed
[root@localhost ~]# lvremove -ff vg/lvol1
Logical volume "lvol1" successfully removed
[root@localhost ~]# lvconvert -m1 vg/lvol2 --alloc cling
vg/lvol2: Converted: 0.0%
vg/lvol2: Converted: 26.4%
vg/lvol2: Converted: 52.0%
vg/lvol2: Converted: 75.2%
vg/lvol2: Converted: 96.8%
vg/lvol2: Converted: 100.0%
[root@localhost ~]# lvs -a -o lv_name,vg_name,lv_size,devices vg
LV VG LSize Devices
lvol2 vg 1000.00M lvol2_mimage_0(0),lvol2_mimage_1(0)
[lvol2_mimage_0] vg 1000.00M /dev/sda(100)
[lvol2_mimage_0] vg 1000.00M /dev/sdb(100)
[lvol2_mimage_1] vg 1000.00M /dev/sdc(0)
[lvol2_mlog] vg 4.00M /dev/sdb(0)
|
Description of problem: lvconvert splits newly allocated mirror unnecessarily if the original LV spans to multiple segments Version-Release number of selected component: lvm2-2.02.06-6.0.RHEL4 How reproducible: Always Steps to Reproduce: 1. Create a VG with 5 or more PVs # vgcreate testvg /dev/sdb[1-5] 2. Create a linear LV which spans multiple PVs but smaller than one PV # lvcreate -L<PV size / 2> -nlv1 testvg /dev/sdb1 # lvcreate -L<PV size / 2> -nlv2 testvg /dev/sdb2 # lvcreate -L<PV size> -nlv0 testvg /dev/sdb1 /dev/sdb2 # lvremove testvg/lv1 # lvremove testvg/lv2 As a result, testvg/lv0 uses both /dev/sdb1 and /dev/sdb2 while its size can be fit within one PV. 3. Convert it to mirror # lvconvert -m1 testvg/lv0 4. Check how the mirror image is allocated # lvs -o+devices Actual results: Newly allocated mirror image is splitted to 2 PVs. Expected results: Newly allocated mirror image is allocated within 1 PV. Additional info: Attached script does the above steps and show what happens. # sh /root/lvconvert-multiseg2.sh ... INFO: Create linear LV spanning multiple PVs. ... LV Devices lv0 /dev/dm-0(2) lv0 /dev/dm-1(2) INFO: Convert the LV to mirrored. Logical volume lv0 converted. LV Devices SSize lv0 lv0_mimage_0(0),lv0_mimage_1(0) 16.00M [lv0_mimage_0] /dev/dm-0(2) 8.00M [lv0_mimage_0] /dev/dm-1(2) 8.00M [lv0_mimage_1] /dev/dm-2(0) 8.00M [lv0_mimage_1] /dev/dm-3(0) 8.00M [lv0_mlog] /dev/dm-4(0) 4.00M PV VG Fmt Attr PSize PFree /dev/dm-0 testvg0 lvm2 a- 16.00M 8.00M /dev/dm-1 testvg0 lvm2 a- 16.00M 8.00M /dev/dm-2 testvg0 lvm2 a- 16.00M 8.00M /dev/dm-3 testvg0 lvm2 a- 16.00M 8.00M /dev/dm-4 testvg0 lvm2 a- 16.00M 12.00M ... Expected result was: LV Devices SSize lv0 lv0_mimage_0(0),lv0_mimage_1(0) 16.00M [lv0_mimage_0] /dev/dm-0(2) 8.00M [lv0_mimage_0] /dev/dm-1(2) 8.00M [lv0_mimage_1] /dev/dm-2(0) 16.00M [lv0_mlog] /dev/dm-4(0) 4.00M PV VG Fmt Attr PSize PFree /dev/dm-0 testvg0 lvm2 a- 16.00M 8.00M /dev/dm-1 testvg0 lvm2 a- 16.00M 8.00M /dev/dm-2 testvg0 lvm2 a- 16.00M 0 /dev/dm-3 testvg0 lvm2 a- 16.00M 16.00M /dev/dm-4 testvg0 lvm2 a- 16.00M 12.00M