mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lvcreate.c: respect DEFAULT_RAID_MAX_IMAGES on creation of any RaidLV
This commit is contained in:
parent
8f62b7bfe5
commit
c7b2654c25
@ -529,25 +529,12 @@ static int _read_mirror_and_raid_params(struct cmd_context *cmd,
|
||||
struct lvcreate_params *lp)
|
||||
{
|
||||
int pagesize = lvm_getpagesize();
|
||||
unsigned max_images;
|
||||
const char *segtype_name;
|
||||
unsigned max_images = segtype_is_raid(lp->segtype) ? DEFAULT_RAID_MAX_IMAGES :
|
||||
DEFAULT_MIRROR_MAX_IMAGES;
|
||||
|
||||
/* Common mirror and raid params */
|
||||
if (arg_is_set(cmd, mirrors_ARG)) {
|
||||
lp->mirrors = arg_uint_value(cmd, mirrors_ARG, 0) + 1;
|
||||
if (segtype_is_raid1(lp->segtype)) {
|
||||
segtype_name = SEG_TYPE_NAME_RAID1;
|
||||
max_images = DEFAULT_RAID_MAX_IMAGES;
|
||||
} else {
|
||||
segtype_name = SEG_TYPE_NAME_MIRROR;
|
||||
max_images = DEFAULT_MIRROR_MAX_IMAGES;
|
||||
}
|
||||
|
||||
if (lp->mirrors > max_images) {
|
||||
log_error("Only up to %u images in %s supported currently.",
|
||||
max_images, segtype_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((lp->mirrors > 2) && segtype_is_raid10(lp->segtype)) {
|
||||
/*
|
||||
@ -571,6 +558,12 @@ static int _read_mirror_and_raid_params(struct cmd_context *cmd,
|
||||
/* Default to 2 mirrored areas if '--type mirror|raid1|raid10' */
|
||||
lp->mirrors = seg_is_mirrored(lp) ? 2 : 1;
|
||||
|
||||
if (max(lp->mirrors, lp->stripes) > max_images) {
|
||||
log_error("Only up to %u images in %s supported currently.",
|
||||
max_images, lp->segtype->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
lp->nosync = arg_is_set(cmd, nosync_ARG);
|
||||
|
||||
if (!(lp->region_size = arg_uint_value(cmd, regionsize_ARG, 0)) &&
|
||||
|
Loading…
Reference in New Issue
Block a user