diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2014-10-11 18:36:40 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2014-10-24 16:39:32 +0200 |
commit | dfcf03a9ce2fe9b618f44c5f99e13ff5610ffcc0 (patch) | |
tree | 42a7b115405efcbc647e365cdc3e480f25c829a8 | |
parent | 7359a9df889a2ed8d6e6114ecc3f57438a75d9d7 (diff) | |
download | lvm2-dfcf03a9ce2fe9b618f44c5f99e13ff5610ffcc0.tar.gz |
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.
-rw-r--r-- | WHATS_NEW | 1 | ||||
-rw-r--r-- | tools/lvcreate.c | 10 | ||||
-rw-r--r-- | tools/lvmcmdline.c | 8 |
3 files changed, 18 insertions, 1 deletions
@@ -1,5 +1,6 @@ Version 2.02.112 - ===================================== + Support lvcreate --type linear. Improve _should_wipe_lv() to warn with message. Inform about temporarily created volumes only in verbose mode. Better support for --test mode with pool creation. diff --git a/tools/lvcreate.c b/tools/lvcreate.c index 301bda61a..b6907f577 100644 --- a/tools/lvcreate.c +++ b/tools/lvcreate.c @@ -714,6 +714,7 @@ static int _lvcreate_params(struct lvcreate_params *lp, struct arg_value_group_list *current_group; const char *segtype_str; const char *tag; + int only_linear = 0; memset(lcp, 0, sizeof(*lcp)); dm_list_init(&lp->tags); @@ -745,6 +746,10 @@ static int _lvcreate_params(struct lvcreate_params *lp, segtype_str = "striped"; 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))) return_0; @@ -911,6 +916,11 @@ static int _lvcreate_params(struct lvcreate_params *lp, !_read_cache_pool_params(lp, cmd)) 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)) { lp->chunk_size = arg_uint_value(cmd, chunksize_ARG, 8); if (lp->chunk_size < 8 || lp->chunk_size > 1024 || diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c index 6e1367940..bbf0145a7 100644 --- a/tools/lvmcmdline.c +++ b/tools/lvmcmdline.c @@ -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) { - 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; } /* |