Bug 848599

Summary: up converting an inactive mirror with insufficient devs results in an over concerned warning
Product: Red Hat Enterprise Linux 6 Reporter: Corey Marthaler <cmarthal>
Component: lvm2Assignee: Jonathan Earl Brassow <jbrassow>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: low Docs Contact:
Priority: low    
Version: 6.3CC: agk, dwysocha, heinzm, jbrassow, lnovich, msnitzer, prajnoha, prockai, slevine, thornber, zkabelac
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: lvm2-2.02.100-1.el6 Doc Type: Bug Fix
Doc Text:
no doc text required
Story Points: ---
Clone Of: 773312 Environment:
Last Closed: 2013-11-21 23:17:33 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: 773312    
Bug Blocks: 807971    

Description Corey Marthaler 2012-08-15 22:56:25 UTC
+++ This bug was initially created as a clone of Bug #773312 +++

Description of problem:
This appears to be a remaining case left over from bug 582251 and similar to bug 601383. Note that the device being used in the upconvert is already in the mirror.

SCENARIO - [inactive_insufficient_upconvert_attempt]
Create a mirror, deactivate it, and then attempt an up convert w/o sufficient space
grant-01: lvcreate -m 1 -n insufficient_inactive_upconvert -L 500M mirror_sanity
Waiting until all mirrors become fully syncd...
   1/1 mirror(s) are fully synced: ( 100.00% )

Deactivate mirror
Attempt to add an additional leg, but w/o sufficient space
grant-01: lvconvert -m+1 mirror_sanity/insufficient_inactive_upconvert /dev/sdc1

[root@grant-01 ~]# lvs -a -o +devices
  LV                                         Attr   LSize   Log                                  Copy%  Devices
  insufficient_inactive_upconvert            mwi--- 500.00M insufficient_inactive_upconvert_mlog        insufficient_inactive_upconvert_mimage_0(0),insufficient_inactive_upconvert_mimage_1(0)
  [insufficient_inactive_upconvert_mimage_0] Iwi--- 500.00M                                             /dev/sdc1(0)
  [insufficient_inactive_upconvert_mimage_1] Iwi--- 500.00M                                             /dev/sdc2(0)
  [insufficient_inactive_upconvert_mlog]     lwi---   4.00M                                             /dev/sdb6(0)

[root@grant-01 ~]# lvconvert -m+1 mirror_sanity/insufficient_inactive_upconvert /dev/sdc1
  Insufficient suitable allocatable extents for logical volume : 125 more required
  Unable to allocate extents for mirror(s).
  ABORTING: Failed to remove temporary mirror layer insufficient_inactive_upconvert_mimagetmp_2.
  Manual cleanup with vgcfgrestore and dmsetup may be required.


Version-Release number of selected component (if applicable):
2.6.18-301.el5

lvm2-2.02.88-5.el5    BUILT: Fri Dec  2 12:25:45 CST 2011
lvm2-cluster-2.02.88-5.el5    BUILT: Fri Dec  2 12:48:37 CST 2011
device-mapper-1.02.67-2.el5    BUILT: Mon Oct 17 08:31:56 CDT 2011
device-mapper-event-1.02.67-2.el5    BUILT: Mon Oct 17 08:31:56 CDT 2011
cmirror-1.1.39-14.el5    BUILT: Wed Nov  2 17:25:33 CDT 2011
kmod-cmirror-0.1.22-3.el5    BUILT: Tue Dec 22 13:39:47 CST 2009


How reproducible:
Everytime

--- Additional comment from pm-rhel on 2012-04-02 06:35:13 EDT ---

This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.

Comment 1 Corey Marthaler 2012-08-15 22:58:25 UTC
Exists in rhel6.3 as well.

./mirror_sanity -l /home/msp/cmarthal/work/sts/sts-root -r /usr/tests/sts-rhel6.3 -o taft-01 -e inactive_insufficient_upconvert_attempt

SCENARIO - [inactive_insufficient_upconvert_attempt]
Create a mirror, deactivate it, and then attempt an up convert w/o sufficient space
taft-01: lvcreate -m 1 -n insufficient_inactive_upconvert -L 500M mirror_sanity
Waiting until all mirror|raid volumes become fully syncd...
   0/1 mirror(s) are fully synced: ( 44.30% )
   0/1 mirror(s) are fully synced: ( 72.20% )
   1/1 mirror(s) are fully synced: ( 100.00% )

Deactivate mirror
Attempt to add an additional leg, but w/o sufficient space
taft-01: lvconvert -m+1 mirror_sanity/insufficient_inactive_upconvert /dev/sdd1

Insufficient suitable allocatable extents for logical volume : 125 more required
   Unable to allocate extents for mirror(s).
   ABORTING: Failed to remove temporary mirror layer insufficient_inactive_upconvert_mimagetmp_2.
   Manual cleanup with vgcfgrestore and dmsetup may be required.


2.6.32-279.el6.x86_64

