Bug 1777010

Summary: attempting to vgsplit PV found in writecache _wcorig internal volume should give proper error
Product: Red Hat Enterprise Linux 8 Reporter: Corey Marthaler <cmarthal>
Component: lvm2Assignee: David Teigland <teigland>
lvm2 sub component: Cache Logical Volumes QA Contact: cluster-qe <cluster-qe>
Status: CLOSED ERRATA Docs Contact:
Severity: low    
Priority: unspecified CC: agk, heinzm, jbrassow, jhrdlica, mcsontos, msnitzer, pasik, prajnoha, zkabelac
Version: 8.2Flags: pm-rhel: mirror+
Target Milestone: rc   
Target Release: 8.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: lvm2-2.03.08-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-28 16:58:59 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 Corey Marthaler 2019-11-26 17:43:19 UTC
Description of problem:

[root@hayes-02 ~]# lvconvert --yes --type writecache --cachevol seven/wpool seven/worigin
  Logical volume seven/worigin now has write cache.

[root@hayes-02 ~]# lvs -a -o +devices
  LV               VG    Attr       LSize   Pool         Origin           Data%  Meta%  Move Log Cpy%Sync Convert Devices          
  worigin          seven Cwi---C---   1.00g [wpool_cvol] [worigin_wcorig]                                         worigin_wcorig(0)
  [worigin_wcorig] seven owi---C---   1.00g                                                                       /dev/sdh1(0)     
  [wpool_cvol]     seven Cwi---C--- 200.00m                                                                       /dev/sdg1(0)     
[root@hayes-02 ~]# lvchange -ay seven


# check that no active volumes can be split
[root@hayes-02 ~]# vgsplit --config devices/scan_lvs=1 seven ten /dev/sdh1 /dev/sdg1
  Logical volume seven/worigin must be inactive.
[root@hayes-02 ~]# lvchange -an seven


# check that _cvol PV can't be split w/o the _wcorig
[root@hayes-02 ~]# vgsplit --config devices/scan_lvs=1 seven ten /dev/sdg1
  Can't split LV worigin between two Volume Groups

# same check as above but reversed (this should provide the same error as above
[root@hayes-02 ~]# vgsplit --config devices/scan_lvs=1 seven ten /dev/sdh1
  Unknown logical volume wpool_cvol specified for writecache in segment segment1 of logical volume worigin.
  Couldn't read all logical volumes for volume group ten.

# check that it can be done if both PVs are provided
[root@hayes-02 ~]# vgsplit --config devices/scan_lvs=1 seven ten /dev/sdg1 /dev/sdh1
  New volume group "ten" successfully split from "seven"

[root@hayes-02 ~]# lvs -a -o +devices
  LV               VG  Attr       LSize   Pool         Origin           Data%  Meta%  Move Log Cpy%Sync Convert Devices          
  worigin          ten Cwi---C---   1.00g [wpool_cvol] [worigin_wcorig]                                         worigin_wcorig(0)
  [worigin_wcorig] ten owi---C---   1.00g                                                                       /dev/sdh1(0)     
  [wpool_cvol]     ten Cwi---C--- 200.00m                                                                       /dev/sdg1(0)     


Version-Release number of selected component (if applicable):
kernel-4.18.0-151.el8    BUILT: Fri Nov 15 13:14:53 CST 2019
lvm2-2.03.06-0.2.el8    BUILT: Mon Nov 18 06:39:12 CST 2019
lvm2-libs-2.03.06-0.2.el8    BUILT: Mon Nov 18 06:39:12 CST 2019
lvm2-dbusd-2.03.06-0.2.el8    BUILT: Mon Nov 18 06:39:12 CST 2019
lvm2-lockd-2.03.06-0.2.el8    BUILT: Mon Nov 18 06:39:12 CST 2019
boom-boot-1.0-0.2.20190610git246b116.el8    BUILT: Mon Jun 10 08:22:40 CDT 2019
device-mapper-1.02.165-0.2.el8    BUILT: Mon Nov 18 06:39:12 CST 2019
device-mapper-libs-1.02.165-0.2.el8    BUILT: Mon Nov 18 06:39:12 CST 2019
device-mapper-event-1.02.165-0.2.el8    BUILT: Mon Nov 18 06:39:12 CST 2019
device-mapper-event-libs-1.02.165-0.2.el8    BUILT: Mon Nov 18 06:39:12 CST 2019
device-mapper-persistent-data-0.8.5-2.el8    BUILT: Wed Jun  5 10:28:04 CDT 2019

Comment 1 David Teigland 2020-02-03 21:41:17 UTC
fixed in master
https://sourceware.org/git/?p=lvm2.git;a=commit;h=379a7e1288a5e7a15cd2872c074b219992575b4d

# lvs -a foo -o+devices
  LV            VG  Attr       LSize  Pool        Origin        Data%  Meta%  Move Log Cpy%Sync Convert Devices       
  [fast_cvol]   foo Cwi---C--- 32.00m                                                                   /dev/sdg(0)   
  main          foo Cwi---C--- 64.00m [fast_cvol] [main_wcorig]                                         main_wcorig(0)
  [main_wcorig] foo owi---C--- 64.00m                                                                   /dev/sde(0)   

# vgsplit foo foo2 /dev/sdg
  Can't split LV main between two Volume Groups

# vgsplit foo foo2 /dev/sde
  Cannot split cache origin foo2/main_wcorig and its cachevol foo/fast_cvol into separate VGs.

# vgsplit foo foo2 /dev/sde /dev/sdg
  New volume group "foo2" successfully split from "foo"

Comment 2 Marian Csontos 2020-02-24 16:18:56 UTC
Corey, could you ack please?

Comment 5 Juraj Hrdlica 2020-03-06 15:26:54 UTC
Verified with latest RPMs
 
lvm2-2.03.08-2.el8.x86_64

# lvs vg -a -o+devices
  LV            VG Attr       LSize   Pool        Origin        Data%  Meta%  Move Log Cpy%Sync Convert Devices       
  main          vg Cwi---C--- 300.00m [pool_cvol] [main_wcorig]                                         main_wcorig(0)
  [main_wcorig] vg owi---C--- 300.00m                                                                   /dev/sdc(0)
  [pool_cvol]   vg Cwi---C--- 200.00m                                                                   /dev/sdd(0)

# vgsplit vg newvg /dev/sdc 
  Can't split LV main between two Volume Groups

# vgsplit vg newvg /dev/sdd
  Can't split LV main between two Volume Groups

# vgsplit vg newvg /dev/sdd /dev/sdc
  New volume group "newvg" successfully split from "vg"

Comment 7 errata-xmlrpc 2020-04-28 16:58:59 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-2020:1881