Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
List overview
Download
lvm2-commits
September 2014
----- 2024 -----
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
lvm2-commits@lists.fedorahosted.org
6 participants
151 discussions
Start a n
N
ew thread
master - toollib: introduce validate_lvname_param
by Zdenek Kabelac
28 Sep '14
28 Sep '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0d4baeba18646478…
Commit: 0d4baeba18646478e1edb7b26a9f9c74d6add1f5 Parent: 89e1190ef01943b59207c2093e643a6b06dc9be6 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Sun Sep 28 12:57:39 2014 +0200 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Sun Sep 28 13:49:01 2014 +0200 toollib: introduce validate_lvname_param Function for parsing and validating of lvname parameter. --- tools/toollib.c | 37 +++++++++++++++++++++++++++++++++++++ tools/toollib.h | 3 +++ 2 files changed, 40 insertions(+), 0 deletions(-) diff --git a/tools/toollib.c b/tools/toollib.c index eb7f058..ec9a95c 100644 --- a/tools/toollib.c +++ b/tools/toollib.c @@ -1949,3 +1949,40 @@ int get_and_validate_major_minor(const struct cmd_context *cmd, return 1; } + +/* + * Validate lvname parameter + * + * If it contains vgname, it is extracted from lvname. + * If there is passed vgname, it is compared whether its the same name. + */ +int validate_lvname_param(struct cmd_context *cmd, const char **vg_name, + const char **lv_name) +{ + const char *vgname; + const char *lvname; + + if (!lv_name || !*lv_name) + return 1; /* NULL lvname is ok */ + + /* If contains VG name, extract it. */ + if (strchr(*lv_name, (int) '/')) { + if (!(vgname = _extract_vgname(cmd, *lv_name, &lvname))) + return_0; + + if (!*vg_name) + *vg_name = vgname; + else if (strcmp(vgname, *vg_name)) { + log_error("Please use a single volume group name " + "(\"%s\" or \"%s\")", vgname, *vg_name); + return 0; + } + + *lv_name = lvname; + } + + if (!apply_lvname_restrictions(*lv_name)) + return_0; + + return 1; +} diff --git a/tools/toollib.h b/tools/toollib.h index b4fc24c..8aa82e0 100644 --- a/tools/toollib.h +++ b/tools/toollib.h @@ -144,4 +144,7 @@ int get_and_validate_major_minor(const struct cmd_context *cmd, const struct format_type *fmt, int32_t *major, int32_t *minor); +int validate_lvname_param(struct cmd_context *cmd, const char **vg_name, + const char **lv_name); + #endif
1
0
0
0
master - cleanup: rename func
by Zdenek Kabelac
28 Sep '14
28 Sep '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=89e1190ef01943b5…
Commit: 89e1190ef01943b59207c2093e643a6b06dc9be6 Parent: 911d6efa51fac96846e109dbff8839cd3fb6cb25 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Sat Sep 27 18:53:08 2014 +0200 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Sun Sep 28 13:49:01 2014 +0200 cleanup: rename func Update name of function read_and_validate_major_minor and put it into the right header file toollib.h. (In release update for f09f85d027d8833) --- tools/lvchange.c | 4 +- tools/lvcreate.c | 4 +- tools/lvmcmdline.c | 54 -------------------------------------------------- tools/toollib.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++- tools/toollib.h | 4 +++ tools/tools.h | 3 -- 6 files changed, 63 insertions(+), 62 deletions(-) diff --git a/tools/lvchange.c b/tools/lvchange.c index 7976bf3..fb3df50 100644 --- a/tools/lvchange.c +++ b/tools/lvchange.c @@ -542,8 +542,8 @@ static int lvchange_persistent(struct cmd_context *cmd, { enum activation_change activate = CHANGE_AN; - if (!read_and_validate_major_minor(cmd, lv->vg->fid->fmt, - &lv->major, &lv->minor)) + if (!get_and_validate_major_minor(cmd, lv->vg->fid->fmt, + &lv->major, &lv->minor)) return_0; if (lv->minor == -1) { diff --git a/tools/lvcreate.c b/tools/lvcreate.c index 7c811ba..17fcd46 100644 --- a/tools/lvcreate.c +++ b/tools/lvcreate.c @@ -767,8 +767,8 @@ static int _read_activation_params(struct lvcreate_params *lp, return 0; } - if (!read_and_validate_major_minor(cmd, vg->fid->fmt, - &lp->major, &lp->minor)) + if (!get_and_validate_major_minor(cmd, vg->fid->fmt, + &lp->major, &lp->minor)) return_0; } else if (arg_is_set(cmd, major_ARG) || arg_is_set(cmd, minor_ARG)) { log_error("--major and --minor require -My."); diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c index 5f258a2..e56a57a 100644 --- a/tools/lvmcmdline.c +++ b/tools/lvmcmdline.c @@ -576,60 +576,6 @@ int metadatacopies_arg(struct cmd_context *cmd, struct arg_values *av) return int_arg(cmd, av); } -int read_and_validate_major_minor(const struct cmd_context *cmd, - const struct format_type *fmt, - int32_t *major, int32_t *minor) -{ - if (strcmp(arg_str_value(cmd, persistent_ARG, "n"), "y")) { - if (arg_is_set(cmd, minor_ARG) || arg_is_set(cmd, major_ARG)) { - log_error("--major and --minor incompatible with -Mn"); - return 0; - } - *major = *minor = -1; - return 1; - } - - if (arg_count(cmd, minor_ARG) > 1) { - log_error("Option --minor may not be repeated."); - return 0; - } - - if (arg_count(cmd, major_ARG) > 1) { - log_error("Option -j/--major may not be repeated."); - return 0; - } - - if (!strncmp(cmd->kernel_vsn, "2.4.", 4)) { - /* Major is required for 2.4 */ - if (!arg_is_set(cmd, major_ARG)) { - log_error("Please specify major number with " - "--major when using -My"); - return 0; - } - *major = arg_int_value(cmd, major_ARG, -1); - } else { - if (arg_is_set(cmd, major_ARG)) { - log_warn("WARNING: Ignoring supplied major number - " - "kernel assigns major numbers dynamically. " - "Using major number %d instead.", - cmd->dev_types->device_mapper_major); - } - *major = cmd->dev_types->device_mapper_major; - } - - if (!arg_is_set(cmd, minor_ARG)) { - log_error("Please specify minor number with --minor when using -My."); - return 0; - } - - *minor = arg_int_value(cmd, minor_ARG, -1); - - if (!validate_major_minor(cmd, fmt, *major, *minor)) - return_0; - - return 1; -} - static void __alloc(int size) { if (!(_cmdline.commands = dm_realloc(_cmdline.commands, sizeof(*_cmdline.commands) * size))) { diff --git a/tools/toollib.c b/tools/toollib.c index 31bb037..eb7f058 100644 --- a/tools/toollib.c +++ b/tools/toollib.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. - * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. + * Copyright (C) 2004-2014 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. * @@ -1895,3 +1895,57 @@ int process_each_label(struct cmd_context *cmd, int argc, char **argv, void *han return ret_max; } + +int get_and_validate_major_minor(const struct cmd_context *cmd, + const struct format_type *fmt, + int32_t *major, int32_t *minor) +{ + if (strcmp(arg_str_value(cmd, persistent_ARG, "n"), "y")) { + if (arg_is_set(cmd, minor_ARG) || arg_is_set(cmd, major_ARG)) { + log_error("--major and --minor incompatible with -Mn"); + return 0; + } + *major = *minor = -1; + return 1; + } + + if (arg_count(cmd, minor_ARG) > 1) { + log_error("Option --minor may not be repeated."); + return 0; + } + + if (arg_count(cmd, major_ARG) > 1) { + log_error("Option -j/--major may not be repeated."); + return 0; + } + + if (!strncmp(cmd->kernel_vsn, "2.4.", 4)) { + /* Major is required for 2.4 */ + if (!arg_is_set(cmd, major_ARG)) { + log_error("Please specify major number with " + "--major when using -My"); + return 0; + } + *major = arg_int_value(cmd, major_ARG, -1); + } else { + if (arg_is_set(cmd, major_ARG)) { + log_warn("WARNING: Ignoring supplied major number - " + "kernel assigns major numbers dynamically. " + "Using major number %d instead.", + cmd->dev_types->device_mapper_major); + } + *major = cmd->dev_types->device_mapper_major; + } + + if (!arg_is_set(cmd, minor_ARG)) { + log_error("Please specify minor number with --minor when using -My."); + return 0; + } + + *minor = arg_int_value(cmd, minor_ARG, -1); + + if (!validate_major_minor(cmd, fmt, *major, *minor)) + return_0; + + return 1; +} diff --git a/tools/toollib.h b/tools/toollib.h index c605aed..b4fc24c 100644 --- a/tools/toollib.h +++ b/tools/toollib.h @@ -140,4 +140,8 @@ int get_stripe_params(struct cmd_context *cmd, uint32_t *stripes, int change_tag(struct cmd_context *cmd, struct volume_group *vg, struct logical_volume *lv, struct physical_volume *pv, int arg); +int get_and_validate_major_minor(const struct cmd_context *cmd, + const struct format_type *fmt, + int32_t *major, int32_t *minor); + #endif diff --git a/tools/tools.h b/tools/tools.h index cbea1fa..44364d8 100644 --- a/tools/tools.h +++ b/tools/tools.h @@ -138,9 +138,6 @@ int segtype_arg(struct cmd_context *cmd, struct arg_values *av); int alloc_arg(struct cmd_context *cmd, struct arg_values *av); int readahead_arg(struct cmd_context *cmd, struct arg_values *av); int metadatacopies_arg(struct cmd_context *cmd __attribute__((unused)), struct arg_values *av); -int read_and_validate_major_minor(const struct cmd_context *cmd, - const struct format_type *fmt, - int32_t *major, int32_t *minor); /* we use the enums to access the switches */ unsigned arg_count(const struct cmd_context *cmd, int a);
1
0
0
0
master - toollib: refactor extract_vgname
by Zdenek Kabelac
28 Sep '14
28 Sep '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=911d6efa51fac968…
Commit: 911d6efa51fac96846e109dbff8839cd3fb6cb25 Parent: b0dde9e8f026ddd6799d6ca534ff9523d633c735 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Sat Sep 27 16:29:43 2014 +0200 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Sun Sep 28 13:49:01 2014 +0200 toollib: refactor extract_vgname Split internals of extract_vgname into _extract_vgname. This common code will be used for other similar function. Reuse skip_dev_dir() instead of less mature coded to skip device dir. Instead of duplicating full vg/lv name - allocate string only vg portion of lv name. --- tools/toollib.c | 71 ++++++++++++++++++++++++++---------------------------- 1 files changed, 34 insertions(+), 37 deletions(-) diff --git a/tools/toollib.c b/tools/toollib.c index 3a0e053..31bb037 100644 --- a/tools/toollib.c +++ b/tools/toollib.c @@ -954,52 +954,49 @@ bad: return ECMD_FAILED; } +static const char *_extract_vgname(struct cmd_context *cmd, const char *lv_name, + const char **after) +{ + const char *vg_name = lv_name; + char *st, *pos; + + /* Strip dev_dir (optional) */ + if (!(vg_name = skip_dev_dir(cmd, vg_name, NULL))) + return_0; + + /* Require exactly one set of consecutive slashes */ + if ((st = pos = strchr(vg_name, '/'))) + while (*st == '/') + st++; + + if (!st || strchr(st, '/')) { + log_error("\"%s\": Invalid path for Logical Volume", + lv_name); + return 0; + } + + if (!(vg_name = dm_pool_strndup(cmd->mem, vg_name, pos - vg_name))) { + log_error("Allocation of vg_name failed."); + return 0; + } + + if (after) + *after = st; + + return vg_name; +} /* * Determine volume group name from a logical volume name */ const char *extract_vgname(struct cmd_context *cmd, const char *lv_name) { const char *vg_name = lv_name; - char *st; - char *dev_dir = cmd->dev_dir; /* Path supplied? */ if (vg_name && strchr(vg_name, '/')) { - /* Strip dev_dir (optional) */ - if (*vg_name == '/') { - while (*vg_name == '/') - vg_name++; - vg_name--; - } - if (!strncmp(vg_name, dev_dir, strlen(dev_dir))) { - vg_name += strlen(dev_dir); - while (*vg_name == '/') - vg_name++; - } - if (*vg_name == '/') { - log_error("\"%s\": Invalid path for Logical " - "Volume", lv_name); - return 0; - } - - /* Require exactly one set of consecutive slashes */ - if ((st = strchr(vg_name, '/'))) - while (*st == '/') - st++; - - if (!st || strchr(st, '/')) { - log_error("\"%s\": Invalid path for Logical Volume", - lv_name); - return 0; - } - - vg_name = dm_pool_strdup(cmd->mem, vg_name); - if (!vg_name) { - log_error("Allocation of vg_name failed"); - return 0; - } + if (!(vg_name = _extract_vgname(cmd, lv_name, NULL))) + return_NULL; - *strchr(vg_name, '/') = '\0'; return vg_name; } @@ -1007,7 +1004,7 @@ const char *extract_vgname(struct cmd_context *cmd, const char *lv_name) if (lv_name) log_error("Path required for Logical Volume \"%s\"", lv_name); - return 0; + return NULL; } return vg_name;
1
0
0
0
master - toollib: refactor skip_dev_dir
by Zdenek Kabelac
28 Sep '14
28 Sep '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b0dde9e8f026ddd6…
Commit: b0dde9e8f026ddd6799d6ca534ff9523d633c735 Parent: f120c954fc065d67c1aacd5cfba58843eb552b0f Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Sun Sep 28 12:54:20 2014 +0200 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Sun Sep 28 13:49:01 2014 +0200 toollib: refactor skip_dev_dir Detect dev dir just once. --- tools/toollib.c | 62 +++++++++++++++++++++++++++--------------------------- 1 files changed, 31 insertions(+), 31 deletions(-) diff --git a/tools/toollib.c b/tools/toollib.c index 7be5b5a..3a0e053 100644 --- a/tools/toollib.c +++ b/tools/toollib.c @@ -108,51 +108,51 @@ int become_daemon(struct cmd_context *cmd, int skip_lvm) const char *skip_dev_dir(struct cmd_context *cmd, const char *vg_name, unsigned *dev_dir_found) { - const char *dmdir = dm_dir(); + size_t devdir_len = strlen(cmd->dev_dir); + const char *dmdir = dm_dir() + devdir_len; size_t dmdir_len = strlen(dmdir), vglv_sz; char *vgname, *lvname, *layer, *vglv; /* FIXME Do this properly */ - if (*vg_name == '/') { - while (*vg_name == '/') + if (*vg_name == '/') + while (vg_name[1] == '/') vg_name++; - vg_name--; - } - /* Reformat string if /dev/mapper found */ - if (!strncmp(vg_name, dmdir, dmdir_len) && vg_name[dmdir_len] == '/') { + if (strncmp(vg_name, cmd->dev_dir, devdir_len)) { + if (dev_dir_found) + *dev_dir_found = 0; + } else { if (dev_dir_found) *dev_dir_found = 1; - vg_name += dmdir_len; + + vg_name += devdir_len; while (*vg_name == '/') vg_name++; - if (!dm_split_lvm_name(cmd->mem, vg_name, &vgname, &lvname, &layer) || - *layer) { - log_error("skip_dev_dir: Couldn't split up device name %s", - vg_name); - return vg_name; - } - vglv_sz = strlen(vgname) + strlen(lvname) + 2; - if (!(vglv = dm_pool_alloc(cmd->mem, vglv_sz)) || - dm_snprintf(vglv, vglv_sz, "%s%s%s", vgname, - *lvname ? "/" : "", - lvname) < 0) { - log_error("vg/lv string alloc failed"); - return vg_name; + /* Reformat string if /dev/mapper found */ + if (!strncmp(vg_name, dmdir, dmdir_len) && vg_name[dmdir_len + 1] == '/') { + vg_name += devdir_len + 1; + while (*vg_name == '/') + vg_name++; + + if (!dm_split_lvm_name(cmd->mem, vg_name, &vgname, &lvname, &layer) || + *layer) { + log_error("skip_dev_dir: Couldn't split up device name %s", + vg_name); + return vg_name; + } + vglv_sz = strlen(vgname) + strlen(lvname) + 2; + if (!(vglv = dm_pool_alloc(cmd->mem, vglv_sz)) || + dm_snprintf(vglv, vglv_sz, "%s%s%s", vgname, + *lvname ? "/" : "", + lvname) < 0) { + log_error("vg/lv string alloc failed"); + return vg_name; + } + return vglv; } - return vglv; } - if (!strncmp(vg_name, cmd->dev_dir, strlen(cmd->dev_dir))) { - if (dev_dir_found) - *dev_dir_found = 1; - vg_name += strlen(cmd->dev_dir); - while (*vg_name == '/') - vg_name++; - } else if (dev_dir_found) - *dev_dir_found = 0; - return vg_name; }
1
0
0
0
master - Revert "man: lvmcache should use clearer cache pool options"
by Zdenek Kabelac
27 Sep '14
27 Sep '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f120c954fc065d67…
Commit: f120c954fc065d67c1aacd5cfba58843eb552b0f Parent: 17a1869df506a3641d49d52c413b5bc04ec2adc9 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Sat Sep 27 15:10:44 2014 +0200 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Sat Sep 27 15:10:44 2014 +0200 Revert "man: lvmcache should use clearer cache pool options" Revert: --cachepool and --thipnpool is the right way they both take arg This is a major difference from --cache and --thin --- man/lvmcache.7.in | 32 ++++++++++++++------------------ 1 files changed, 14 insertions(+), 18 deletions(-) diff --git a/man/lvmcache.7.in b/man/lvmcache.7.in index 6d7109a..cc92673 100644 --- a/man/lvmcache.7.in +++ b/man/lvmcache.7.in @@ -88,15 +88,11 @@ CacheDataLV is renamed CachePoolLV_cdata and becomes hidden. .br CacheMetaLV is renamed CachePoolLV_cmeta and becomes hidden. -.B lvconvert \-\-type cache-pool \-\-poolmetadata VG/CacheMetaLV \\ -.br -.RS -.B VG/CacheDataLV -.RE +.B lvconvert \-\-cachepool VG/CacheDataLV \-\-poolmetadata VG/CacheMetaLV .I Example .br -# lvconvert \-\-type cache\-pool \-\-poolmetadata vg/cache0meta vg/cache0 +# lvconvert \-\-cachepool vg/cache0 \-\-poolmetadata vg/cache0meta .nf # lvs -a vg @@ -197,21 +193,21 @@ pool sub-LVs redundant. .nf 0. Create an origin LV we wish to cache -# lvcreate \-L 10G \-n lv1 vg /dev/slow_devs +# lvcreate \-L 10G \-n lvx vg /dev/slow_devs 1. Create a 2-way RAID1 cache data LV -# lvcreate \-\-type raid1 \-m 1 \-L 1G -n cache1 vg \\ +# lvcreate \-\-type raid1 \-m 1 \-L 1G -n lvx_cache vg \\ /dev/fast1 /dev/fast2 2. Create a 2-way RAID1 cache metadata LV -# lvcreate \-\-type raid1 \-m 1 \-L 8M -n cache1meta vg \\ +# lvcreate \-\-type raid1 \-m 1 \-L 8M -n lvx_cache_meta vg \\ /dev/fast1 /dev/fast2 3. Create a cache pool LV combining cache data LV and cache metadata LV -# lvconvert \-\-type cache\-pool \-\-poolmetadata vg/cache1meta vg/cache1 +# lvconvert \-\-cachepool vg/lvx_cache \-\-poolmetadata vg/lvx_cache_meta 4. Create a cached LV by combining the cache pool LV and origin LV -# lvconvert \-\-type cache \-\-cachepool vg/cache1 vg/lv1 +# lvconvert \-\-type cache \-\-cachepool vg/lvx_cache vg/lvx .fi .SS Writethough caching @@ -227,20 +223,20 @@ cache pool LV, properties of the cache can be specified - in this case, .nf 0. Create an origin LV we wish to cache (yours may already exist) -# lvcreate \-L 10G \-n lv1 vg /dev/slow +# lvcreate \-L 10G \-n lvx vg /dev/slow 1. Create a cache data LV -# lvcreate \-L 1G \-n cache1 vg /dev/fast +# lvcreate \-L 1G \-n lvx_cache vg /dev/fast 2. Create a cache metadata LV -# lvcreate \-L 8M \-n cache1meta vg /dev/fast +# lvcreate \-L 8M \-n lvx_cache_meta vg /dev/fast 3. Create a cache pool LV specifying cache mode "writethrough" -# lvconvert \-\-type cache\-pool \-\-poolmetadata vg/cache1meta \\ - \-\-cachemode writethrough vg/cache1 +# lvconvert \-\-cachepool vg/lvx_cache \-\-poolmetadata vg/lvx_cache_meta \\ + \-\-cachemode writethrough 4. Create a cache LV by combining the cache pool LV and origin LV -# lvconvert \-\-type cache \-\-cachepool vg/cache1 vg/lv1 +# lvconvert \-\-type cache \-\-cachepool vg/lvx_cache vg/lvx .fi .SS Spare metadata LV @@ -262,7 +258,7 @@ the same VG. .B lvcreate -n CacheDataLV -L CacheSize VG .br -.B lvconvert --type cache\-pool VG/CacheDataLV +.B lvconvert --cachepool VG/CacheDataLV .SH SEE ALSO
1
0
0
0
master - Revert "man: lvmthin should use clearer thin pool options"
by Zdenek Kabelac
27 Sep '14
27 Sep '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=17a1869df506a364…
Commit: 17a1869df506a3641d49d52c413b5bc04ec2adc9 Parent: 95df06d721048f7089fd46ca5332f75ec64a8cb5 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Sat Sep 27 15:08:31 2014 +0200 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Sat Sep 27 15:08:31 2014 +0200 Revert "man: lvmthin should use clearer thin pool options" Revert: --cachepool and --thipnpool is the right way they both take arg This is a major difference from --cache and --thin --- man/lvmthin.7.in | 50 +++++++++++++++++++------------------------------- 1 files changed, 19 insertions(+), 31 deletions(-) diff --git a/man/lvmthin.7.in b/man/lvmthin.7.in index 30a31d1..6652f7e 100644 --- a/man/lvmthin.7.in +++ b/man/lvmthin.7.in @@ -129,11 +129,11 @@ ThinMetaLV is renamed to hidden ThinPoolLV_tmeta. The new ThinPoolLV takes the previous name of ThinDataLV. .fi -.B lvconvert \-\-type thin-pool \-\-poolmetadata VG/ThinMetaLV VG/ThinDataLV +.B lvconvert \-\-thinpool VG/ThinDataLV \-\-poolmetadata VG/ThinMetaLV .I Example .br -# lvconvert \-\-type thin-pool \-\-poolmetadata vg/pool0meta vg/pool0 +# lvconvert \-\-thinpool vg/pool0 \-\-poolmetadata vg/pool0meta # lvs vg/pool0 LV VG Attr LSize Pool Origin Data% Meta% @@ -286,14 +286,14 @@ to use fast devices for the metadata LV. .br .B lvcreate \-n ThinMetaLV \-L SmallSize VG SmallPV .br -.B lvconvert \-\-type thin\-pool \-\-poolmetadata VG/ThinMetaLV VG/ThinDataLV +.B lvconvert \-\-thinpool VG/ThinDataLV \-\-poolmetadata VG/ThinMetaLV .I Example .br .nf # lvcreate \-n pool0 \-L 10G vg /dev/sdA # lvcreate \-n pool0meta \-L 1G vg /dev/sdB -# lvconvert \-\-type thin\-pool \-\-poolmetadata vg/pool0meta vg/pool0 +# lvconvert \-\-thinpool vg/pool0 \-\-poolmetadata vg/pool0meta .fi .BR lvm.conf (5) @@ -314,14 +314,14 @@ pool metadata LV. This is especially recommended for pool metadata LVs. .br .B lvcreate \-\-type raid1 \-m 1 \-n ThinDataLV \-L LargeSize VG PVC PVD .br -.B lvconvert \-\-type thin\-pool \-\-poolmetadata VG/ThinMetaLV VG/ThinDataLV +.B lvconvert \-\-thinpool VG/ThinDataLV \-\-poolmetadata VG/ThinMetaLV .I Example .br .nf # lvcreate \-\-type raid1 \-m 1 \-n pool0 \-L 10G vg /dev/sdA /dev/sdB # lvcreate \-\-type raid1 \-m 1 \-n pool0meta \-L 1G vg /dev/sdC /dev/sdD -# lvconvert \-\-type thin\-pool \-\-poolmetadata vg/pool0meta vg/pool0 +# lvconvert \-\-thinpool vg/pool0 \-\-poolmetadata vg/pool0meta .fi @@ -348,7 +348,7 @@ explicitly. .nf # lvcreate \-n pool0 \-L 10G vg # lvcreate \-n pool0meta \-L 1G vg -# lvconvert \-\-type thin\-pool \-\-poolmetadata vg/pool0meta vg/pool0 +# lvconvert \-\-thinpool vg/pool0 \-\-poolmetadata vg/pool0meta # lvs \-a [lvol0_pmspare] vg ewi------- 10.00g @@ -430,13 +430,13 @@ create a metadata LV from the same VG. .B lvcreate \-n ThinDataLV \-L LargeSize VG .br -.B lvconvert \-\-type thin\-pool VG/ThinDataLV +.B lvconvert \-\-thinpool VG/ThinDataLV .I Example .br .nf # lvcreate \-n pool0 \-L 10G vg -# lvconvert \-\-type thin\-pool vg/pool0 +# lvconvert \-\-thinpool vg/pool0 # lvs \-a pool0 vg twi-a-tz-- 10.00g @@ -772,11 +772,10 @@ indicated by the "z" attribute displayed by lvs. The option \-Z Command to set the zeroing mode when creating a thin pool LV: .br -.B lvconvert \-\-type thin\-pool \-Z{y|n} +.B lvconvert \-Z{y|n} \-\-thinpool VG/ThinDataLV .br -.RS -.B \-\-poolmetadata VG/ThinMetaLV VG/ThinDataLV -.RE +.B " " \-\-poolmetadata VG/ThinMetaLV + Command to change the zeroing mode of an existing thin pool LV: .br @@ -820,7 +819,7 @@ Command to set the discard mode when creating a thin pool LV: .B lvconvert \-\-discards {ignore|nopassdown|passdown} .br .RS -.B \-\-type thin\-pool \-\-poolmetadata VG/ThinMetaLV VG/ThinDataLV +.B \-\-thinpool VG/ThinDataLV \-\-poolmetadata VG/ThinMetaLV .RE Command to change the discard mode of an existing thin pool LV: @@ -967,16 +966,12 @@ rather than using lvconvert on existing LVs. This one command creates a thin data LV, a thin metadata LV, and combines the two into a thin pool LV. -.B lvcreate \-\-type thin\-pool \-L LargeSize VG/ThinPoolLV - -./" FIXME: make this work -./" or using standard form of lvcreate: -./" .B lvcreate \-\-type thin\-pool \-L LargeSize \-n ThinPoolLV VG +.B lvcreate \-L LargeSize \-\-thinpool VG/ThinPoolLV .I Example .br .nf -# lvcreate \-\-type thin\-pool \-L8M vg/pool0 +# lvcreate \-L8M \-\-thinpool vg/pool0 # lvs vg/pool0 LV VG Attr LSize Pool Origin Data% @@ -1002,17 +997,13 @@ and creates a thin LV in the new pool. .br \-V VirtualSize specifies the virtual size of the thin LV. -.B lvcreate \-V VirtualSize \-L LargeSize -.RS -.B \-n ThinLV \-\-thinpool VG/ThinPoolLV -.RE - -./" FIXME: make this work -./" lvcreate \-\-type thin\-pool \-V VirtualSize \-L LargeSize \-n ThinLV VG/ThinPoolLV +.B lvcreate \-L LargeSize \-V VirtualSize \-n ThinLV +.br +.B " " \-\-thinpool VG/ThinPoolLV Equivalent to: .br -.B lvcreate \-\-type thin\-pool \-L LargeSize VG/ThinPoolLV +.B lvcreate \-L LargeSize \-\-thinpool VG/ThinPoolLV .br .B lvcreate \-n ThinLV \-V VirtualSize \-\-thinpool VG/ThinPoolLV @@ -1021,9 +1012,6 @@ Equivalent to: .nf # lvcreate \-L8M \-V2G \-n thin1 \-\-thinpool vg/pool0 -./" FIXME: change to -./" lvcreate \-\-type thin\-pool \-L8M \-V2G \-n thin1 vg/pool0 - # lvs \-a pool0 vg twi-a-tz-- 8.00m [pool0_tdata] vg Twi-ao---- 8.00m
1
0
0
0
master - man: lvmthin should use clearer thin pool options
by David Teigland
26 Sep '14
26 Sep '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=95df06d721048f70…
Commit: 95df06d721048f7089fd46ca5332f75ec64a8cb5 Parent: b53504ed37d3b0aa8dac193cb4539ea91120253d Author: David Teigland <teigland(a)redhat.com> AuthorDate: Fri Sep 26 16:05:30 2014 -0500 Committer: David Teigland <teigland(a)redhat.com> CommitterDate: Fri Sep 26 16:05:30 2014 -0500 man: lvmthin should use clearer thin pool options Previously, this was the recommended form for creating a thin pool: lvconvert --thinpool VG/ThinDataLV --poolmetadata VG/ThinMetaLV but this is confusing, because --thinpool does not actually take an arg, and is more naturally used to specify an existing thin pool. The new recommended form is: lvconvert --type thin-pool --poolmetadata VG/ThinMetaLV VG/ThinDataLV --- man/lvmthin.7.in | 50 +++++++++++++++++++++++++++++++------------------- 1 files changed, 31 insertions(+), 19 deletions(-) diff --git a/man/lvmthin.7.in b/man/lvmthin.7.in index 6652f7e..30a31d1 100644 --- a/man/lvmthin.7.in +++ b/man/lvmthin.7.in @@ -129,11 +129,11 @@ ThinMetaLV is renamed to hidden ThinPoolLV_tmeta. The new ThinPoolLV takes the previous name of ThinDataLV. .fi -.B lvconvert \-\-thinpool VG/ThinDataLV \-\-poolmetadata VG/ThinMetaLV +.B lvconvert \-\-type thin-pool \-\-poolmetadata VG/ThinMetaLV VG/ThinDataLV .I Example .br -# lvconvert \-\-thinpool vg/pool0 \-\-poolmetadata vg/pool0meta +# lvconvert \-\-type thin-pool \-\-poolmetadata vg/pool0meta vg/pool0 # lvs vg/pool0 LV VG Attr LSize Pool Origin Data% Meta% @@ -286,14 +286,14 @@ to use fast devices for the metadata LV. .br .B lvcreate \-n ThinMetaLV \-L SmallSize VG SmallPV .br -.B lvconvert \-\-thinpool VG/ThinDataLV \-\-poolmetadata VG/ThinMetaLV +.B lvconvert \-\-type thin\-pool \-\-poolmetadata VG/ThinMetaLV VG/ThinDataLV .I Example .br .nf # lvcreate \-n pool0 \-L 10G vg /dev/sdA # lvcreate \-n pool0meta \-L 1G vg /dev/sdB -# lvconvert \-\-thinpool vg/pool0 \-\-poolmetadata vg/pool0meta +# lvconvert \-\-type thin\-pool \-\-poolmetadata vg/pool0meta vg/pool0 .fi .BR lvm.conf (5) @@ -314,14 +314,14 @@ pool metadata LV. This is especially recommended for pool metadata LVs. .br .B lvcreate \-\-type raid1 \-m 1 \-n ThinDataLV \-L LargeSize VG PVC PVD .br -.B lvconvert \-\-thinpool VG/ThinDataLV \-\-poolmetadata VG/ThinMetaLV +.B lvconvert \-\-type thin\-pool \-\-poolmetadata VG/ThinMetaLV VG/ThinDataLV .I Example .br .nf # lvcreate \-\-type raid1 \-m 1 \-n pool0 \-L 10G vg /dev/sdA /dev/sdB # lvcreate \-\-type raid1 \-m 1 \-n pool0meta \-L 1G vg /dev/sdC /dev/sdD -# lvconvert \-\-thinpool vg/pool0 \-\-poolmetadata vg/pool0meta +# lvconvert \-\-type thin\-pool \-\-poolmetadata vg/pool0meta vg/pool0 .fi @@ -348,7 +348,7 @@ explicitly. .nf # lvcreate \-n pool0 \-L 10G vg # lvcreate \-n pool0meta \-L 1G vg -# lvconvert \-\-thinpool vg/pool0 \-\-poolmetadata vg/pool0meta +# lvconvert \-\-type thin\-pool \-\-poolmetadata vg/pool0meta vg/pool0 # lvs \-a [lvol0_pmspare] vg ewi------- 10.00g @@ -430,13 +430,13 @@ create a metadata LV from the same VG. .B lvcreate \-n ThinDataLV \-L LargeSize VG .br -.B lvconvert \-\-thinpool VG/ThinDataLV +.B lvconvert \-\-type thin\-pool VG/ThinDataLV .I Example .br .nf # lvcreate \-n pool0 \-L 10G vg -# lvconvert \-\-thinpool vg/pool0 +# lvconvert \-\-type thin\-pool vg/pool0 # lvs \-a pool0 vg twi-a-tz-- 10.00g @@ -772,10 +772,11 @@ indicated by the "z" attribute displayed by lvs. The option \-Z Command to set the zeroing mode when creating a thin pool LV: .br -.B lvconvert \-Z{y|n} \-\-thinpool VG/ThinDataLV +.B lvconvert \-\-type thin\-pool \-Z{y|n} .br -.B " " \-\-poolmetadata VG/ThinMetaLV - +.RS +.B \-\-poolmetadata VG/ThinMetaLV VG/ThinDataLV +.RE Command to change the zeroing mode of an existing thin pool LV: .br @@ -819,7 +820,7 @@ Command to set the discard mode when creating a thin pool LV: .B lvconvert \-\-discards {ignore|nopassdown|passdown} .br .RS -.B \-\-thinpool VG/ThinDataLV \-\-poolmetadata VG/ThinMetaLV +.B \-\-type thin\-pool \-\-poolmetadata VG/ThinMetaLV VG/ThinDataLV .RE Command to change the discard mode of an existing thin pool LV: @@ -966,12 +967,16 @@ rather than using lvconvert on existing LVs. This one command creates a thin data LV, a thin metadata LV, and combines the two into a thin pool LV. -.B lvcreate \-L LargeSize \-\-thinpool VG/ThinPoolLV +.B lvcreate \-\-type thin\-pool \-L LargeSize VG/ThinPoolLV + +./" FIXME: make this work +./" or using standard form of lvcreate: +./" .B lvcreate \-\-type thin\-pool \-L LargeSize \-n ThinPoolLV VG .I Example .br .nf -# lvcreate \-L8M \-\-thinpool vg/pool0 +# lvcreate \-\-type thin\-pool \-L8M vg/pool0 # lvs vg/pool0 LV VG Attr LSize Pool Origin Data% @@ -997,13 +1002,17 @@ and creates a thin LV in the new pool. .br \-V VirtualSize specifies the virtual size of the thin LV. -.B lvcreate \-L LargeSize \-V VirtualSize \-n ThinLV -.br -.B " " \-\-thinpool VG/ThinPoolLV +.B lvcreate \-V VirtualSize \-L LargeSize +.RS +.B \-n ThinLV \-\-thinpool VG/ThinPoolLV +.RE + +./" FIXME: make this work +./" lvcreate \-\-type thin\-pool \-V VirtualSize \-L LargeSize \-n ThinLV VG/ThinPoolLV Equivalent to: .br -.B lvcreate \-L LargeSize \-\-thinpool VG/ThinPoolLV +.B lvcreate \-\-type thin\-pool \-L LargeSize VG/ThinPoolLV .br .B lvcreate \-n ThinLV \-V VirtualSize \-\-thinpool VG/ThinPoolLV @@ -1012,6 +1021,9 @@ Equivalent to: .nf # lvcreate \-L8M \-V2G \-n thin1 \-\-thinpool vg/pool0 +./" FIXME: change to +./" lvcreate \-\-type thin\-pool \-L8M \-V2G \-n thin1 vg/pool0 + # lvs \-a pool0 vg twi-a-tz-- 8.00m [pool0_tdata] vg Twi-ao---- 8.00m
1
0
0
0
master - man: lvmcache should use clearer cache pool options
by David Teigland
26 Sep '14
26 Sep '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b53504ed37d3b0aa…
Commit: b53504ed37d3b0aa8dac193cb4539ea91120253d Parent: 26dd17f8345f512a48768f7fcf74e0c65558032c Author: David Teigland <teigland(a)redhat.com> AuthorDate: Fri Sep 26 14:40:40 2014 -0500 Committer: David Teigland <teigland(a)redhat.com> CommitterDate: Fri Sep 26 14:40:40 2014 -0500 man: lvmcache should use clearer cache pool options Previously, this was the recommended form for creating a cache pool: lvconvert --cachepool VG/CacheDataLV --poolmetadata VG/CacheMetaLV but this is confusing, because --cachepool does not actually take an arg, and is more natually used to specify an existing cache pool. The new recommended form is: lvconvert --type cache-pool --poolmetadata VG/CacheMetaLV VG/CacheDataLV --- man/lvmcache.7.in | 32 ++++++++++++++++++-------------- 1 files changed, 18 insertions(+), 14 deletions(-) diff --git a/man/lvmcache.7.in b/man/lvmcache.7.in index cc92673..6d7109a 100644 --- a/man/lvmcache.7.in +++ b/man/lvmcache.7.in @@ -88,11 +88,15 @@ CacheDataLV is renamed CachePoolLV_cdata and becomes hidden. .br CacheMetaLV is renamed CachePoolLV_cmeta and becomes hidden. -.B lvconvert \-\-cachepool VG/CacheDataLV \-\-poolmetadata VG/CacheMetaLV +.B lvconvert \-\-type cache-pool \-\-poolmetadata VG/CacheMetaLV \\ +.br +.RS +.B VG/CacheDataLV +.RE .I Example .br -# lvconvert \-\-cachepool vg/cache0 \-\-poolmetadata vg/cache0meta +# lvconvert \-\-type cache\-pool \-\-poolmetadata vg/cache0meta vg/cache0 .nf # lvs -a vg @@ -193,21 +197,21 @@ pool sub-LVs redundant. .nf 0. Create an origin LV we wish to cache -# lvcreate \-L 10G \-n lvx vg /dev/slow_devs +# lvcreate \-L 10G \-n lv1 vg /dev/slow_devs 1. Create a 2-way RAID1 cache data LV -# lvcreate \-\-type raid1 \-m 1 \-L 1G -n lvx_cache vg \\ +# lvcreate \-\-type raid1 \-m 1 \-L 1G -n cache1 vg \\ /dev/fast1 /dev/fast2 2. Create a 2-way RAID1 cache metadata LV -# lvcreate \-\-type raid1 \-m 1 \-L 8M -n lvx_cache_meta vg \\ +# lvcreate \-\-type raid1 \-m 1 \-L 8M -n cache1meta vg \\ /dev/fast1 /dev/fast2 3. Create a cache pool LV combining cache data LV and cache metadata LV -# lvconvert \-\-cachepool vg/lvx_cache \-\-poolmetadata vg/lvx_cache_meta +# lvconvert \-\-type cache\-pool \-\-poolmetadata vg/cache1meta vg/cache1 4. Create a cached LV by combining the cache pool LV and origin LV -# lvconvert \-\-type cache \-\-cachepool vg/lvx_cache vg/lvx +# lvconvert \-\-type cache \-\-cachepool vg/cache1 vg/lv1 .fi .SS Writethough caching @@ -223,20 +227,20 @@ cache pool LV, properties of the cache can be specified - in this case, .nf 0. Create an origin LV we wish to cache (yours may already exist) -# lvcreate \-L 10G \-n lvx vg /dev/slow +# lvcreate \-L 10G \-n lv1 vg /dev/slow 1. Create a cache data LV -# lvcreate \-L 1G \-n lvx_cache vg /dev/fast +# lvcreate \-L 1G \-n cache1 vg /dev/fast 2. Create a cache metadata LV -# lvcreate \-L 8M \-n lvx_cache_meta vg /dev/fast +# lvcreate \-L 8M \-n cache1meta vg /dev/fast 3. Create a cache pool LV specifying cache mode "writethrough" -# lvconvert \-\-cachepool vg/lvx_cache \-\-poolmetadata vg/lvx_cache_meta \\ - \-\-cachemode writethrough +# lvconvert \-\-type cache\-pool \-\-poolmetadata vg/cache1meta \\ + \-\-cachemode writethrough vg/cache1 4. Create a cache LV by combining the cache pool LV and origin LV -# lvconvert \-\-type cache \-\-cachepool vg/lvx_cache vg/lvx +# lvconvert \-\-type cache \-\-cachepool vg/cache1 vg/lv1 .fi .SS Spare metadata LV @@ -258,7 +262,7 @@ the same VG. .B lvcreate -n CacheDataLV -L CacheSize VG .br -.B lvconvert --cachepool VG/CacheDataLV +.B lvconvert --type cache\-pool VG/CacheDataLV .SH SEE ALSO
1
0
0
0
master - lvchange: missed bits for a8aee7dba2b76
by Zdenek Kabelac
24 Sep '14
24 Sep '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=26dd17f8345f512a…
Commit: 26dd17f8345f512a48768f7fcf74e0c65558032c Parent: 45f57477f46368fbad1864e4606690b274dd2e7d Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Wed Sep 24 16:27:35 2014 +0200 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Wed Sep 24 16:30:02 2014 +0200 lvchange: missed bits for a8aee7dba2b76 lv_info is not used here any more. This code should have been committed with lv_check_not_in_use API change commit. --- tools/lvchange.c | 25 +++++++++++-------------- 1 files changed, 11 insertions(+), 14 deletions(-) diff --git a/tools/lvchange.c b/tools/lvchange.c index 288b736..7976bf3 100644 --- a/tools/lvchange.c +++ b/tools/lvchange.c @@ -281,7 +281,6 @@ static int lvchange_resync(struct cmd_context *cmd, struct logical_volume *lv) int active = 0; int exclusive = 0; int monitored; - struct lvinfo info; struct lv_segment *seg = first_seg(lv); struct dm_list device_list; struct lv_list *lvl; @@ -311,20 +310,18 @@ static int lvchange_resync(struct cmd_context *cmd, struct logical_volume *lv) return 0; } - if (info.exists) { - if (!arg_count(cmd, yes_ARG) && - yes_no_prompt("Do you really want to deactivate " - "logical volume %s to resync it? [y/n]: ", - lv->name) == 'n') { - log_error("Logical volume \"%s\" not resynced", - lv->name); - return 0; - } - - active = 1; - if (lv_is_active_exclusive_locally(lv)) - exclusive = 1; + if (!arg_count(cmd, yes_ARG) && + yes_no_prompt("Do you really want to deactivate " + "logical volume %s to resync it? [y/n]: ", + lv->name) == 'n') { + log_error("Logical volume \"%s\" not resynced", + lv->name); + return 0; } + + active = 1; + if (lv_is_active_exclusive_locally(lv)) + exclusive = 1; } if (seg_is_raid(seg) && active && !exclusive) {
1
0
0
0
master - cleanup: Use segtype.h definitions of segment type names wherever possible
by Peter Rajnoha
24 Sep '14
24 Sep '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=45f57477f46368fb…
Commit: 45f57477f46368fbad1864e4606690b274dd2e7d Parent: 21aa850b43535ab251eebabe2a2773a62439bf61 Author: Heinz Mauelshagen <heinzm(a)redhat.com> AuthorDate: Wed Sep 24 15:24:41 2014 +0200 Committer: Peter Rajnoha <prajnoha(a)redhat.com> CommitterDate: Wed Sep 24 15:24:41 2014 +0200 cleanup: Use segtype.h definitions of segment type names wherever possible We are not using already defined segement type names where we could. There is a lot of other places in device-mapper and LVM2 we have those hardcoded so we should better finally have a common interface in libdevmapper to avoid this. --- lib/metadata/lv_manip.c | 30 +++++++++++++++--------------- lib/metadata/raid_manip.c | 12 ++++++------ lib/raid/raid.c | 4 ++-- tools/lvchange.c | 2 +- tools/lvconvert.c | 9 +++++---- tools/lvcreate.c | 10 +++++----- 6 files changed, 34 insertions(+), 33 deletions(-) diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index 70e8013..6136b43 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -158,18 +158,18 @@ static const char *_lv_type_names[] = { [LV_TYPE_DATA] = "data", [LV_TYPE_SPARE] = "spare", [LV_TYPE_VIRTUAL] = "virtual", - [LV_TYPE_RAID1] = "raid1", - [LV_TYPE_RAID10] = "raid10", - [LV_TYPE_RAID4] = "raid4", - [LV_TYPE_RAID5] = "raid5", - [LV_TYPE_RAID5_LA] = "raid5_la", - [LV_TYPE_RAID5_RA] = "raid5_ra", - [LV_TYPE_RAID5_LS] = "raid5_ls", - [LV_TYPE_RAID5_RS] = "raid5_rs", - [LV_TYPE_RAID6] = "raid6", - [LV_TYPE_RAID6_ZR] = "raid6_zr", - [LV_TYPE_RAID6_NR] = "raid6_nr", - [LV_TYPE_RAID6_NC] = "raid6_nc", + [LV_TYPE_RAID1] = SEG_TYPE_NAME_RAID1, + [LV_TYPE_RAID10] = SEG_TYPE_NAME_RAID10, + [LV_TYPE_RAID4] = SEG_TYPE_NAME_RAID4, + [LV_TYPE_RAID5] = SEG_TYPE_NAME_RAID5, + [LV_TYPE_RAID5_LA] = SEG_TYPE_NAME_RAID5_LA, + [LV_TYPE_RAID5_RA] = SEG_TYPE_NAME_RAID5_RA, + [LV_TYPE_RAID5_LS] = SEG_TYPE_NAME_RAID5_LS, + [LV_TYPE_RAID5_RS] = SEG_TYPE_NAME_RAID5_RS, + [LV_TYPE_RAID6] = SEG_TYPE_NAME_RAID6, + [LV_TYPE_RAID6_ZR] = SEG_TYPE_NAME_RAID6_ZR, + [LV_TYPE_RAID6_NR] = SEG_TYPE_NAME_RAID6_NR, + [LV_TYPE_RAID6_NC] = SEG_TYPE_NAME_RAID6_NC, }; static int _lv_layout_and_role_mirror(struct dm_pool *mem, @@ -1476,7 +1476,7 @@ static uint32_t _calc_area_multiple(const struct segment_type *segtype, * the 'stripes' argument will always need to * be given. */ - if (!strcmp(segtype->name, "raid10")) { + if (!strcmp(segtype->name, _lv_type_names[LV_TYPE_RAID10])) { if (!stripes) return area_count / 2; return stripes; @@ -4575,7 +4575,7 @@ static int _lvresize_adjust_extents(struct cmd_context *cmd, struct logical_volu return 0; } - if (!strcmp(mirr_seg->segtype->name, "raid10")) { + if (!strcmp(mirr_seg->segtype->name, _lv_type_names[LV_TYPE_RAID10])) { /* FIXME Warn if command line values are being overridden? */ lp->stripes = mirr_seg->area_count / seg_mirrors; lp->stripe_size = mirr_seg->stripe_size; @@ -4588,7 +4588,7 @@ static int _lvresize_adjust_extents(struct cmd_context *cmd, struct logical_volu /* Allow through "striped" and RAID 4/5/6/10 */ if (!seg_is_striped(seg) && (!seg_is_raid(seg) || seg_is_mirrored(seg)) && - strcmp(seg->segtype->name, "raid10")) + strcmp(seg->segtype->name, _lv_type_names[LV_TYPE_RAID10])) continue; sz = seg->stripe_size; diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c index c07de90..44272e8 100644 --- a/lib/metadata/raid_manip.c +++ b/lib/metadata/raid_manip.c @@ -431,7 +431,7 @@ static int _alloc_image_components(struct logical_volume *lv, if (seg_is_raid(seg)) segtype = seg->segtype; - else if (!(segtype = get_segtype_from_string(lv->vg->cmd, "raid1"))) + else if (!(segtype = get_segtype_from_string(lv->vg->cmd, SEG_TYPE_NAME_RAID1))) return_0; /* @@ -631,7 +631,7 @@ static int _raid_add_images(struct logical_volume *lv, log_very_verbose("Setting RAID1 region_size to %uS", seg->region_size); } - if (!(seg->segtype = get_segtype_from_string(lv->vg->cmd, "raid1"))) + if (!(seg->segtype = get_segtype_from_string(lv->vg->cmd, SEG_TYPE_NAME_RAID1))) return_0; } /* @@ -1073,7 +1073,7 @@ int lv_raid_split(struct logical_volume *lv, const char *split_name, } if (!seg_is_mirrored(first_seg(lv)) || - !strcmp(first_seg(lv)->segtype->name, "raid10")) { + !strcmp(first_seg(lv)->segtype->name, SEG_TYPE_NAME_RAID10)) { log_error("Unable to split logical volume of segment type, %s", first_seg(lv)->segtype->ops->name(first_seg(lv))); return 0; @@ -1440,7 +1440,7 @@ int lv_raid_reshape(struct logical_volume *lv, } if (!strcmp(seg->segtype->name, "mirror") && - (!strcmp(new_segtype->name, "raid1"))) + (!strcmp(new_segtype->name, SEG_TYPE_NAME_RAID1))) return _convert_mirror_to_raid1(lv, new_segtype); log_error("Converting the segment type for %s/%s from %s to %s" @@ -1604,7 +1604,7 @@ int lv_raid_replace(struct logical_volume *lv, raid_seg->segtype->ops->name(raid_seg), lv->vg->name, lv->name); return 0; - } else if (!strcmp(raid_seg->segtype->name, "raid10")) { + } else if (!strcmp(raid_seg->segtype->name, SEG_TYPE_NAME_RAID10)) { uint32_t i, rebuilds_per_group = 0; /* FIXME: We only support 2-way mirrors in RAID10 currently */ uint32_t copies = 2; @@ -1829,7 +1829,7 @@ static int _partial_raid_lv_is_redundant(const struct logical_volume *lv) uint32_t i, s, rebuilds_per_group = 0; uint32_t failed_components = 0; - if (!strcmp(raid_seg->segtype->name, "raid10")) { + if (!strcmp(raid_seg->segtype->name, SEG_TYPE_NAME_RAID10)) { /* FIXME: We only support 2-way mirrors in RAID10 currently */ copies = 2; for (i = 0; i < raid_seg->area_count * copies; i++) { diff --git a/lib/raid/raid.c b/lib/raid/raid.c index 831c912..6628dc8 100644 --- a/lib/raid/raid.c +++ b/lib/raid/raid.c @@ -248,7 +248,7 @@ static int _raid_add_target_line(struct dev_manager *dm __attribute__((unused)), /* RAID 4/5/6 */ params.mirrors = 1; params.stripes = seg->area_count - seg->segtype->parity_devs; - } else if (strcmp(seg->segtype->name, "raid10")) { + } else if (strcmp(seg->segtype->name, SEG_TYPE_NAME_RAID10)) { /* RAID 10 only supports 2 mirrors now */ params.mirrors = 2; params.stripes = seg->area_count / 2; @@ -336,7 +336,7 @@ static int _raid_target_present(struct cmd_context *cmd, unsigned raid_feature; const char *feature; } _features[] = { - { 1, 3, RAID_FEATURE_RAID10, "raid10" }, + { 1, 3, RAID_FEATURE_RAID10, SEG_TYPE_NAME_RAID10 }, }; static int _raid_checked = 0; diff --git a/tools/lvchange.c b/tools/lvchange.c index 7497bde..288b736 100644 --- a/tools/lvchange.c +++ b/tools/lvchange.c @@ -640,7 +640,7 @@ static int lvchange_writemostly(struct logical_volume *lv) struct cmd_context *cmd = lv->vg->cmd; struct lv_segment *raid_seg = first_seg(lv); - if (strcmp(raid_seg->segtype->name, "raid1")) { + if (strcmp(raid_seg->segtype->name, SEG_TYPE_NAME_RAID1)) { log_error("--write%s can only be used with 'raid1' segment type", arg_count(cmd, writemostly_ARG) ? "mostly" : "behind"); return 0; diff --git a/tools/lvconvert.c b/tools/lvconvert.c index 1d60c21..28a3526 100644 --- a/tools/lvconvert.c +++ b/tools/lvconvert.c @@ -1720,8 +1720,9 @@ static int _lvconvert_mirrors(struct cmd_context *cmd, if (lv_is_thin_type(lv)) { log_error("Mirror segment type cannot be used for thinpool%s.\n" - "Try \"raid1\" segment type instead.", - lv_is_thin_pool_data(lv) ? "s" : " metadata"); + "Try \"%s\" segment type instead.", + lv_is_thin_pool_data(lv) ? "s" : " metadata", + SEG_TYPE_NAME_RAID1); return 0; } @@ -2667,7 +2668,7 @@ static int _lvconvert_pool(struct cmd_context *cmd, if (lv_is_mirror(pool_lv)) { log_error("Mirror logical volumes cannot be used as pools."); - log_print_unless_silent("Try \"raid1\" segment type instead."); + log_print_unless_silent("Try \"%s\" segment type instead.", SEG_TYPE_NAME_RAID1); return 0; } @@ -2713,7 +2714,7 @@ static int _lvconvert_pool(struct cmd_context *cmd, if (lv_is_mirror(metadata_lv)) { log_error("Mirror logical volumes cannot be used for pool metadata."); - log_print_unless_silent("Try \"raid1\" segment type instead."); + log_print_unless_silent("Try \"%s\" segment type instead.", SEG_TYPE_NAME_RAID1); return 0; } diff --git a/tools/lvcreate.c b/tools/lvcreate.c index 499d686..7c811ba 100644 --- a/tools/lvcreate.c +++ b/tools/lvcreate.c @@ -625,7 +625,7 @@ static int _read_raid_params(struct lvcreate_params *lp, return 0; } - if (!strcmp(lp->segtype->name, "raid10") && (lp->stripes < 2)) { + if (!strcmp(lp->segtype->name, SEG_TYPE_NAME_RAID10) && (lp->stripes < 2)) { if (arg_count(cmd, stripes_ARG)) { /* User supplied the bad argument */ log_error("Segment type 'raid10' requires 2 or more stripes."); @@ -651,7 +651,7 @@ static int _read_raid_params(struct lvcreate_params *lp, */ if ((lp->stripes > 1) && segtype_is_mirrored(lp->segtype) && - strcmp(lp->segtype->name, "raid10")) { + strcmp(lp->segtype->name, SEG_TYPE_NAME_RAID10)) { log_error("Stripe argument cannot be used with segment type, %s", lp->segtype->name); return 0; @@ -895,7 +895,7 @@ static int _lvcreate_params(struct lvcreate_params *lp, log_print_unless_silent("Redundant mirrors argument: default is 0"); } - if ((lp->mirrors > 2) && !strcmp(lp->segtype->name, "raid10")) { + if ((lp->mirrors > 2) && !strcmp(lp->segtype->name, SEG_TYPE_NAME_RAID10)) { /* * FIXME: When RAID10 is no longer limited to * 2-way mirror, 'lv_mirror_count()' @@ -942,7 +942,7 @@ static int _lvcreate_params(struct lvcreate_params *lp, return 0; } - if ((strcmp(lp->segtype->name, "raid10") == 0) && + if (!strcmp(lp->segtype->name, SEG_TYPE_NAME_RAID10) && !(lp->target_attr & RAID_FEATURE_RAID10)) { log_error("RAID module does not support RAID10."); return 0; @@ -1154,7 +1154,7 @@ static int _check_raid_parameters(struct volume_group *vg, lp->segtype->name); return 0; } - } else if (!strcmp(lp->segtype->name, "raid10")) { + } else if (!strcmp(lp->segtype->name, SEG_TYPE_NAME_RAID10)) { if (!arg_count(cmd, stripes_ARG)) lp->stripes = devs / lp->mirrors; if (lp->stripes < 2) {
1
0
0
0
← Newer
1
2
3
4
5
...
16
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Results per page:
10
25
50
100
200