Skip to contentSkip to conversation

master - RAID: Make 'vgreduce --removemissing' work with RAID LVs

PATCH Jonathan Brassow 1 participant 1 message Feb 21, 2013

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=845852d6b4b486075f3ed866890f79b278a990ce
Commit:        845852d6b4b486075f3ed866890f79b278a990ce
Parent:        0e4ffd9d3b9cc8bf88662e3a0d023602360c6993
Author:        Jonathan Brassow <[email protected]>
AuthorDate:    Wed Feb 20 14:52:46 2013 -0600
Committer:     Jonathan Brassow <[email protected]>
CommitterDate: Wed Feb 20 14:52:46 2013 -0600

RAID: Make 'vgreduce --removemissing' work with RAID LVs

Currently it is impossible to remove a failed PV which has a RAID LV on it. This patch fixes the issue by replacing the failed PV with an 'error' segment within the affected sub-LVs. Once there is no longer a RAID LV using the PV, it can be removed.

Most often, it is better to replace a failed RAID device with a spare. (You can use 'lvconvert --repair <vg>/<LV>' to accomplish that.) However, if there are no spares in the volume group and none will be added, it is useful to be able to removed the failed device.

Following patches address the ability to perform 'lvconvert' operations on RAID LVs that contain sub-LVs composed of 'error' segments.

---
 WHATS_NEW                        |    1 +
 lib/metadata/metadata-exported.h |    1 +
 lib/metadata/raid_manip.c        |   64 ++++++++++++++++++++++++++++++++++++++
 tools/vgreduce.c                 |    6 +++
 4 files changed, 72 insertions(+), 0 deletions(-)
WHATS_NEW +1 -0
index f827508..d237386 100644
@@ -1,5 +1,6 @@
 Version 2.02.99 - 
 ===================================
+  Make 'vgreduce --removemissing' able to handle RAID LVs with missing PVs.
   Rename lvm.conf setting 'mirror_region_size' to 'raid_region_size'.
   Fix pvs -o pv_free reporting for PVs with zero PE count.
   Fix missing cleanup of flags when the LV is detached from pool.
lib/metadata/metadata-exported.h +1 -0
index 406491c..890aa18 100644
@@ -808,6 +808,7 @@ int lv_raid_reshape(struct logical_volume *lv,
 		    const struct segment_type *new_segtype);
 int lv_raid_replace(struct logical_volume *lv, struct dm_list *remove_pvs,
 		    struct dm_list *allocate_pvs);
+int lv_raid_remove_missing(struct logical_volume *lv);
 
 /* --  metadata/raid_manip.c */
 
lib/metadata/raid_manip.c +64 -0

67 lines not on this page · raw message

tools/vgreduce.c +6 -0
index 1b04a49..c068b26 100644
@@ -89,6 +89,12 @@ static int _make_vg_consistent(struct cmd_context *cmd, struct volume_group *vg)
 
 		/* Are any segments of this LV on missing PVs? */
 		if (lv->status & PARTIAL_LV) {
+			if (seg_is_raid(first_seg(lv))) {
+				if (!lv_raid_remove_missing(lv))
+					return_0;
+				goto restart;
+			}
+
 			if (lv->status & MIRRORED) {
 				if (!mirror_remove_missing(cmd, lv, 1))
 					return_0;