1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-18 10:04:20 +03:00

lvresize: fix regressiong on accepting args

Commit f45b68940667563e1a8d3bbd5d30864c04381bdf caused regression
of lvresize -m and --type  parameter

After fix this sequence may work when we also fix syntax description:

lvcreate -l1 -m1 -n lv1 vg
lvextend --type mirror -m1 -l+1 vg/lv1
This commit is contained in:
Zdenek Kabelac 2017-02-19 19:08:48 +01:00
parent 13944738d4
commit 87c89ac279

View File

@ -21,7 +21,7 @@ static int _lvresize_params(struct cmd_context *cmd, int argc, char **argv,
const char *cmd_name = command_name(cmd); const char *cmd_name = command_name(cmd);
const char *type_str = arg_str_value(cmd, type_ARG, NULL); const char *type_str = arg_str_value(cmd, type_ARG, NULL);
if (type_str && (lp->segtype = get_segtype_from_string(cmd, type_str))) if (type_str && !(lp->segtype = get_segtype_from_string(cmd, type_str)))
return_0; return_0;
if (!strcmp(cmd_name, "lvreduce")) if (!strcmp(cmd_name, "lvreduce"))
@ -122,11 +122,14 @@ static int _lvresize_params(struct cmd_context *cmd, int argc, char **argv,
return 0; return 0;
} }
if ((lp->mirrors = arg_count(cmd, mirrors_ARG)) && if (arg_is_set(cmd, mirrors_ARG)) {
(arg_sign_value(cmd, mirrors_ARG, SIGN_NONE) == SIGN_MINUS)) { if (arg_sign_value(cmd, mirrors_ARG, SIGN_NONE) != SIGN_NONE) {
log_error("Mirrors argument may not be signed."); log_error("Mirrors argument may not be signed.");
return 0; return 0;
} }
if ((lp->mirrors = arg_uint_value(cmd, mirrors_ARG, 0)))
lp->mirrors++;
}
if ((lp->stripes = arg_uint_value(cmd, stripes_ARG, 0)) && if ((lp->stripes = arg_uint_value(cmd, stripes_ARG, 0)) &&
(arg_sign_value(cmd, stripes_ARG, SIGN_NONE) == SIGN_MINUS)) { (arg_sign_value(cmd, stripes_ARG, SIGN_NONE) == SIGN_MINUS)) {