Skip to contentSkip to conversation

master - raid: Allow repair to reuse PVs from same image that suffered a PV failure

PATCH Jonathan Brassow 1 participant 1 message Jun 26, 2014

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ed3c2537b82be4e326a53c7e3e6d5eccdd833800
Commit:        ed3c2537b82be4e326a53c7e3e6d5eccdd833800
Parent:        7028fd31a0f2d2234ffdd1b94ea6ae6128ca9362
Author:        Jonathan Brassow <[email protected]>
AuthorDate:    Wed Jun 25 22:26:06 2014 -0500
Committer:     Jonathan Brassow <[email protected]>
CommitterDate: Wed Jun 25 22:26:06 2014 -0500

raid: Allow repair to reuse PVs from same image that suffered a PV failure

When repairing RAID LVs that have multiple PVs per image, allow replacement images to be reallocated from the PVs that have not failed in the image if there is sufficient space.

This allows for scenarios where a 2-way RAID1 is spread across 4 PVs, where each image lives on two PVs but doesn't use the entire space on any of them. If one PV fails and there is sufficient space on the remaining PV in the image, the image can be reallocated on just the remaining PV.

---
 WHATS_NEW                               |    1 +
 lib/metadata/raid_manip.c               |  127 ++++++++++++++++++++++++++++---
 test/shell/lvconvert-raid-allocation.sh |   20 ++++-
 3 files changed, 133 insertions(+), 15 deletions(-)
WHATS_NEW +1 -0
index 05b3c7c..396dd07 100644
@@ -1,5 +1,6 @@
 Version 2.02.108 -
 =================================
+  Allow RAID repair to reuse PVs from same image that suffered a failure.
   New RAID images now avoid allocation on any PVs in the same parent RAID LV.
   Always reevaluate filters just before creating PV.
 
lib/metadata/raid_manip.c +115 -12

161 lines not on this page · raw message

test/shell/lvconvert-raid-allocation.sh +17 -3
index 804317b..aef786c 100644
@@ -27,7 +27,8 @@ lvconvert -m 0 $vg/$lv1
 # lvconvert --type raid1 -m 1 --alloc anywhere $vg/$lv1 "$dev1" "$dev2"
 lvremove -ff $vg
 
-# Setup 2-way RAID1 LV to spread across 4 devices.
+
+# Setup 2-way RAID1 LV, spread across 4 devices.
 # For each image:
 #  - metadata LV + 1 image extent (2 total extents) on one PV
 #  - 2 image extents on the other PV
@@ -43,10 +44,8 @@ aux wait_for_sync $vg $lv1
 # Should not be enough non-overlapping space.
 not lvconvert -m +1 $vg/$lv1 \
     "$dev5:0-1" "$dev1" "$dev2" "$dev3" "$dev4"
-
 lvconvert -m +1 $vg/$lv1 "$dev5"
 lvconvert -m 0 $vg/$lv1
-
 # Should work due to '--alloc anywhere'
 # RAID conversion not honoring allocation policy!
 #lvconvert -m +1 --alloc anywhere $vg/$lv1 \
@@ -54,4 +53,19 @@ lvconvert -m 0 $vg/$lv1
 lvremove -ff $vg
 
 
+# Setup 2-way RAID1 LV, spread across 4 devices
+#  - metadata LV + 1 image extent (2 total extents) on one PV
+#  - 2 image extents on the other PV
+# Kill one PV.  There should be enough space on the remaining
+# PV for that image to reallocate the entire image there and
+# still maintain redundancy.
+lvcreate --type raid1 -m 1 -l 3 -n $lv1 $vg \
+    "$dev1:0-1" "$dev2:0-1" "$dev3:0-1" "$dev4:0-1"
+aux wait_for_sync $vg $lv1
+aux disable_dev "$dev1"
+lvconvert --repair -y $vg/$lv1 "$dev1" "$dev2" "$dev3" "$dev4"
+#FIXME: ensure non-overlapping images (they should not share PVs)
+aux enable_dev "$dev1"
+lvremove -ff $vg
+
 vgremove -ff $vg