Skip to contentSkip to conversation

master - lvreduce/lvresize: add ability to reduce the size of a RaidLV

PATCH Heinz Mauelshagen 1 participant 1 message Feb 9, 2017

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=55eaabd1183042b8e03b3a969eadf624623c4b62
Commit:        55eaabd1183042b8e03b3a969eadf624623c4b62
Parent:        79f31008fa10cc4893b6f98ad3e0de188aa5e7b0
Author:        Heinz Mauelshagen <[email protected]>
AuthorDate:    Thu Feb 9 22:41:28 2017 +0100
Committer:     Heinz Mauelshagen <[email protected]>
CommitterDate: Thu Feb 9 22:42:03 2017 +0100

lvreduce/lvresize: add ability to reduce the size of a RaidLV

- support shrinking of raid0/1/4/5/6/10 LVs
- enhance lvresize-raid.sh tests: add raid0* and raid10
- fix have_raid4 in aux.sh to allow lv_resize-raid.sh and other scripts to test raid4

Resolves: rhbz1394048

---
 WHATS_NEW                           |    1 +
 lib/metadata/lv_manip.c             |  148 +++++++++++++++++++++++++----------
 lib/metadata/metadata-exported.h    |    6 ++
 lib/metadata/raid_manip.c           |  109 +++++++++++++++++++-------
 test/lib/aux.sh                     |    6 +-
 test/shell/lvconvert-repair-raid.sh |    2 +-
 test/shell/lvresize-raid.sh         |    9 ++-
 7 files changed, 204 insertions(+), 77 deletions(-)
WHATS_NEW +1 -0
index c6994ca..7a32777 100644
@@ -1,5 +1,6 @@
 Version 2.02.169 - 
 =====================================
+  Support shrinking of RaidLvs
   Support region size changes on existing RaidLVs
   Avoid parallel usage of cpg_mcast_joined() in clvmd with corosync.
   Support raid6_{ls,rs,la,ra}_6 segment types and conversions from/to it.
lib/metadata/lv_manip.c +107 -41

222 lines not on this page · raw message

lib/metadata/metadata-exported.h +6 -0
index 4e05885..05771d8 100644
@@ -1217,6 +1217,12 @@ int lv_raid_replace(struct logical_volume *lv, int force,
 		    struct dm_list *remove_pvs, struct dm_list *allocate_pvs);
 int lv_raid_remove_missing(struct logical_volume *lv);
 int partial_raid_lv_supports_degraded_activation(const struct logical_volume *lv);
+uint32_t raid_rmeta_extents_delta(struct cmd_context *cmd,
+				  uint32_t rimage_extents_cur, uint32_t rimage_extents_new,
+				  uint32_t region_size, uint32_t extent_size);
+uint32_t raid_rimage_extents(const struct segment_type *segtype,
+			     uint32_t extents, uint32_t stripes, uint32_t data_copies);
+uint32_t raid_ensure_min_region_size(const struct logical_volume *lv, uint64_t lv_size, uint32_t region_size);
 /* --  metadata/raid_manip.c */
 
 /* ++  metadata/cache_manip.c */
lib/metadata/raid_manip.c +80 -29

187 lines not on this page · raw message

test/lib/aux.sh +3 -3
index 027e3f4..7c3daa5 100644
@@ -1413,10 +1413,10 @@ have_raid() {
 }
 
 have_raid4 () {
-	local r=1
+	local r=0
 
-	have_raid 1 8 0 && r=0
-	have_raid 1 9 1 && r=1
+	have_raid 1 8 0 && r=1
+	have_raid 1 9 1 && r=0
 
 	return $r
 }
test/shell/lvconvert-repair-raid.sh +1 -1
index 26bca3d..3052f5c 100644
@@ -20,7 +20,7 @@ aux raid456_replace_works || skip
 aux lvmconf 'allocation/maximise_cling = 0' \
 	    'allocation/mirror_logs_require_separate_pvs = 1'
 
-aux prepare_vg 8
+aux prepare_vg 8 80
 
 function delay
 {
test/shell/lvresize-raid.sh +6 -3
index 4eabe4c..4f22740 100644
@@ -16,8 +16,8 @@ SKIP_WITH_LVMPOLLD=1
 
 aux have_raid 1 3 0 || skip
 
-levels="5 6"
-aux have_raid4 && levels="4 5 6"
+levels="5 6 10"
+aux have_raid4 && levels="0 0_meta 4 $levels"
 
 aux prepare_pvs 6 80
 
@@ -39,9 +39,10 @@ for deactivate in true false; do
 
 	#check raid_images_contiguous $vg $lv1
 
-# Extend and reduce 3-striped RAID 4/5/6
+# Extend and reduce 3-striped RAID 4/5/6/10
 	for i in $levels ; do
 		lvcreate --type raid$i -i 3 -l 3 -n $lv2 $vg
+		check lv_field $vg/$lv2 "seg_size" "768.00k"
 
 		test $deactivate && {
 			aux wait_for_sync $vg $lv2
@@ -49,10 +50,12 @@ for deactivate in true false; do
 		}
 
 		lvresize -l +3 $vg/$lv2
+		check lv_field $vg/$lv2 "seg_size" "1.50m"
 
 		#check raid_images_contiguous $vg $lv1
 
 		should lvresize -y -l -3 $vg/$lv2
+		should check lv_field $vg/$lv2 "seg_size" "768.00k"
 
 		#check raid_images_contiguous $vg $lv1