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

RAID: If no stripes argument is given for RAID10 create, default to 2

Similar to the way the 'mirror', 'raid1' and 'raid10' segment types set
the number of mirrors to 2 ('-m 1') if the argument is not specified,
here we set the number of stripes to 2 if not given on the command line
when creating a RAID10 LV.
This commit is contained in:
Jonathan Brassow 2012-11-21 18:46:52 -06:00
parent fb0cee9a66
commit b3e9a09abe
2 changed files with 13 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
When no '-i' argument is given for RAID10, default to 2 stripes.
Do not allow --splitmirrors on RAID10 logical volumes.
Skip mlocking [vectors] on arm architecture.
Support allocation of pool metadata with lvconvert command.

View File

@ -493,13 +493,24 @@ static int _read_raid_params(struct lvcreate_params *lp,
* lp->stripes
* lp->stripe_size
*
* For RAID 4/5/6, these values must be set.
* For RAID 4/5/6/10, these values must be set.
*/
if (!segtype_is_mirrored(lp->segtype) &&
(lp->stripes <= lp->segtype->parity_devs)) {
log_error("Number of stripes must be at least %d for %s",
lp->segtype->parity_devs + 1, lp->segtype->name);
return 0;
} else if (!strcmp(lp->segtype->name, "raid10") && (lp->stripes < 2)) {
if (arg_count(cmd, stripes_ARG)) {
/* User supplied the bad argument */
log_error("Segment type 'raid10' requires 2 or more stripes.");
return 0;
}
/* No stripe argument was given - default to 2 */
lp->stripes = 2;
lp->stripe_size = find_config_tree_int(cmd,
"metadata/stripesize",
DEFAULT_STRIPESIZE) * 2;
}
/*