Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 4 product line. The current stable release is 4.9. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 204127

Summary: lvconvert must honor allocation policy
Product: Red Hat Enterprise Linux 4 Reporter: Jun'ichi Nomura (Red Hat) <jnomura>
Component: lvm2Assignee: Milan Broz <mbroz>
Status: CLOSED DEFERRED QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4.4CC: agk, coughlan, dwysocha, i-kitayama, jbrassow, mbroz, pvrabec
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: 2009-03-05 13:03:37 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: 221891, 233105    
Attachments:
Description Flags
Reproducer test script
none
Reproducer test script none

Description Jun'ichi Nomura (Red Hat) 2006-08-25 18:34:54 UTC
Description of problem:
lvconvert from corelog to disklog allocates log device
from the same PV where mirror image resides

Version-Release number of selected component:
lvm2-2.02.06-6.0.RHEL4

How reproducible:
Always

Steps to Reproduce:
 1. Create a VG with 3 or more PVs
      # vgcreate testvg /dev/sdb[1-3]
 2. Create a mirrored LV with corelog
      # lvcreate -m1 --corelog -l1 -nlv0 testvg
 3. Convert it to disklog
      # lvconvert -m1 testvg/lv0
 4. Check what consists of the LV
      # lvs -a -o+devices

Actual results:
  Mirror image and log shares the same PV.

  LV             Devices
  lv0            lv0_mimage_0(0),lv0_mimage_1(0)
  [lv0_mimage_0] /dev/sdb1(0)
  [lv0_mimage_1] /dev/sdb2(0)
  [lv0_mlog]     /dev/sdb2(1)

Expected results:
  Mirror images and log use different PVs.

  LV             Devices
  lv0            lv0_mimage_0(0),lv0_mimage_1(0)
  [lv0_mimage_0] /dev/sdb1(0)
  [lv0_mimage_1] /dev/sdb2(0)
  [lv0_mlog]     /dev/sdb3(0)

Additional info:

Attached script does the above steps and show what happens.

# sh lvconvert-corelog.sh
INFO: Creating a file for loop setup. file=tmpfile
122880+0 records in
122880+0 records out
INFO: Setting up loop device. dev=/dev/loop0 file=tmpfile
INFO: Creating PV. nr_pv=3
  Physical volume "/dev/mapper/pv0" successfully created
  Physical volume "/dev/mapper/pv1" successfully created
  Physical volume "/dev/mapper/pv2" successfully created
INFO: Creating VG. nr_vg=1. each pv in a vg: 3
INFO: vgname=testvg0
  Volume group "testvg0" successfully created
INFO: Create mirrored LV with corelog.
  Logical volume "lv0" created
  LV             Devices
  lv0            lv0_mimage_0(0),lv0_mimage_1(0)
  [lv0_mimage_0] /dev/dm-0(0)
  [lv0_mimage_1] /dev/dm-1(0)
INFO: Convert the LV to disklog.
  Logical volume lv0 converted.
  LV             Devices
  lv0            lv0_mimage_0(0),lv0_mimage_1(0)
  [lv0_mimage_0] /dev/dm-0(0)
  [lv0_mimage_1] /dev/dm-1(0)
  [lv0_mlog]     /dev/dm-1(1)
INFO: Cleaning up.

Comment 1 Jun'ichi Nomura (Red Hat) 2006-08-25 18:34:55 UTC
Created attachment 134949 [details]
Reproducer test script

Comment 2 Jonathan Earl Brassow 2006-09-08 20:01:45 UTC
Changed title to reflect real problem.

The default allocation policy requires mirror images and log device to go on
distinct devices.  If the allocation policy is 'anywhere', the mirror images
must be on distinct devices, but the log device can go anywhere.  When
up-converting, lvconvert behaves as though the allocation policy is 'anywhere'.

Comment 3 Jun'ichi NOMURA 2006-09-22 22:37:32 UTC
Patch and test case posted on linux-lvm:
https://www.redhat.com/archives/linux-lvm/2006-September/msg00108.html

Comment 4 Jun'ichi NOMURA 2006-09-22 22:43:25 UTC
This patch should also be necessary to support the patches in comment #3
https://www.redhat.com/archives/linux-lvm/2006-August/msg00116.html

Comment 6 Jonathan Earl Brassow 2007-01-08 20:06:42 UTC
The patches work.


Comment 7 Jun'ichi NOMURA 2007-01-08 20:42:59 UTC
Created attachment 145103 [details]
Reproducer test script

What this script does:
  1. Create loop-back device and dummy PVs on top of it
  2. Create VG named "testvg" on it
  3. lvcreate --corelog -m1
      The each leg of the created mirror LV spans multiple PVs.
  4. lvconvert -m1
  5. Check the redundancy

How to run:

# sh testcase-lvconvert-addlog-multiseg.sh 
  PV /dev/dm-7	  VG testvg   lvm2 [196.00 MB / 0    free]
  PV /dev/dm-8	  VG testvg   lvm2 [196.00 MB / 0    free]
  PV /dev/dm-9	  VG testvg   lvm2 [196.00 MB / 100.00 MB free]
  PV /dev/dm-10   VG testvg   lvm2 [196.00 MB / 96.00 MB free]
  PV /dev/dm-11   VG testvg   lvm2 [196.00 MB / 196.00 MB free]
  PV /dev/dm-12   VG testvg   lvm2 [196.00 MB / 196.00 MB free]
  PV /dev/dm-13   VG testvg   lvm2 [196.00 MB / 196.00 MB free]
  Total: 11 [19.03 GB] / in use: 9 [11.43 GB] / in no VG: 2 [7.60 GB]
  VG	 #PV #LV #SN Attr   VSize VFree  
  testvg   7   4   0 wz--n- 1.34G 784.00M
  VG	 #PV #LV #SN Attr   VSize VFree  
  testvg   7   4   0 wz--n- 1.34G 784.00M
  Logical volume "lv" successfully removed
INFO: PE count of PV is 49.
  /dev/dm-10 testvg lvm2 a-   196.00M 196.00M
  /dev/dm-11 testvg lvm2 a-   196.00M 196.00M
  /dev/dm-12 testvg lvm2 a-   196.00M 196.00M
  /dev/dm-13 testvg lvm2 a-   196.00M 196.00M
  /dev/dm-7  testvg lvm2 a-   196.00M 196.00M
  /dev/dm-8  testvg lvm2 a-   196.00M 196.00M
  /dev/dm-9  testvg lvm2 a-   196.00M 196.00M
INFO: Create mirror LV with each legs spanning multiple PVs.
  Logical volume "lv" created
  LV		Devices 		      
  lv		lv_mimage_0(0),lv_mimage_1(0) 
  [lv_mimage_0] /dev/dm-7(0)		      
  [lv_mimage_0] /dev/dm-9(0)		      
  [lv_mimage_1] /dev/dm-8(0)		      
  [lv_mimage_1] /dev/dm-10(0)		      
INFO: Convert the LV to disklog.
  Logical volume lv converted.
  LV		Devices 		      
  lv		lv_mimage_0(0),lv_mimage_1(0) 
  [lv_mimage_0] /dev/dm-7(0)		      
  [lv_mimage_0] /dev/dm-9(0)		      
  [lv_mimage_1] /dev/dm-8(0)		      
  [lv_mimage_1] /dev/dm-10(0)		      
  [lv_mlog]	/dev/dm-10(24)		      
ERROR: /dev/dm-10 is used in both testvg/lv_mlog and testvg/lv_mimage_1
ERROR: /dev/dm-10 is used in both testvg/lv_mimage_1 and testvg/lv_mlog
Number of failures: 2
FAIL

Comment 13 RHEL Program Management 2007-03-10 00:57:47 UTC
This bugzilla had previously been approved for engineering
consideration but Red Hat Product Management is currently reevaluating
this issue for inclusion in RHEL4.6.

Comment 19 RHEL Program Management 2008-09-05 17:19:24 UTC
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.

Comment 21 Milan Broz 2009-03-05 13:03:37 UTC
The needed patch is still not upstream, moving the development tracking to RHEL5 bug 221891.