]> sourceware.org Git - lvm2.git/commitdiff
lvcreate: regression fix on lv name limits
authorZdenek Kabelac <zkabelac@redhat.com>
Tue, 7 Oct 2014 13:41:54 +0000 (15:41 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Tue, 7 Oct 2014 13:52:31 +0000 (15:52 +0200)
When we are given an existing LV name - it needs to be allowed
to pass in even restricted name as the LV could have existed
long before we introduced some new restriction on prefix/suffix.i

Fix the regression on name limits and drop restriction to be applied
on any existing LVs - only the new created LV names have to be
complient with current name restrictions.

FIXME: we are currently using restricted names incorrectly in few
other places - device_is_usable() skips restricted names,
and udev flags are also incorrectly set for restricted names
so these LVs are not getting links properly.

lib/metadata/lv_manip.c
tools/lvcreate.c
tools/toollib.c

index 892f7ca6ce7a83d24dbaa72327427c052d58f762..f14cec0e190d0c44c9bd5b2b17414c59d4e6c2e9 100644 (file)
@@ -7172,6 +7172,9 @@ struct logical_volume *lv_create_single(struct volume_group *vg,
                            !(lp->segtype = get_segtype_from_string(vg->cmd, "thin-pool")))
                                return_NULL;
 
+                       if (lp->pool_name && !apply_lvname_restrictions(lp->pool_name))
+                               return_NULL;
+
                        if (!(lv = _lv_create_an_lv(vg, lp, lp->pool_name)))
                                return_NULL;
 
@@ -7188,6 +7191,9 @@ struct logical_volume *lv_create_single(struct volume_group *vg,
                                                                    "cache-pool")))
                                return_NULL;
 
+                       if (lp->pool_name && !apply_lvname_restrictions(lp->pool_name))
+                               return_NULL;
+
                        if (!(lv = _lv_create_an_lv(vg, lp, lp->pool_name)))
                                return_NULL;
 
index 2fa791832fe27f2016f0790a0f585f1ed6871b6c..41b8ee349959b3fd213161e6f1e91af010f7553b 100644 (file)
@@ -54,6 +54,9 @@ static int _lvcreate_name_params(struct lvcreate_params *lp,
        if (!validate_lvname_param(cmd, &lp->vg_name, &lp->lv_name))
                return_0;
 
+       if (lp->lv_name && !apply_lvname_restrictions(lp->lv_name))
+               return_0;
+
        lp->pool_name = arg_str_value(cmd, thinpool_ARG, NULL)
                ? : arg_str_value(cmd, cachepool_ARG, NULL);
        if (!validate_lvname_param(cmd, &lp->vg_name, &lp->pool_name))
index 1ee846998a35e19e0a55ef7f2d5f05ce10d4fdb4..3b1b00feb84853323afdddb65428ef846abad9b8 100644 (file)
@@ -1300,9 +1300,6 @@ int validate_lvname_param(struct cmd_context *cmd, const char **vg_name,
                *lv_name = lvname;
        }
 
-       if (!apply_lvname_restrictions(*lv_name))
-               return_0;
-
        if (!validate_name(*lv_name)) {
                log_error("Logical volume name \"%s\" is invalid.",
                          *lv_name);
This page took 0.051203 seconds and 5 git commands to generate.