Bug 1045625

Summary: lvconvert validation is missing when same LV name is used for thinpool and originname
Product: Red Hat Enterprise Linux 7 Reporter: Corey Marthaler <cmarthal>
Component: lvm2Assignee: LVM and device-mapper development team <lvm-team>
lvm2 sub component: Default / Unclassified QA Contact: cluster-qe <cluster-qe>
Status: CLOSED CURRENTRELEASE Docs Contact:
Severity: high    
Priority: unspecified CC: agk, bmarzins, bmr, dwysocha, heinzm, jbrassow, jonathan, lvm-team, msnitzer, prajnoha, prockai, thornber, zkabelac
Version: 7.0   
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: lvm2-2.02.105-3.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1020413
: 1153306 (view as bug list) Environment:
Last Closed: 2014-06-13 09:53:02 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: 1020413    
Bug Blocks: 1153306    

Description Corey Marthaler 2013-12-20 21:21:37 UTC
Cloning this so it's tracked in rhel7 as well.

[root@harding-02 ~]# lvcreate -L1G -n lvol1 snapper_thinp
  Logical volume "lvol1" created

[root@harding-02 ~]# lvs -a -o +devices
  LV    VG              Attr       LSize  Pool Data%  Devices         
  lvol1 snapper_thinp   -wi-a-----  1.00g             /dev/sdb1(0)    

[root@harding-02 ~]# lvconvert --thinpool snapper_thinp/lvol1  --originname ext  -T snapper_thinp/lvol1
  Logical volume "lvol1_tmeta" created
  Logical volume "lvol2" created
  Converted snapper_thinp/lvol1 to thin pool.
  Logical volume "ext" created
  Cannot rename internal LV "lvol1_tdata".
  Internal error: Referenced LV lvol1_tdata not listed in VG snapper_thinp.
  Manual intervention may be required to remove abandoned LV(s) before retrying.

[root@harding-02 ~]# lvs -a -o +devices
  LV              VG              Attr       LSize  Pool  Data%  Devices
  ext             snapper_thinp   Vri---tz--  1.00g lvol1
  lvol1           snapper_thinp   twi-a-tz--  1.00g        0.00  lvol1_tdata(0)
  [lvol1_tdata]   snapper_thinp   Twi-ao----  1.00g              /dev/sdb1(0)
  [lvol1_tmeta]   snapper_thinp   ewi-ao----  4.00m              /dev/sdb1(256)
  [lvol2_pmspare] snapper_thinp   ewi-------  4.00m              /dev/sdb1(257)


3.10.0-54.0.1.el7.x86_64
lvm2-2.02.103-6.el7    BUILT: Wed Nov 27 02:28:25 CST 2013
lvm2-libs-2.02.103-6.el7    BUILT: Wed Nov 27 02:28:25 CST 2013
lvm2-cluster-2.02.103-6.el7    BUILT: Wed Nov 27 02:28:25 CST 2013
device-mapper-1.02.82-6.el7    BUILT: Wed Nov 27 02:28:25 CST 2013
device-mapper-libs-1.02.82-6.el7    BUILT: Wed Nov 27 02:28:25 CST 2013
device-mapper-event-1.02.82-6.el7    BUILT: Wed Nov 27 02:28:25 CST 2013
device-mapper-event-libs-1.02.82-6.el7    BUILT: Wed Nov 27 02:28:25 CST 2013
device-mapper-persistent-data-0.2.8-2.el7    BUILT: Wed Oct 30 10:20:48 CDT 2013
cmirror-2.02.103-6.el7    BUILT: Wed Nov 27 02:28:25 CST 2013





+++ This bug was initially created as a clone of Bug #1020413 +++

Description of problem:

Conversion command to convert LV into a thin LV and making the given LV to be an  external origin for this LV is missing validation:

lvconvert --thinpool mvg/lvol1  --originname ext  -T mvg/lvol1

