Bug 1064592

Summary: [RFE] LVM RAID: Allow device specification when performing 'lvconvert --repair'
Product: [Community] LVM and device-mapper Reporter: Jonathan Earl Brassow <jbrassow>
Component: lvm2Assignee: Heinz Mauelshagen <heinzm>
lvm2 sub component: Mirroring and RAID QA Contact: cluster-qe <cluster-qe>
Status: CLOSED UPSTREAM Docs Contact:
Severity: unspecified    
Priority: unspecified CC: agk, cbuissar, heinzm, jbrassow, jcastillo, msnitzer, prajnoha, zkabelac
Version: 2.02.163Flags: heinzm: lvm-technical-solution+
rule-engine: lvm-test-coverage?
Target Milestone: Fedora   
Target Release: 2016-09   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: v2_02_163 Doc Type: Enhancement
Doc Text:
Feature: Allow rebuild device specification with "lvchange --rebuild PV LV" Reason: Result:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-06-10 12:42:22 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 2014-02-12 23:00:52 UTC
Currently it is possible to perform "scrubbing" operations on LVM RAID logical volumes.  If there is a discrepancy found (e.g. a bad parity calculation or non-identical blocks in RAID1), the RAID LV can be made coherent again by performing a 'repair' operation.

The trouble is that the repair operation cannot be directed toward any specific device.  Instead, parity is simply recalculated and mirrors are simply recopied from the lowest indexed source.  If the user somehow knows the device that gone bad.  It should be possible to direct LVM to repair only that device.

The proposed solution is to augment the '--syncaction repair' arguments to take a device name as well, something like: '--syncaction repair:<PV>'.

Alternatively, a command that would allow us to reset the bitmap for a particular device would also work - causing the reconstruction of just that particular device in the array, something like: '--rebuild <PV>'.

For now, a workaround exists.  You can rebuild/resync a particular device in the array by replacing it: 'lvconvert --replace <PV-to-remove> vg/lv'.  This requires a spare device, however.

Comment 6 Heinz Mauelshagen 2016-08-04 14:53:11 UTC
"lvchange --rebuild PV VG/LV" would avoid a kernel change we'd need to support this via "lvchange --syncaction repair PV VG/LV", because the former can pass in the respective rebuild flag via the constructor (already supported and used in repair/replace) but the latter would need a raid target message interface enhancement.

Another tradeoff of the latter is that it doesn't restart after a crahs or a mapping refresh but the former does.

In essence "lvchange --rebuild PV [--rebuild PV...] VG/LV" is a repair/replace without allocation just passing in the rebuild flags intio the kernel.

Comment 7 Heinz Mauelshagen 2016-08-04 17:02:53 UTC
Got POC implementation in testing.

Comment 8 Heinz Mauelshagen 2016-08-05 14:02:18 UTC
Tested solution and pushed upstream.