Bug 1511047

Summary: LVM RAID: internal error when performing take-over
Product: Red Hat Enterprise Linux 7 Reporter: Jonathan Earl Brassow <jbrassow>
Component: lvm2Assignee: Heinz Mauelshagen <heinzm>
lvm2 sub component: Mirroring and RAID QA Contact: cluster-qe <cluster-qe>
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: unspecified CC: agk, cmarthal, heinzm, jbrassow, lmiksik, msnitzer, prajnoha, prockai, zkabelac
Version: 7.3   
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: lvm2-2.02.176-4.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 15:22:16 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:

Description Jonathan Earl Brassow 2017-11-08 15:36:54 UTC
See last command for 'internal error'.  Read the rest for how I got there and other feedback.

[root@bp-01 ~]# lvcreate -L 1G -n lv vg
  Logical volume "lv" created.

# this could print clearer message
[root@bp-01 ~]# lvconvert --type striped vg/lv
  Unknown operation on striped or linear LV vg/lv.

[root@bp-01 ~]# lvconvert --type raid1 -m 1 vg/lv
Are you sure you want to convert linear LV vg/lv to raid1 with 2 images enhancing resilience? [y/n]: y
  Logical volume vg/lv successfully converted.

[root@bp-01 ~]# lvconvert --type raid5 -i 2 vg/lv
  Using default stripesize 64.00 KiB.
Are you sure you want to convert raid1 LV vg/lv to raid5 type? [y/n]: y
  Logical volume vg/lv successfully converted.

[root@bp-01 ~]# lvs -o name,segtype,copypercent vg
  LV   Type  Cpy%Sync
  lv   raid5 100.00

[root@bp-01 ~]# lvconvert --type raid0 -i 2 vg/lv
  Using default stripesize 64.00 KiB.
  Unable to convert LV vg/lv from raid5 to raid0.
  Converting vg/lv from raid5 (same as raid5_ls) is directly possible to the following layouts:
    raid5_n
    raid5_la
    raid5_ra
    raid5_rs
    raid6_ls_6
    raid1

[root@bp-01 ~]# lvconvert --type raid5_n -i 2 vg/lv
  Using default stripesize 64.00 KiB.
  Converting raid5 (same as raid5_ls) LV vg/lv to raid5_n.
Are you sure you want to convert raid5 LV vg/lv? [y/n]: y
  Logical volume vg/lv successfully converted.

[root@bp-01 ~]# lvs -o name,segtype,copypercent vg
  LV   Type    Cpy%Sync
  lv   raid5_n 100.00

# Note the internal error...
[root@bp-01 ~]# lvconvert --type raid0 -i 2 vg/lv
  Using default stripesize 64.00 KiB.
Are you sure you want to convert raid5_n LV vg/lv to raid0 type? [y/n]: y
  Internal error: Unable to remove RAID layer from segment type raid5_n.
  Failed to remove RAID layer after linear conversion.

Comment 3 Heinz Mauelshagen 2017-11-08 16:51:48 UTC
Fixed in uptsream commit 763db8aab02d7df551a3e8500d261ef6c9651bdb.

[root@vm254 ~]# lvs -aoname,size,attr,segtype,datastripes,syncpercent,reshapelen,devices,data_offset nvm
  LV           LSize   Attr       Type    #DStr Cpy%Sync RSize Devices                     DOff
  r            256.00m rwi-a-r--- raid5_n     1 100.00      0  r_rimage_0(0),r_rimage_1(0)    0
  [r_rimage_0] 256.00m iwi-aor--- linear      1             0  /dev/sda(0)                    0
  [r_rimage_1] 256.00m iwi-aor--- linear      1             0  /dev/sdb(1)                    0
  [r_rmeta_0]    1.00m ewi-aor--- linear      1                /dev/sda(256)                   
  [r_rmeta_1]    1.00m ewi-aor--- linear      1                /dev/sdb(0)                     
[root@vm254 ~]# lvconvert -y --ty raid0 nvm/r
  Using default stripesize 64.00 KiB.
  Can't convert raid5_n LV nvm/r to raid0 with < 3 legs.

