1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 01:55:10 +03:00

lvconvert: add segtype raid5_n and conversions to/from it (cleanup)

Cleanups as of Jons review:
- enhance comment about mandatory raid4 <-> raid5_n activation w/o metadata SubLVs
- remove bogus segment flag setting
- fix to sync related comments on conversions to raid0/striped and amongst raid4/5
- add missing error message for non-synced conversion to raid0/striped

Related: rhbz1366296
This commit is contained in:
Heinz Mauelshagen 2017-02-07 12:25:26 +01:00
parent cfb6ef654d
commit 91c4bd14d0
2 changed files with 15 additions and 5 deletions

View File

@ -148,7 +148,14 @@ static void _check_raid1_seg(struct lv_segment *seg, int *error_count)
static void _check_raid45610_seg(struct lv_segment *seg, int *error_count)
{
/* Checks applying to any raid4/5/6/10 */
/* Allow raid4 + raid5_n to get activated w/o metadata (mandatory during conversion between them) */
/*
* Allow raid4 + raid5_n to get activated w/o metadata.
*
* This is mandatory during conversion between them,
* because switching the dedicated parity SubLVs
* beginning <-> end changes the roles of all SubLVs
* which the kernel would reject.
*/
if (!(seg_is_raid4(seg) || seg_is_raid5_n(seg)) && !seg->meta_areas)
raid_seg_error("no meta areas");
if (!seg->stripe_size)

View File

@ -2196,7 +2196,7 @@ static int _convert_mirror_to_raid1(struct logical_volume *lv,
lv->status &= ~MIRROR;
lv->status &= ~MIRRORED;
lv->status |= RAID;
seg->status |= RAID;
seg->status |= SEG_RAID;
if (!lv_update_and_reload(lv))
return_0;
@ -3114,9 +3114,12 @@ static int _raid456_to_raid0_or_striped_wrapper(TAKEOVER_FN_ARGS)
dm_list_init(&removal_lvs);
/* Necessary when convering to raid0/striped w/o redundancy? */
if (!_raid_in_sync(lv))
/* Necessary when converting to raid0/striped w/o redundancy. */
if (!_raid_in_sync(lv)) {
log_error("Unable to convert %s while it is not in-sync.",
display_lvname(lv));
return 0;
}
if (!yes && yes_no_prompt("Are you sure you want to convert \"%s\" LV %s to \"%s\" "
"type losing %s resilience? [y/n]: ",
@ -3224,7 +3227,7 @@ static int _raid45_to_raid54_wrapper(TAKEOVER_FN_ARGS)
}
/* Necessary when convering to raid0/striped w/o redundancy? */
/* Necessary when convering to raid0/striped w/o redundancy. */
if (!_raid_in_sync(lv)) {
log_error("Unable to convert %s while it is not in-sync.",
display_lvname(lv));