master - lvconvert: allow raid4 -> linear conversion request
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=989626926c98cd00f0236c4fcac883107d76899d Commit: 989626926c98cd00f0236c4fcac883107d76899d Parent: e2e30a64ab10602951443dfbd3481bd6b32f5459 Author: Heinz Mauelshagen <[email protected]> AuthorDate: Mon Sep 10 18:36:52 2018 +0200 Committer: Heinz Mauelshagen <[email protected]> CommitterDate: Mon Sep 10 18:43:21 2018 +0200
lvconvert: allow raid4 -> linear conversion request
Allow "lvconvert --type linear RaidLV" on a raid4 LV providing convenient interim steps to convert to linear.
Add respective new test
lvconvert-raid-takeover-raid4_to_linear.sh
and
lvconvert-raid-takeover-linear_to_raid4.sh
for linear to raid4 once on it.
--- WHATS_NEW | 1 + lib/metadata/raid_manip.c | 22 +++-- .../lvconvert-raid-takeover-linear_to_raid4.sh | 71 +++++++++++++++++ .../lvconvert-raid-takeover-raid4_to_linear.sh | 82 ++++++++++++++++++++ 4 files changed, 167 insertions(+), 9 deletions(-)
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 3.0.0 ============= + Allow raid4 -> linear conversion request. Fix lvconvert striped/raid0/raid0_meta -> raid6 regression. Add 'lvm2-activation-generator:' prefix for kmsg messages logged by generator. Add After=rbdmap.service to {lvm2-activation-net,blk-availability}.service.
lib/metadata/raid_manip.c +13 -9
@@ -6149,9 +6149,17 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_frelse if (!segtype_is_raid4 (*segtype) && !segtype_is_any_raid5 (*segtype)) seg_flag =SEG_RAID5_LS ; -/* raid5* -> */ - }else if (seg_is_any_raid5 (seg_from)) { -if (segtype_is_raid1 (*segtype) ||segtype_is_linear (*segtype)) { +/* raid4/raid5* -> */ + }else if (seg_is_raid4 (seg_from) ||seg_is_any_raid5 (seg_from)) { +if (seg_is_raid4 (seg_from) &&segtype_is_any_raid5 (*segtype)) { +if (!segtype_is_raid5_n (*segtype)) + seg_flag =SEG_RAID5_N ; + + }else if (seg_is_any_raid5 (seg_from) &&segtype_is_raid4 (*segtype)) { +if (!seg_is_raid5_n (seg_from)) + seg_flag =SEG_RAID5_N ; + + }else if (segtype_is_raid1 (*segtype) ||segtype_is_linear (*segtype)) {if (seg_from->area_count !=2 ) {log_error ("Converting %s LV %s to 2 stripes first." ,lvseg_name (seg_from),display_lvname (seg_from->lv));
@@ -6173,12 +6181,12 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr lvseg_name(seg_from), display_lvname(seg_from->lv), *new_image_count); }else - seg_flag =_raid_seg_flag_5_to_6 (seg_from); + seg_flag =seg_is_raid4 (seg_from) ?SEG_RAID6_N_6 :_raid_seg_flag_5_to_6 (seg_from); }else if (segtype_is_striped (*segtype) ||segtype_is_raid10 (*segtype)) {int change =0 ; -if (!seg_is_raid5_n (seg_from)) { +if (!seg_is_raid4 (seg_from) && !seg_is_raid5_n (seg_from)) { seg_flag =SEG_RAID5_N ; }else if (*stripes >2 && *stripes != seg_from->area_count - seg_from->segtype->parity_devs) {
@@ -6199,10 +6207,6 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr lvseg_name(seg_from), display_lvname(seg_from->lv), *new_image_count); } -/* raid4 -> * */ - }else if (seg_is_raid4 (seg_from) && !segtype_is_raid4 (*segtype) && !segtype_is_striped (*segtype)) { - seg_flag =segtype_is_any_raid6 (*segtype) ?SEG_RAID6_N_6 :SEG_RAID5_N ; -/* raid6 -> striped/raid0/raid5/raid10 */ }else if (seg_is_any_raid6 (seg_from)) {if (segtype_is_raid1 (*segtype)) {
test/shell/lvconvert-raid-takeover-linear_to_raid4.sh new file +71 -0
71 lines not on this page · raw message
test/shell/lvconvert-raid-takeover-raid4_to_linear.sh new file +82 -0
82 lines not on this page · raw message