mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-18 10:04:20 +03:00
lvcreate: handle linear segment
Put in code to accept 'linear' segment type (when specified stripes cannot be used) Also report 'error' when unknown type is specified.
This commit is contained in:
parent
7359a9df88
commit
dfcf03a9ce
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.112 -
|
Version 2.02.112 -
|
||||||
=====================================
|
=====================================
|
||||||
|
Support lvcreate --type linear.
|
||||||
Improve _should_wipe_lv() to warn with message.
|
Improve _should_wipe_lv() to warn with message.
|
||||||
Inform about temporarily created volumes only in verbose mode.
|
Inform about temporarily created volumes only in verbose mode.
|
||||||
Better support for --test mode with pool creation.
|
Better support for --test mode with pool creation.
|
||||||
|
@ -714,6 +714,7 @@ static int _lvcreate_params(struct lvcreate_params *lp,
|
|||||||
struct arg_value_group_list *current_group;
|
struct arg_value_group_list *current_group;
|
||||||
const char *segtype_str;
|
const char *segtype_str;
|
||||||
const char *tag;
|
const char *tag;
|
||||||
|
int only_linear = 0;
|
||||||
|
|
||||||
memset(lcp, 0, sizeof(*lcp));
|
memset(lcp, 0, sizeof(*lcp));
|
||||||
dm_list_init(&lp->tags);
|
dm_list_init(&lp->tags);
|
||||||
@ -745,6 +746,10 @@ static int _lvcreate_params(struct lvcreate_params *lp,
|
|||||||
segtype_str = "striped";
|
segtype_str = "striped";
|
||||||
|
|
||||||
segtype_str = arg_str_value(cmd, type_ARG, segtype_str);
|
segtype_str = arg_str_value(cmd, type_ARG, segtype_str);
|
||||||
|
if (!strcmp(segtype_str, "linear")) {
|
||||||
|
segtype_str = "striped";
|
||||||
|
only_linear = 1; /* User requested linear only target */
|
||||||
|
}
|
||||||
|
|
||||||
if (!(lp->segtype = get_segtype_from_string(cmd, segtype_str)))
|
if (!(lp->segtype = get_segtype_from_string(cmd, segtype_str)))
|
||||||
return_0;
|
return_0;
|
||||||
@ -911,6 +916,11 @@ static int _lvcreate_params(struct lvcreate_params *lp,
|
|||||||
!_read_cache_pool_params(lp, cmd))
|
!_read_cache_pool_params(lp, cmd))
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
|
if (only_linear && lp->stripes > 1) {
|
||||||
|
log_error("Cannot use stripes with linear type.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (lp->snapshot && (lp->extents || lcp->size)) {
|
if (lp->snapshot && (lp->extents || lcp->size)) {
|
||||||
lp->chunk_size = arg_uint_value(cmd, chunksize_ARG, 8);
|
lp->chunk_size = arg_uint_value(cmd, chunksize_ARG, 8);
|
||||||
if (lp->chunk_size < 8 || lp->chunk_size > 1024 ||
|
if (lp->chunk_size < 8 || lp->chunk_size > 1024 ||
|
||||||
|
@ -564,7 +564,13 @@ int alloc_arg(struct cmd_context *cmd __attribute__((unused)), struct arg_values
|
|||||||
|
|
||||||
int segtype_arg(struct cmd_context *cmd, struct arg_values *av)
|
int segtype_arg(struct cmd_context *cmd, struct arg_values *av)
|
||||||
{
|
{
|
||||||
return get_segtype_from_string(cmd, av->value) ? 1 : 0;
|
struct segment_type *segtype;
|
||||||
|
const char *str = (!strcmp(av->value, "linear")) ? "striped" : av->value;
|
||||||
|
|
||||||
|
if (!(segtype = get_segtype_from_string(cmd, str)))
|
||||||
|
return_0;
|
||||||
|
|
||||||
|
return (!segtype_is_unknown(segtype)) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user