Comment 4 Jonathan Earl Brassow 2017-11-14 21:01:28 UTC
confirmed:

[root@bp-01 lvm2]# lvconvert --type raid0 -i 2 vg/lv
  Using default stripesize 64.00 KiB.
Are you sure you want to convert raid5_n LV vg/lv to raid0 type? [y/n]: y
  Can't convert raid5_n LV vg/lv to raid0 with < 3 legs.

Comment 6 Corey Marthaler 2017-12-13 21:28:47 UTC
# Marking this verified in the latest rpms with two caveat RFEs to be filed as a result.

lvm2-2.02.176-5.el7    BUILT: Wed Dec  6 04:13:07 CST 2017
lvm2-libs-2.02.176-5.el7    BUILT: Wed Dec  6 04:13:07 CST 2017
lvm2-cluster-2.02.176-5.el7    BUILT: Wed Dec  6 04:13:07 CST 2017
lvm2-lockd-2.02.176-5.el7    BUILT: Wed Dec  6 04:13:07 CST 2017
lvm2-python-boom-0.8.1-5.el7    BUILT: Wed Dec  6 04:15:40 CST 2017
cmirror-2.02.176-5.el7    BUILT: Wed Dec  6 04:13:07 CST 2017
device-mapper-1.02.145-5.el7    BUILT: Wed Dec  6 04:13:07 CST 2017
device-mapper-libs-1.02.145-5.el7    BUILT: Wed Dec  6 04:13:07 CST 2017
device-mapper-event-1.02.145-5.el7    BUILT: Wed Dec  6 04:13:07 CST 2017
device-mapper-event-libs-1.02.145-5.el7    BUILT: Wed Dec  6 04:13:07 CST 2017
device-mapper-persistent-data-0.7.0-0.1.rc6.el7    BUILT: Mon Mar 27 10:15:46 CDT 2017




[root@mckinley-03 ~]# lvcreate -L 1G -n lv vg
  Logical volume "lv" created.
 
[root@mckinley-03 ~]# lvconvert --type raid1 -m 1 vg/lv
Are you sure you want to convert linear LV vg/lv to raid1 with 2 images enhancing resilience? [y/n]: y
  Logical volume vg/lv successfully converted.
 
 
# The "-i 2" in all the commands in the original report i believe was a red herring as the user really meant "--stripes 2", which in most cases would have produced a "-stripes not allowed for LV when converting", That said it doesn't always appear which should be new RFE to be fixed for all cases
[root@mckinley-03 ~]# lvconvert --type raid5 --stripes 2 vg/lv
  Using default stripesize 64.00 KiB.
  --stripes not allowed for LV vg/lv when converting from raid1 to raid5.
  Converting vg/lv from raid1 is directly possible to the following layouts:
    mirror
    raid4
    raid5_n
    raid5_la
    raid5_ls
    raid5_ra
    raid5_rs
 
[root@mckinley-03 ~]# lvconvert --type raid5 vg/lv
  Using default stripesize 64.00 KiB.
Are you sure you want to convert raid1 LV vg/lv to raid5 type? [y/n]: y
 
 Logical volume vg/lv successfully converted.
[root@mckinley-03 ~]# lvs -o name,segtype,copypercent,data_stripes vg
  LV   Type  Cpy%Sync #DStr
  lv   raid5 100.00       1
 
# Now here, one would expect the same "--stripes not allowed for LV when converting" warning like above, first RFE
[root@mckinley-03 ~]# lvconvert --type raid0 --stripes 2 vg/lv
  Using default stripesize 64.00 KiB.
  Unable to convert LV vg/lv from raid5 to raid0.
  Converting vg/lv from raid5 (same as raid5_ls) is directly possible to the following layouts:
    raid5_n
    raid5_la
    raid5_ra
    raid5_rs
    raid6_ls_6
    raid1
[root@mckinley-03 ~]# lvconvert --type raid0 vg/lv
  Using default stripesize 64.00 KiB.
  Unable to convert LV vg/lv from raid5 to raid0.
  Converting vg/lv from raid5 (same as raid5_ls) is directly possible to the following layouts:
    raid5_n
    raid5_la
    raid5_ra
    raid5_rs
    raid6_ls_6
    raid1
 
# Again, where's the "--stripes not allowed for LV when converting" warning like above
[root@mckinley-03 ~]# lvconvert --type raid5_n --stripes 2 vg/lv
  Using default stripesize 64.00 KiB.
  Invalid conversion request on vg/lv.
 
[root@mckinley-03 ~]# lvconvert --type raid5_n vg/lv
  Using default stripesize 64.00 KiB.
  Converting raid5 (same as raid5_ls) LV vg/lv to raid5_n.
Are you sure you want to convert raid5 LV vg/lv? [y/n]: y
  Logical volume vg/lv successfully converted.
 
[root@mckinley-03 ~]# lvs -o name,segtype,copypercent,data_stripes vg
  LV   Type    Cpy%Sync #DStr
  lv   raid5_n 100.00       1
 
# Here's that warning again like expected "--stripes not allowed for LV when converting"
[root@mckinley-03 ~]#  lvconvert --type raid0 --stripes 2 vg/lv
  Using default stripesize 64.00 KiB.
  --stripes not allowed for LV vg/lv when converting from raid5_n to raid0.
  WARNING: ignoring --stripes option on takeover of vg/lv (reshape afterwards).
  Converting vg/lv from raid5_n is directly possible to the following layouts:
    raid0
    raid0_meta
    striped
    raid4
    raid6_n_6
    raid5_la
    raid5_ls
    raid5_ra
    raid5_rs
    raid1
 
# Here's that warning again like expected "--stripes not allowed for LV when converting"
[root@mckinley-03 ~]#  lvconvert --type raid0 --stripes 20 vg/lv
  Using default stripesize 64.00 KiB.
  --stripes not allowed for LV vg/lv when converting from raid5_n to raid0.
  WARNING: ignoring --stripes option on takeover of vg/lv (reshape afterwards).
  Converting vg/lv from raid5_n is directly possible to the following layouts:
    raid0
    raid0_meta
    striped
    raid4
    raid6_n_6
    raid5_la
    raid5_ls
    raid5_ra
    raid5_rs
    raid1
 
# Now, w/o the stripes flag, we see the fix to this bug, *however* why don't we see a "Convert raid5_n LV vg/lv to minimum N stripes first (i.e. --stripes N-1)." message like all other attempts? second RFE
[root@mckinley-03 ~]#  lvconvert --type raid0 vg/lv
  Using default stripesize 64.00 KiB.
Are you sure you want to convert raid5_n LV vg/lv to raid0 type? [y/n]: y
  Can't convert raid5_n LV vg/lv to raid0 with < 3 legs.
 
# These other attempts don't first ask "Are you sure you want to..." before failing, they mention you need to bump up the number of stripes first.
[root@mckinley-03 ~]#  lvconvert --type raid6 vg/lv
  Using default stripesize 64.00 KiB.
  Convert raid5_n LV vg/lv to minimum 4 stripes first (i.e. --stripes 3).
  Converting vg/lv from raid5_n is directly possible to the following layouts:
    raid0
    raid0_meta
    striped
    raid4
    raid6_n_6
    raid5_la
    raid5_ls
    raid5_ra
    raid5_rs
    raid1
[root@mckinley-03 ~]#  lvconvert --type raid10 vg/lv
  Using default stripesize 64.00 KiB.
  Convert raid5_n LV vg/lv to minimum 3 stripes first (i.e. --stripes 2).
  Converting vg/lv from raid5_n is directly possible to the following layouts:
    raid0
    raid0_meta
    striped
    raid4
    raid6_n_6
    raid5_la
    raid5_ls
    raid5_ra
    raid5_rs
    raid1

Comment 9 errata-xmlrpc 2018-04-10 15:22:16 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.

https://access.redhat.com/errata/RHEA-2018:0853