Bug 1300455

Summary: [RFE] allow pvmove to act on a pv tag or tags
Product: Red Hat Enterprise Linux 7 Reporter: Corey Marthaler <cmarthal>
Component: lvm2Assignee: David Teigland <teigland>
lvm2 sub component: Command-line tools QA Contact: cluster-qe <cluster-qe>
Status: CLOSED WONTFIX Docs Contact:
Severity: low    
Priority: unspecified CC: agk, heinzm, jbrassow, msnitzer, prajnoha, thornber, zkabelac
Version: 7.2Keywords: FutureFeature
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-09-09 15:12:17 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 2016-01-20 21:27:08 UTC
Description of problem:
[root@host-073 ~]# vgcreate VG /dev/sd[abcd]1
  Physical volume "/dev/sda1" successfully created
  Physical volume "/dev/sdc1" successfully created
  Physical volume "/dev/sdd1" successfully created
  Volume group "VG" successfully created

[root@host-073 ~]# pvchange --addtag FOO /dev/sda1
  Physical volume "/dev/sda1" changed
  1 physical volume changed / 0 physical volumes not changed
[root@host-073 ~]# pvchange --addtag BAR /dev/sdb1
  Physical volume "/dev/sdb1" changed
  1 physical volume changed / 0 physical volumes not changed

[root@host-073 ~]# pvs -a -o +pv_tags | grep VG
  PV                      VG            Fmt  Attr PSize  PFree  PV Tags
  /dev/sda1               VG            lvm2 a--  24.99g 24.99g FOO    
  /dev/sdb1               VG            lvm2 a--  24.99g 24.99g BAR    
  /dev/sdc1               VG            lvm2 a--  24.99g 24.99g        
  /dev/sdd1               VG            lvm2 a--  24.99g 24.99g        

[root@host-073 ~]# pvmove @FOO
  Physical volume @FOO not found
  Run `pvmove --help' for more information.

[root@host-073 ~]# pvmove /dev/sda1
  No data to move for VG


Version-Release number of selected component (if applicable):
3.10.0-327.4.4.el7.x86_64

lvm2-2.02.130-5.el7    BUILT: Wed Oct 14 08:27:29 CDT 2015
lvm2-libs-2.02.130-5.el7    BUILT: Wed Oct 14 08:27:29 CDT 2015
lvm2-cluster-2.02.130-5.el7    BUILT: Wed Oct 14 08:27:29 CDT 2015
device-mapper-1.02.107-5.el7    BUILT: Wed Oct 14 08:27:29 CDT 2015
device-mapper-libs-1.02.107-5.el7    BUILT: Wed Oct 14 08:27:29 CDT 2015
device-mapper-event-1.02.107-5.el7    BUILT: Wed Oct 14 08:27:29 CDT 2015
device-mapper-event-libs-1.02.107-5.el7    BUILT: Wed Oct 14 08:27:29 CDT 2015
device-mapper-persistent-data-0.5.5-1.el7    BUILT: Thu Aug 13 09:58:10 CDT 2015
cmirror-2.02.130-5.el7    BUILT: Wed Oct 14 08:27:29 CDT 2015

Comment 2 Peter Rajnoha 2016-06-03 13:53:29 UTC
pvmove now uses process_each_pv logic (since lvm2 v2.02.141) inside and as such, it recognizes PV tags now. So this scenario now works:

# vgcreate vg /dev/sda /dev/sdb
  Physical volume "/dev/sda" successfully created.
  Physical volume "/dev/sdb" successfully created.
  Volume group "vg" successfully created

# pvchange --addtag mytag /dev/sda
  Physical volume "/dev/sda" changed
  1 physical volume changed / 0 physical volumes not changed

# lvcreate -L100m vg /dev/sda
  Logical volume "lvol0" created.

# pvmove @mytag
  @mytag: Moved: 24.00%
  @mytag: Moved: 100.00%

Comment 3 Peter Rajnoha 2016-06-03 14:23:06 UTC
However, there are still issues in certain situations (I've filed that as upstream bug #1342564).

Comment 4 Peter Rajnoha 2016-06-06 11:02:40 UTC
Use of tags together with pvmove is disabled for now until we find complete solution for how this should work when a tag encompasses several devices.
I'm moving this back from POST.

https://git.fedorahosted.org/cgit/lvm2.git/commit/?id=b321d2b1b9a3b6a1f8d67888a04c7318aa3148c2