1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-28 02:50:41 +03:00

RAID: Improve RAID argument handling.

Disallow '-m' for RAID types that have no mirror component and disallow
'-i' argument for RAID types that have no stripe component.
This commit is contained in:
Jonathan Brassow 2012-08-08 12:32:27 -05:00
parent b61be64370
commit de3b1c4506
2 changed files with 22 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.97 - 7th August 2012
=================================
Issue error message when arguments do not match specified RAID type.
Improve documention of allocation policies in lvm.8.
Increase limit for major:minor to 4095:1048575 when using -My option.
Add make install_systemd_generators.

View File

@ -538,6 +538,27 @@ static int _read_raid_params(struct lvcreate_params *lp,
return 0;
}
/*
* RAID types without a mirror component do not take '-m' arg
*/
if (!segtype_is_mirrored(lp->segtype) &&
arg_count(cmd, mirrors_ARG)) {
log_error("Mirror argument cannot be used with segment type, %s",
lp->segtype->name);
return 0;
}
/*
* RAID1 does not take a stripe arg
*/
if ((lp->stripes > 1) &&
segtype_is_mirrored(lp->segtype) &&
strcmp(lp->segtype->name, "raid10")) {
log_error("Stripe argument cannot be used with segment type, %s",
lp->segtype->name);
return 0;
}
/*
* _read_mirror_params is called before _read_raid_params
* and already sets: