1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

lvcreate: No longer adjust --stripes for raid types.

If the number of stripes requested is incompatible with the requested
type of raid, give an error instead of adjusting it.

If no stripes argument is supplied, continue to use an appropriate
default.
This commit is contained in:
Alasdair G Kergon 2016-08-19 14:19:51 +01:00
parent c1a0a2c712
commit ea0f604e70
2 changed files with 25 additions and 4 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.165 -
===================================
No longer adjust incorrect number of raid stripes supplied to lvcreate.
Move lcm and gcd to lib/misc.
Suppress some unnecessary --stripesize parameter warnings.
Fix 'pvmove -n name ...' to prohibit collocation of RAID SubLVs

View File

@ -464,6 +464,12 @@ static int _read_raid_params(struct cmd_context *cmd,
/*
* RAID10 needs at least 4 stripes
*/
if (lp->stripes_supplied) {
log_error("Minimum of 2 stripes required for %s.",
lp->segtype->name);
return 0;
}
log_warn("Adjusting stripes to the minimum of 2 for %s.",
lp->segtype->name);
lp->stripes = 2;
@ -480,14 +486,28 @@ static int _read_raid_params(struct cmd_context *cmd,
/*
* RAID1 does not take a stripe arg
*/
log_error("Stripe argument cannot be used with segment type, %s",
log_error("Stripes argument cannot be used with segment type, %s",
lp->segtype->name);
return 0;
}
} else if (lp->stripes < 2)
/* No stripes argument was given */
lp->stripes = seg_is_any_raid6(lp) ? 3 : 2;
} else if (seg_is_any_raid6(lp) && lp->stripes < 3) {
if (lp->stripes_supplied) {
log_error("Minimum of 3 stripes required for %s.", lp->segtype->name);
return 0;
}
log_warn("Adjusting stripes to the minimum of 3 for %s.", lp->segtype->name);
lp->stripes = 3;
} else if (lp->stripes < 2) {
if (lp->stripes_supplied) {
log_error("Minimum of 2 stripes required for %s.", lp->segtype->name);
return 0;
}
log_warn("Adjusting stripes to the minimum of 2 for %s.", lp->segtype->name);
lp->stripes = 2;
}
if (seg_is_raid1(lp)) {
if (lp->stripe_size) {