mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
cleanup: move mirror check code closer
Group a bit more code related to mirrors.
This commit is contained in:
parent
09dc590b67
commit
19b064a309
@ -771,7 +771,19 @@ static int _lvcreate_params(struct lvcreate_params *lp,
|
|||||||
lp->mirrors = 2;
|
lp->mirrors = 2;
|
||||||
|
|
||||||
if (arg_count(cmd, mirrors_ARG)) {
|
if (arg_count(cmd, mirrors_ARG)) {
|
||||||
|
if (arg_sign_value(cmd, mirrors_ARG, SIGN_NONE) == SIGN_MINUS) {
|
||||||
|
log_error("Mirrors argument may not be negative");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
lp->mirrors = arg_uint_value(cmd, mirrors_ARG, 0) + 1;
|
lp->mirrors = arg_uint_value(cmd, mirrors_ARG, 0) + 1;
|
||||||
|
|
||||||
|
if (lp->mirrors > DEFAULT_MIRROR_MAX_IMAGES) {
|
||||||
|
log_error("Only up to " DM_TO_STRING(DEFAULT_MIRROR_MAX_IMAGES)
|
||||||
|
" images in mirror supported currently.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (lp->mirrors == 1) {
|
if (lp->mirrors == 1) {
|
||||||
if (segtype_is_mirrored(lp->segtype)) {
|
if (segtype_is_mirrored(lp->segtype)) {
|
||||||
log_error("--mirrors must be at least 1 with segment type %s.", lp->segtype->name);
|
log_error("--mirrors must be at least 1 with segment type %s.", lp->segtype->name);
|
||||||
@ -790,11 +802,6 @@ static int _lvcreate_params(struct lvcreate_params *lp,
|
|||||||
"only 2-way mirroring (i.e. '-m 1')");
|
"only 2-way mirroring (i.e. '-m 1')");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arg_sign_value(cmd, mirrors_ARG, SIGN_NONE) == SIGN_MINUS) {
|
|
||||||
log_error("Mirrors argument may not be negative");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lp->snapshot && arg_count(cmd, zero_ARG)) {
|
if (lp->snapshot && arg_count(cmd, zero_ARG)) {
|
||||||
@ -880,12 +887,6 @@ static int _lvcreate_params(struct lvcreate_params *lp,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lp->mirrors > DEFAULT_MIRROR_MAX_IMAGES) {
|
|
||||||
log_error("Only up to " DM_TO_STRING(DEFAULT_MIRROR_MAX_IMAGES)
|
|
||||||
" images in mirror supported currently.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allocation parameters
|
* Allocation parameters
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user