Command aborts too late, when some part of conversion already changed lvm2 metadata and change the table line.

  Logical volume "lvol1_tmeta" created
  Converted mvg/lvol1 to thin pool.
  Logical volume "ext" created
  Cannot rename internal LV "lvol1_tdata".
  Internal error: Referenced LV lvol1_tdata not listed in VG mvg.

As a consequence if the user wanted to convert lvol1 just to some real pool - he now already lost lvol1 (and has to use immediately deactive pool and vgcfgrestore lvm2 metadata).


Version-Release number of selected component (if applicable):
2.02.102

How reproducible:


Steps to Reproduce:
1. lvcreate -L10 -n lvol1
2. lvconvert --thinpool mvg/lvol1  --originname ext  -T mvg/lvol1
3.

Actual results:


Expected results:
Report incorrect parameters being passed in.

Additional info:

Comment 2 Corey Marthaler 2014-01-24 23:10:40 UTC
Still exists in the latest rpms.

[root@host-050 ~]# lvconvert --thinpool snapper_thinp/lvol1  --originname ext  -T snapper_thinp/lvol1
  Logical volume "lvol1_tmeta" created
  Logical volume "lvol2" created
  Converted snapper_thinp/lvol1 to thin pool.
  Logical volume "ext" created
  Cannot rename internal LV "lvol1_tdata".
  Internal error: Referenced LV lvol1_tdata not listed in VG snapper_thinp.
  Manual intervention may be required to remove abandoned LV(s) before retrying.

lvm2-2.02.105-1.el7    BUILT: Wed Jan 22 07:34:15 CST 2014
lvm2-libs-2.02.105-1.el7    BUILT: Wed Jan 22 07:34:15 CST 2014
lvm2-cluster-2.02.105-1.el7    BUILT: Wed Jan 22 07:34:15 CST 2014
device-mapper-1.02.84-1.el7    BUILT: Wed Jan 22 07:34:15 CST 2014
device-mapper-libs-1.02.84-1.el7    BUILT: Wed Jan 22 07:34:15 CST 2014
device-mapper-event-1.02.84-1.el7    BUILT: Wed Jan 22 07:34:15 CST 2014
device-mapper-event-libs-1.02.84-1.el7    BUILT: Wed Jan 22 07:34:15 CST 2014
device-mapper-persistent-data-0.2.8-3.el7    BUILT: Fri Dec 27 13:40:56 CST 2013
cmirror-2.02.105-1.el7    BUILT: Wed Jan 22 07:34:15 CST 2014

Comment 3 Zdenek Kabelac 2014-01-28 12:39:42 UTC
Upstream commit adds more validation to lvconvert to cover this case:

https://www.redhat.com/archives/lvm-devel/2014-January/msg00064.html

Comment 5 Corey Marthaler 2014-02-05 23:16:41 UTC
Fix verified in the latest rpms.

[root@host-003 ~]# lvconvert --thinpool snapper_thinp/origin6 --originname extorigin6 -T snapper_thinp/origin6
  Can't use same LV snapper_thinp/origin6 for thin pool and thin volume.

3.10.0-80.el7.x86_64
lvm2-2.02.105-3.el7    BUILT: Wed Feb  5 06:36:34 CST 2014
lvm2-libs-2.02.105-3.el7    BUILT: Wed Feb  5 06:36:34 CST 2014
lvm2-cluster-2.02.105-3.el7    BUILT: Wed Feb  5 06:36:34 CST 2014
device-mapper-1.02.84-3.el7    BUILT: Wed Feb  5 06:36:34 CST 2014
device-mapper-libs-1.02.84-3.el7    BUILT: Wed Feb  5 06:36:34 CST 2014
device-mapper-event-1.02.84-3.el7    BUILT: Wed Feb  5 06:36:34 CST 2014
device-mapper-event-libs-1.02.84-3.el7    BUILT: Wed Feb  5 06:36:34 CST 2014
device-mapper-persistent-data-0.2.8-3.el7    BUILT: Fri Dec 27 13:40:56 CST 2013
cmirror-2.02.105-3.el7    BUILT: Wed Feb  5 06:36:34 CST 2014

Comment 6 Ludek Smid 2014-06-13 09:53:02 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.