lvm2-2.02.95-10.el6    BUILT: Fri May 18 03:26:00 CDT 2012
lvm2-libs-2.02.95-10.el6    BUILT: Fri May 18 03:26:00 CDT 2012
lvm2-cluster-2.02.95-10.el6    BUILT: Fri May 18 03:26:00 CDT 2012
udev-147-2.41.el6    BUILT: Thu Mar  1 13:01:08 CST 2012
device-mapper-1.02.74-10.el6    BUILT: Fri May 18 03:26:00 CDT 2012
device-mapper-libs-1.02.74-10.el6    BUILT: Fri May 18 03:26:00 CDT 2012
device-mapper-event-1.02.74-10.el6    BUILT: Fri May 18 03:26:00 CDT 2012
device-mapper-event-libs-1.02.74-10.el6    BUILT: Fri May 18 03:26:00 CDT 2012
cmirror-2.02.95-10.el6    BUILT: Fri May 18 03:26:00 CDT 2012

Comment 4 Jonathan Earl Brassow 2013-05-09 18:41:54 UTC
This has been fixed upstream in the following commit:
commit cbcbb677313aa8a4116bcfd13ceccef05fb1f9a9
Author: Jonathan Brassow <jbrassow>
Date:   Wed Apr 10 16:47:04 2013 -0500

    mirror:  Fix overly-concerning warning on mirror up-convert failure.
    
    Attempting to up-convert an inactive mirror when there is insufficient
    space leads to the following message:
      Unable to allocate extents for mirror(s).
      ABORTING: Failed to remove temporary mirror layer inactive_mimagetmp_3.
      Manual cleanup with vgcfgrestore and dmsetup may be required.
    This is caused by a failure to execute the 'deactivate_lv' function in
    the error condition.  The deactivate returns an error because the LV is
    already inactive.  This patch checks if the LV is activate and calls
    deactivate_lv only if it is.  This allows the error cleanup code to work
    properly in this condition.
    
    It wasn't that big of a deal anyway, since there was no previous vg_commit
    that needed to be reverted.  IOW, no harm was done if the allocation failed.
    The message was scary and useless.

UNIT TEST:
[root@bp-01 lvm2]# vgs vg
  VG   #PV #LV #SN Attr   VSize VFree
  vg     7   2   0 wz--n- 5.72t 5.71t
[root@bp-01 lvm2]# lvs --segments vg
  LV     VG   Attr      #Str Type   SSize  
  lv     vg   rwi-a-r--    2 raid1    1.00g
  mirror vg   mwi---m--    7 mirror 500.00m
[root@bp-01 lvm2]# lvconvert -m +1 vg/mirror
  Insufficient suitable allocatable extents for logical volume : 125 more required
  Unable to allocate extents for mirror(s).

This patch was also used in bug 773312:
https://bugzilla.redhat.com/show_bug.cgi?id=773312#c5

Comment 9 Steven J. Levine 2013-07-19 21:01:46 UTC
This does not seem to require an update to the LVM manual so I'm marking it as docs_scoped-.

Comment 11 Corey Marthaler 2013-09-30 13:33:27 UTC
Fix verified.

2.6.32-410.el6.x86_64
lvm2-2.02.100-4.el6    BUILT: Fri Sep 27 09:05:32 CDT 2013
lvm2-libs-2.02.100-4.el6    BUILT: Fri Sep 27 09:05:32 CDT 2013
lvm2-cluster-2.02.100-4.el6    BUILT: Fri Sep 27 09:05:32 CDT 2013
udev-147-2.48.el6    BUILT: Fri Aug  9 06:09:50 CDT 2013
device-mapper-1.02.79-4.el6    BUILT: Fri Sep 27 09:05:32 CDT 2013
device-mapper-libs-1.02.79-4.el6    BUILT: Fri Sep 27 09:05:32 CDT 2013
device-mapper-event-1.02.79-4.el6    BUILT: Fri Sep 27 09:05:32 CDT 2013
device-mapper-event-libs-1.02.79-4.el6    BUILT: Fri Sep 27 09:05:32 CDT 2013


[root@taft-01 ~]# lvs -a -o +devices
 LV                                         Attr       LSize   Log                                  Devices
 insufficient_inactive_upconvert            mwi---m--- 500.00m insufficient_inactive_upconvert_mlog insufficient_inactive_upconvert_mimage_0(0),insufficient_inactive_upconvert_mimage_1(0)
 [insufficient_inactive_upconvert_mimage_0] Iwi---m--- 500.00m                                      /dev/sdc2(0)
 [insufficient_inactive_upconvert_mimage_1] Iwi---m--- 500.00m                                      /dev/sdc1(0)
 [insufficient_inactive_upconvert_mlog]     lwi---m---   4.00m                                      /dev/sde1(0)

[root@taft-01 ~]# lvconvert -m+1 mirror_sanity/insufficient_inactive_upconvert /dev/sdc2
  Insufficient suitable allocatable extents for logical volume : 125 more required
  Unable to allocate extents for mirror(s).

Comment 12 errata-xmlrpc 2013-11-21 23:17:33 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